Execute an analytics query against Piwik PRO.
REQUIRED WORKFLOW - You must follow these steps in order:
1. Call `analytics_dimensions_list` to get available dimension IDs
2. Call `analytics_metrics_list` to get available metric IDs
3. Call `analytics_dimensions_details_list` for details on dimensions you plan to use
4. Call `analytics_metrics_details_list` for details on metrics you plan to use
5. Call this tool with validated column_ids and transformation_ids
Column IDs and transformation IDs must exactly match values returned by the list and
details endpoints. Guessing or inventing IDs will cause query failures.
DO NOT RUN THIS TOOL BEFORE CHECKING DIMENSIONS AND METRICS DETAILS!
Important: Metrics cannot be transformed. Only dimensions accept transformation_id.
---
Args:
website_id: UUID of the website/app to query
columns: List of column definitions. Each column is a dict with:
- column_id (required): Dimension or metric ID from the list endpoints
(in case of calculated metric use always string "calculated_metric",
in case of custom channel grouping use always string "custom_channel_grouping")
- transformation_id (optional): Aggregation function from details endpoint
(e.g., "sum", "count", "unique_count")
Note: Only dimensions support transformations. Metrics cannot be transformed.
- calculated_metric_id: only for calculated metrics
- custom_channel_grouping_id: only for custom channel groupings
- dimension_value_grouping_id: only for transformation_id = 'dimension_value_grouping'
- event_type: optional int value only for transformed dimension with scope = 'product'
Allowed values:
Order: 9, Abandoned cart: 10, Product detail view: 22, Add to cart: 23, Remove from cart: 24
date_from: Start date in YYYY-MM-DD format
date_to: End date in YYYY-MM-DD format
relative_date: Alternative to date_from/date_to. Options:
today, yesterday, last_week, last_month, last_year, last_X_days
last_X_days must be in range 1 <= X <= 365
For periods beyond the last year use date_from and date_to
filters: Optional dimension filter group with structure:
{"operator": "and"|"or", "conditions": [...]}
Each condition:
{"column_id": "...", "condition": {"operator": "<op>", "value": ...}}
Filter operators:
- String: eq, neq, contains, not_contains, starts_with, ends_with, matches, not_matches
- Numeric: gt, gte, lt, lte
- Null checks: empty, not_empty
Note: Some operators only work with specific data types.
Check dimension/metric details for type compatibility before filtering.
metric_filters: as arg 'filters' but for metrics
offset: Rows to skip (default: 0)
limit: Max rows to return (default: 100, max: 100000)
order_by: List of [column_index, "asc"|"desc"] pairs
---
Reference:
- Dimension IDs: analytics_dimensions_list
- Metric IDs: analytics_metrics_list
- Dimension details (transformations, types): analytics_dimensions_details_list
- Metric details (types): analytics_metrics_details_list