Compare GA4 periods
ga4_compare_periodsDiff the last N days vs the prior N days. Day over day, WoW, MoM, etc.
For before and after a change, give both windows: start_date/end_date for after, previous_start_date/previous_end_date for before. They need not touch or be the same length; compare totals, not sums, when they differ.
Both windows are N calendar days in the property's time zone and do not overlap. The current one ends today, and today is still filling in, so a short window (days=1 is today vs yesterday) reads low until the day is over.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"property_id": "<property_id>"
},
"name": "ga4_compare_periods"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | window size (default 28 -> 28 vs prior 28; 7 for WoW; 1 for today vs yesterday) | |
| limit | No | max dimension rows in the diff (default 20) | |
| intent | No | Optional: the user's goal in a few words. No site names or URLs. | |
| metric | No | GA4 metric to compare (default "sessions"; try "activeUsers", "screenPageViews", "conversions", "totalRevenue") | sessions |
| end_date | No | optional YYYY-MM-DD. Alone, the window is `days` days ending on this date | |
| start_date | No | optional YYYY-MM-DD. With it the window is start_date to end_date (or today), and days is ignored | |
| property_id | Yes | GA4 property id | |
| by_dimension | No | dimension to slice the comparison by, or None for totals only. Common: "sessionDefaultChannelGroup", "country", "deviceCategory", "pagePath" | sessionDefaultChannelGroup |
| dimension_filter | No | optional, the same GA4 FilterExpression as in ga4_report, applied to both windows, e.g. one section only: {"filter": {"fieldName": "landingPage", "stringFilter": {"matchType": "BEGINS_WITH", "value": "/guides/"}}} | |
| previous_end_date | No | ||
| previous_start_date | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||