Get Google Search Performance
get_search_consoleUse this when the user asks how their site is doing IN GOOGLE SEARCH — keywords/queries they rank for, impressions, clicks from search, CTR, or average position. Backed by their own Google Search Console property (connected per site in Kleap's options), so it is the real Google data, not an estimate. Returns totals plus the top queries and top pages that produced them. Search Console lags real traffic by ~2 days — the newest days are always incomplete, say so rather than reporting a drop. If connected is false or site_selected is false, the site simply has no Search Console hooked up: call connect_search_console(app_id) — it returns a consent_url to hand the user, and that is the whole setup. Do NOT send them hunting through Kleap's settings for it. For visitors and pageviews on the site itself (all sources, not just Google), use get_analytics instead. Requires the analytics:read scope — on a 403 INSUFFICIENT_SCOPE error, tell the user to disconnect and reconnect the Kleap integration (re-authorize).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | The app id to fetch search data for | |
| period | No | Time window: '28d' (default, the window Search Console itself shows), '7d', '30d' or '90d' | |
| context | Yes | Why this call, in one short sentence. Used to improve the connector; never include credentials or personal data. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ctr | No | ||
| note | No | ||
| app_id | No | ||
| clicks | No | ||
| period | No | ||
| message | No | ||
| has_data | No | ||
| position | No | ||
| site_url | No | ||
| connected | No | ||
| top_pages | No | ||
| impressions | No | ||
| top_queries | No | ||
| site_selected | No |