ranking-changes
Ranking Changes
Report the winners and losers between two periods on one property and explain the biggest moves. Unlike the weekly-report skill, which is a fixed digest over the last settled week, this skill lets the user choose both windows, including year over year. The user's request may contain a property, the two periods in any phrasing ("September vs August", "last 14 days vs the 14 before", "Q3 2026 vs Q3 2025"), a dimension to lead with (queries or pages), a search type, and a focus hint such as a country or a section; honor each.
Workflow
-
Resolve the property. If the user's request or the conversation names a property, use it. Site URLs use GSC formats:
sc-domain:example.comorhttps://www.example.com/. Otherwise calllist_sitesand pick the obvious match. If several plausible properties exist, ask the user which one before continuing. -
Fix the two windows. The default is the last 28 settled days compared with the previous 28, which is what the tools use when all four date fields are omitted. Otherwise:
- Translate the user's phrasing into
startDate/endDate(the current window) andcomparisonStartDate/comparisonEndDate(the baseline) as YYYY-MM-DD, and keep both windows the same length. - Keep the newest 2 days out of the current window: GSC data lags about 2 to 3 days, so never treat the most recent 2 days as complete, and if a dip appears at the very edge of the range, say it is likely reporting lag, not a real drop.
- For year over year, use the same calendar dates one year earlier; on a site with a weekly rhythm shift by 364 days rather than 365 so the weekdays line up.
- State both windows on the first line of the output. If
get_position_distributionanswers the baseline window withemptyBecause, orget_ranking_changesfiles nearly every key asnewwith an emptylostbucket (its ownemptyBecauseappears only when both periods are empty), the stored history does not reach that far; say so instead of guessing.
- Translate the user's phrasing into
-
Query movers. Call
get_ranking_changeswithdimension: "query", the four dates from step 2, andlimit: 50(per bucket, 1 to 10000; raise it to 200 on a large property). PasssearchTypeonly when the user asked for image, video or news; the default is web.- Read
countsfor the full size of each bucket, then the bucketsnew,lost,improvedanddeclined. - Each row carries
key,clicks,impressions,ctr,position,prevClicks,prevImpressions,prevPositionandpositionDelta(prevPosition minus position: positive is an improvement, negative a decline; a new or lost key's missing side reads 0). improvedanddeclinedarrive sorted by the size of the position move,newbyclicksandlostbyprevClicks; re-rank improved and declined by click impact (clicksfor improved,prevClicksfor declined) before choosing the rows to show.- Note
dataSource: on the live API a key just below the scan cut can show as new or lost, so treat small new and lost rows there with care.
- Read