Compare two periods
compare_periodsCompare two periods row by row for queries, pages, countries, devices or search appearances to find top gainers, decliners, new and lost rows, and explain why traffic moved.
Instructions
Compares two periods row by row for one dimension (queries, pages, countries, devices or search appearances) and returns the biggest gainers and decliners plus what is new and what disappeared. Use it to explain why traffic moved.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "compare_periods"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Length of the period in days, used when start_date is not given. Default 28. | |
| limit | No | Maximum number of rows in each list to return. | |
| filters | No | Filters; a row must match all of them. Example: [{"dimension":"page","operator":"contains","expression":"/blog/"},{"dimension":"country","operator":"equals","expression":"usa"}]. Countries are ISO 3166-1 alpha-3 codes, devices are DESKTOP, MOBILE or TABLET, and the regex operators use RE2 syntax. | |
| sort_by | No | Rank gainers and decliners by change in this metric. | clicks |
| end_date | No | Last day of the period, YYYY-MM-DD in Pacific Time, or "today" / "yesterday". Defaults to the latest day Google has complete data for, usually 3 to 4 days ago. A later date includes days that are still incomplete. | |
| site_url | No | Search Console property, for example "sc-domain:example.com" or "https://www.example.com/". A bare domain or any page URL on the site also works. Optional when GSC_SITE_URL is set or the account has exactly one property. | |
| dimension | No | What to compare. | query |
| scan_rows | No | How many rows to read from Search Console before analysing. Google returns rows sorted by clicks, so a larger scan reaches further into low-click, high-impression rows. Each 25,000 rows is one API call. | |
| compare_to | No | What to compare against: the same number of days immediately before (default), the same period 52 weeks earlier, or a custom range (set compare_start_date and compare_end_date). | previous_period |
| start_date | No | First day of the period, YYYY-MM-DD in Pacific Time. Defaults to `days` before end_date. | |
| search_type | No | Which Google surface: web (default), image, video, news (the News tab), discover or googleNews. | web |
| compare_end_date | No | Last day of the comparison period when compare_to is "custom". | |
| compare_start_date | No | First day of the comparison period when compare_to is "custom". |