Get keyword trends
get_keyword_trendsGoogle Search Console trend view for the website's tracked keywords, refreshed at the Search Console sync cadence: compares the last window_days (7, 28 or 90, default 28) with the window_days before it. Per keyword: clicks, impressions and impression-weighted average position in both windows plus the deltas (current minus previous), and the page currently ranking for it. by_page groups the clicks and impressions of every keyword with data by that page, most decayed first (clicks_delta ascending), so it answers which pages are losing traffic. Pass keyword_ids (max 200) or let it consider every keyword with history; rows are sorted by clicks_lost (default), clicks_gained, position_lost or position_gained and cut to top (default 50, max 200). by_page is computed before the cut. Rows use each keyword's snapshot country, or the country you pass (lowercase alpha-3 like usa, or wwd). Keywords without history in either window are omitted; a position is null when its window has no impressions. Search Console data lags 2 to 3 days, so the newest days of the current window are usually missing. Not for the current position or ctr (use get_keyword_rankings) nor volume and difficulty (use list_keywords). Tells you when Google Search Console is not connected instead of returning empty rows silently. Pass website_id when the account has several websites (see get_account).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | How many rows to return after sorting. | |
| sort | No | clicks_lost: biggest click drop first; position_lost: biggest position increase (worse) first. | clicks_lost |
| country | No | Country of the Search Console rows to use, lowercase alpha-3 (usa, fra, ...) or wwd; defaults to each keyword's snapshot country. | |
| website_id | No | Website id from get_account. Optional when the account has a single website. | |
| keyword_ids | No | Specific keywords to compare; omit to consider every keyword with Search Console history. | |
| window_days | No | Length in days of each compared window: 7, 28 or 90. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | Yes | ||
| locale | Yes | ||
| trends | Yes | ||
| by_page | Yes | Per ranking page, most decayed first. | |
| gsc_status | Yes | ||
| website_id | Yes | Website the result belongs to. | |
| gsc_fix_url | No | Where to connect Search Console; only present when it is not connected. | |
| window_days | Yes | ||
| gsc_connected | Yes | Whether Google Search Console is connected for the website. | |
| current_window | Yes | ||
| previous_window | Yes | ||
| gsc_last_synced_at | Yes | ||
| keywords_with_data | Yes |