SCALIX help

← All tools

gads_list_ad_groups

Google Ads read low risk

Part of the Google Ads Manager Agent.

What it does

List ad groups in an account or a specific campaign via GoogleAdsService.SearchStream over the ad_group resource, with optional filters (status, type, campaign) and optional performance metrics prior_period deltas via include_prior_period=true. Returns rows of ad_group.id, name, status, type, campaign, bids and (when requested) impressions/clicks/ctr/cost_micros/conversions. Accuracy: monetary fields are micros (/1e6, currency-labeled); including segments.date or segments.device multiplies rows per segment so per-ad-group totals must be summed; metrics must reconcile to the Google Ads UI within +/-1%; results reflect only ad groups the user's account role can see.

When to use it

When the user asks what ad groups exist in a campaign or the account, their status, or their performance side by side.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID, dashes stripped.
campaign_idstringnoRestrict to one campaign (adds WHERE ad_group.campaign = ...).
status_filterstringnoAdGroupStatus filter ENABLED|PAUSED|REMOVED (enum-normalized). Omit or pass ALL for all statuses.
type_filterstringnoAdGroupType filter, enum-normalized.
include_metricsbooleannoAdd metrics.* over date_range and compute prior-period delta.
date_rangestringnoGAQL date macro or explicit range; used only with include_metrics. Omitted with include_metrics=true = metrics over ALL TIME (a warning is returned).
limitintegernoGAQL LIMIT to cap returned rows; recommend ORDER BY metrics.cost_micros DESC when narrowing.
include_prior_periodbooleannoOpt-in: also run the equal-length preceding window and attach prior_period={date_range, metrics, delta_pct} to every row. Needs a translatable date_range (LAST_7/14/30_DAYS, TODAY, YESTERDAY, THIS_MONTH, LAST_MONTH, or explicit 'YYYY-MM-DD,YYYY-MM-DD'); untranslatable ranges skip with a warning.
manager_idstringnoOptional MCC login-customer-id.

Safeguards

Policy

Read-only; all listed metrics must reconcile to the Google Ads UI within +/-1%. Present only ad groups the queried account legitimately owns — never pool or cross-reference across accounts.

Reminder

Strict per-account isolation (server-derived tenant context + RLS); do not retain or expose ad group lists beyond this request.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDCustomer ID not found / unauthorized.Verify CID and authorization; re-auth if revoked.no
TOKEN_REVOKEDOAuth credential revoked/expired.Prompt reconnect (needs_reauth).no
INVALID_ARGUMENTGAQL filter rejected — surfacing Google's message.Surface exact error; fix filter, don't guess.no
PERMISSION_DENIEDScope/role does not permit reading this account.Confirm adwords scope and access; CID may be outside the bearer scope.no
RESOURCE_EXHAUSTEDRate/quota exceeded (429).Backoff 5->10->20s cap 60s; honor retryDelay.yes
PLATFORM_UNAVAILABLEGoogle Ads API 5xx.Retry after backoff.yes

Edge cases

  • Campaign or account with no ad groups -> success:true, count:0, data:[].
  • Large accounts: response may be very large — apply LIMIT + ORDER BY to narrow rather than truncating silently; tell the user it is capped.
  • include_metrics with segments multiplies rows — aggregate for per-ad-group totals.
  • REMOVED ad groups excluded by default; include them only when explicitly requested.
  • Querying ad_group on an MCC returns the manager's own (typically empty) set, not aggregated client data — scope to one client CID.
  • Expired token mid-stream -> refresh once and retry.