SCALIX help

← All tools

gads_set_demographic_targeting

Google Ads write high risk

Part of the Google Ads Audience Agent.

What it does

Set demographic criteria: age ranges, gender, parental status and household income bands. At the campaign level Google accepts them only as EXCLUSIONS (negative=true): a positive campaign-level demographic is refused at preview with criterion_error.FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING (live-verified). Pass ad_group_id to set them on one ad group instead, where positive targeting with bid modifiers is allowed (e.g. +20% for 25-34). Each value becomes one campaign_criterion (an ad_group_criterion with ad_group_id) with AgeRangeInfo / GenderInfo / ParentalStatusInfo / IncomeRangeInfo. Returns created resource_names and a readable summary. Preview->approve->commit: validate_only=true diff (campaign or ad group + each demographic added/excluded + modifiers), explicit approval, commit (with preview_id) sends validate_only=false server-side + audit log. Accuracy/compliance: bid_modifier is a multiplier (not micros) and applies to included values only; on an exclusion it is left out, with a warning. Demographics use fixed enum bands (e.g. AGE_RANGE_18_24 ... AGE_RANGE_65_UP, AGE_RANGE_UNDETERMINED). For employment/housing/credit/education campaigns, demographic targeting is restricted by anti-discrimination policy: confirm the campaign is not one of those before calling; the tool does not detect the vertical. PREVIEW SEMANTICS: the first call (no preview_id) is sent to the Google Ads API in validation mode — field, enum, policy and permission errors surface AT PREVIEW, nothing is changed, and the response returns a preview_id. To apply, show the preview to the user, get their approval, and re-call with that preview_id and IDENTICAL arguments within 30 minutes; changed arguments or an expired token fail closed to a fresh preview. validate_only=true forces another preview; validate_only=false alone never commits.

When to use it

Demographic targeting. Use when the user wants to EXCLUDE audiences from a campaign by age/gender/parental status/income (e.g. 'exclude under 18'), or to favour a band on one ad group (pass ad_group_id, e.g. +20% for 25-34). First confirm the campaign is NOT employment/housing/credit/education; preview the exact bands and modifiers before committing.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID, dashes/spaces stripped. Tenant context server-derived.
campaign_idstringyesNumeric campaign ID.
age_rangesarray<string>noAgeRangeType enums: AGE_RANGE_18_24, _25_34, _35_44, _45_54, _55_64, _65_UP, AGE_RANGE_UNDETERMINED. Enum-normalized uppercase.
gendersarray<string>noGenderType enums: MALE, FEMALE, UNDETERMINED. Enum-normalized.
parental_statusesarray<string>noParentalStatusType: PARENT, NOT_A_PARENT, UNDETERMINED. Enum-normalized.
income_rangesarray<string>noIncomeRangeType: INCOME_RANGE_0_50, _50_60, _60_70, _70_80, _80_90, _90_UP, INCOME_RANGE_UNDETERMINED. Enum-normalized.
negativebooleannoPass true to EXCLUDE the listed demographics — the only form Google accepts at the campaign level. Default false is rejected by Google at preview with a clear error saying so.
bid_modifiernumbernoNot usable here: bid modifiers require positive criteria, and campaign-level demographics are exclusion-only. Kept for compatibility; a value is rejected by Google at preview.
ad_group_idstringnoOptional ad group to set the demographics on instead of the campaign: positive targeting with bid_modifier is allowed there (the campaign level takes only exclusions). Omit for campaign-level exclusions.
validate_onlybooleannoOptional. true forces another preview even with a preview_id; false is DEPRECATED and no longer commits — only a valid preview_id applies the write.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Anti-discrimination: campaigns for employment, housing, credit, or education MUST NOT target or exclude on protected attributes (age, gender, parental status, etc.); recruitment/employment ads must keep age targeting off. Confirm the campaign's vertical before calling: the tool does not detect it.

Reminder

Demographic data is sensitive — do not use it to discriminate or to enrich a profile; don't retain beyond this request.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDCustomer ID not found or not linked.Verify CID (dashes stripped); re-auth if stale.no
TOKEN_REVOKEDAuthorization revoked / refresh token expired.Trigger re-auth (needs_reauth); do not retry with the dead token.no
INVALID_ARGUMENTOperation rejected (e.g. invalid demographic enum, or bid_modifier on a negative).Surface platform message; normalize enum / fix modifier.no
OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPECampaign type doesn't accept this demographic criterion.Explain channel-type limitation; branch before retry.no
PERMISSION_DENIEDMissing scope or read-only role.Report missing scope / role; do not retry.no
MANAGER_ACCOUNT_WRITETarget CID is a manager (MCC) account.Ask which child serving account to target.no
RESOURCE_EXHAUSTEDRate/quota limit (HTTP 429).Backoff 5->10->20s cap 60s, honor retryDelay; retry.yes
PLATFORM_UNAVAILABLEGoogle Ads 5xx / INTERNAL / DEADLINE_EXCEEDED.Idempotent retry with backoff.yes

Edge cases

  • No demographics supplied across all arrays -> success:false 'Provide at least one demographic list.'
  • Positive values at campaign level -> refused at preview (FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING); pass ad_group_id.
  • Excluding every band of a dimension (e.g. all age ranges) -> Google refuses it at preview (CANNOT_EXCLUDE_ALL_TARGETS).
  • AGE_RANGE_UNDETERMINED / UNDETERMINED buckets matter: excluding them drops users Google couldn't classify -> note the reach impact.
  • bid_modifier on a negative -> left out of the request, with a warning.
  • Expired token -> refresh once, retry.
  • Preview expired before approval -> re-run validate_only before commit.