Run GA4 Report
ga4_run_reportRun historical Google Analytics 4 reports by specifying dimensions, metrics, date ranges, and filters, returning results as markdown or JSON.
Instructions
Run a Google Analytics 4 report over a historical date range, similar to a custom report in the GA4 UI.
Args:
connection (string): Name of a configured Google connection
property_id (string): GA4 property ID (from ga4_list_properties), digits only, no "properties/" prefix
start_date, end_date (string): YYYY-MM-DD, or a GA4 relative keyword such as 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo')
dimensions (string[]): GA4 dimension API names, e.g. ["date", "country", "sessionDefaultChannelGroup"]
metrics (string[]): GA4 metric API names, e.g. ["activeUsers", "sessions", "conversions"]
limit (number): Max rows to return (default 50, max 1000)
offset (number): Rows to skip, for pagination (default 0)
dimension_filter_field, dimension_filter_value (string, optional): Restrict to rows where this dimension exactly equals this value
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Full dimension/metric reference: https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema
Returns: For JSON: { "dimensionHeaders": string[], "metricHeaders": string[], "rows": object[], "rowCount": number }
Use when: "How many sessions did we get last week by channel?" -> dimensions=["sessionDefaultChannelGroup"], metrics=["sessions"], start_date/end_date set accordingly. Don't use when: You need live/last-30-minutes data (use ga4_run_realtime_report instead).
Error Handling:
Returns an error naming the invalid dimension/metric if GA4 rejects the combination (not every dimension and metric can be combined).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No | ||
| metrics | Yes | GA4 metric API names | |
| end_date | Yes | YYYY-MM-DD, or a GA4 relative keyword such as 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo') | |
| connection | Yes | ||
| dimensions | Yes | GA4 dimension API names | |
| start_date | Yes | YYYY-MM-DD, or a GA4 relative keyword such as 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo') | |
| property_id | Yes | GA4 property ID, digits only | |
| response_format | No | markdown | |
| dimension_filter_field | No | Dimension name to filter on | |
| dimension_filter_value | No | Exact value to match, paired with dimension_filter_field |