ga4_pivot_report
Generate GA4 pivot reports to compare dimensions across rows and columns and return metrics for a date range, with optional metric and dimension filters.
Instructions
Pivot table report (Data API runPivotReport): rows and columns from different dimensions, e.g. platform across columns and eventName down rows. Each pivot lists its fieldNames and limit. Requires: Google Analytics Data API (analyticsdata.googleapis.com) enabled on the quota project; Lector (Viewer) en la propiedad de GA4. If it fails for access, the error explains how to fix it; ga4_check_access checks everything at once.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pivots | Yes | Pivot objects, e.g. [{"fieldNames":["eventName"],"limit":20},{"fieldNames":["platform"],"limit":5}] | |
| metrics | Yes | Metric API names | |
| end_date | Yes | End date: YYYY-MM-DD, or relative like "today" | |
| property | No | Saved property name (see ga4_list_properties). Defaults to the default property. | |
| dimensions | Yes | Every dimension used in any pivot | |
| start_date | Yes | Start date: YYYY-MM-DD, or relative like "7daysAgo", "yesterday", "today" | |
| metric_filter | No | Data API FilterExpression for metrics, e.g. {"filter":{"fieldName":"totalUsers","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}} | |
| dimension_filter | No | Data API FilterExpression for dimensions, e.g. {"filter":{"fieldName":"eventName","stringFilter":{"matchType":"BEGINS_WITH","value":"Checkout_"}}} |