SCALIX help

← All tools

gads_add_language_targeting

Google Ads write low risk

Part of the Geo Targeting Agent.

What it does

Add language targeting criteria to a campaign so ads serve to users whose Google interface / query language matches. Accepts one or more language constant criterion IDs (e.g. 1000 = English, 1003 = Spanish). Returns created campaign_criterion resource_names and a readable summary of targeted languages. Preview->approve->commit: builds operations, runs validate_only=true (CampaignCriterionService.MutateCampaignCriteria) to show a diff (campaign + added language names), waits for explicit approval, then commits with validate_only=false + partial_failure=true and writes an immutable audit entry. Accuracy: language targeting filters by the USER's language setting, NOT by the language of the ad text; the preview resolves IDs to language names so the user approves names, not numbers. 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

Use when the user wants to set which user-interface languages a campaign reaches (e.g. 'target English and Spanish speakers'). Confirm the language list in the preview before committing; targeting the wrong language quietly throttles eligible impressions.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID, dashes/spaces stripped. Tenant context server-derived and must match.
campaign_idstringyesNumeric campaign ID.
language_idsarray<string|int>yeslanguage_constant criterion IDs (e.g. 1000 English, 1003 Spanish, 1001 German). Each becomes campaign_criterion.language.language_constant = 'languageConstants/{id}'. Enum-normalize any language-name input to its constant ID before sending.
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

Language targeting is content-neutral, but it must not be used to mask a restricted/disapproved ad from review or to misrepresent reach; apply only the languages the user approved and never silently widen targeting.

Reminder

Resolve language IDs to names in the preview; don't retain account targeting data past this request.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDCustomer ID not found or not linked.Verify CID (dashes stripped) and account link; 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_LANGUAGE_CONSTANTOne or more language IDs are not valid language constants.Surface the bad ID; map the language name to its correct constant ID. Do not guess.no
INVALID_ARGUMENTOperation rejected by the API.Surface the exact platform message/fieldPath; fix input.no
OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPEThis campaign type does not accept language criteria via this path.Explain the channel-type restriction; branch on advertising_channel_type before retry.no
PERMISSION_DENIEDMissing scope or read-only Ads role.Report missing scope / role; do not retry.no
MANAGER_ACCOUNT_WRITETarget CID is a manager (MCC) account.Ask the user which child serving account to target.no
RESOURCE_EXHAUSTEDRate/quota limit (HTTP 429).Backoff 5->10->20s cap 60s, honor retryDelay; retry.yes
PARTIAL_FAILURESome language ops failed, others succeeded.Report per-op; retry only failures.no
PLATFORM_UNAVAILABLEGoogle Ads 5xx / INTERNAL / DEADLINE_EXCEEDED.Idempotent retry with backoff.yes

Edge cases

  • Empty language_ids -> success:false 'no languages supplied', no API call.
  • Adding 'All languages' (constant 1000003) alongside specific languages is redundant -> flag in preview.
  • Duplicate add of an existing language -> partial_failure 'already targeted', report not fail.
  • No language criterion = Google's default (no language restriction); removing the last language reverts to all-languages -> warn the user.
  • Language targets the user's interface language, not the ad copy language -> note in preview to avoid mismatch.
  • Expired token -> refresh once, retry.
  • Preview expired before approval -> re-run validate_only before commit.