ga4_compare_periods
Compare two date ranges side by side to get each metric's current and previous values plus relative change for week-over-week or month-over-month reporting.
Instructions
Compare two date ranges side by side: each row gets the metric in the current period, the previous period, and the relative change. Good for week over week or month over month. 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 |
|---|---|---|---|
| limit | No | ||
| metrics | Yes | Metric API names | |
| property | No | Saved property name (see ga4_list_properties). Defaults to the default property. | |
| dimensions | No | Dimension API names to group by | |
| current_end | Yes | Current period end | |
| previous_end | Yes | Previous period end | |
| current_start | Yes | Current period start, YYYY-MM-DD or relative | |
| metric_filter | No | Data API FilterExpression for metrics, e.g. {"filter":{"fieldName":"totalUsers","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}} | |
| previous_start | Yes | Previous period start | |
| dimension_filter | No | Data API FilterExpression for dimensions, e.g. {"filter":{"fieldName":"eventName","stringFilter":{"matchType":"BEGINS_WITH","value":"Checkout_"}}} |