gads_get_search_terms_report
Google Ads read low risk
Part of the Search Terms Agent.
What it does
Show the actual SEARCH QUERIES that triggered a campaign's or ad group's ads (search_term_view) over a date range, with the match type they matched on (segments.search_term_match_type: BROAD/PHRASE/EXACT/NEAR_EXACT/NEAR_PHRASE) and performance (impressions, clicks, CTR, avg CPC, cost, conversions, conv value). Surfaces irrelevant/wasteful queries to block as negatives. Money micros->currency (/1e6); reconciles to the Google Ads UI within +/-1%. Returns {success, data:[{search_term_view{search_term, status}, segments{search_term_match_type}, ad_group, campaign, metrics}], count, warnings}.
When to use it
Use to review which real queries are spending; then feed the wasteful ones to gads_add_negatives_from_search_terms (with approval).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit Google Ads customer ID (CID), dashes stripped. Server-derived tenant context + RLS. |
campaign_id | string | no | Restrict to one campaign. |
ad_group_id | string | no | Restrict to one ad group. |
date_range | string | yes | GAQL macro (LAST_7_DAYS/LAST_30_DAYS/THIS_MONTH/LAST_MONTH) or explicit YYYY-MM-DD,YYYY-MM-DD. DEFAULT: date_range defaults to LAST_30_DAYS when omitted (a warning says so); pass date_range=ALL_TIME to query without a date filter. |
limit | integer | no | GAQL LIMIT cap; large pulls use SearchStream. |
Safeguards
Policy
Never fabricate or approximate a metric; if a figure can't be reconciled to the Google Ads UI within +/-1%, say so. Money is micros/1e6 (label the account currency); rates are ratios.
Reminder
Search queries may contain user PII — never log or retain the raw query text beyond fulfilling this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Account {customer_id} not found or not linked. | Verify the CID and authorization. | no |
needs_reauth | Authorization expired or revoked. | Reconnect Google Ads in the Scalix dashboard. | no |
INVALID_ARGUMENT | Malformed date_range or filter. | Fix the argument and retry. | no |
MANAGER_ACCOUNT_METRICS_UNSUPPORTED | Manager (MCC) accounts return no metrics. | Query a child account. | no |
PERMISSION_DENIED | The authenticated user lacks access to this account. | Check account access. | no |
RESOURCE_EXHAUSTED | Rate/quota limit hit. | Back off and retry. | yes |
Edge cases
- No data in range -> success count:0 with a note naming the date range and the filters applied.
- Very-low-volume queries may be withheld by Google.
- Manager (MCC) account -> metrics unsupported; query a child.
- count:0 with success:true is EXPECTED on accounts with no recent search traffic, and Google redacts low-volume terms for privacy; not a bug.