gads_set_campaign_customizer
Google Ads write high risk
Part of the Ad Customizer Agent.
What it does
Bind a campaign-level customizer value: links an existing CustomizerAttribute (TEXT|NUMBER|PRICE|PERCENT) to a campaign with a specific value via CampaignCustomizer. The value flows into RSAs/assets that reference {CUSTOMIZER.<name>}. Supports create (link a value) and remove (unlink). Returns the resulting CampaignCustomizer resource_name and the attribute/value/status. Preview->approve->commit: validate_only=true diff (campaign, attribute name+type, value being set), explicit approval, then commit (with preview_id) sends validate_only=false server-side + partial_failure=true + audit log. Accuracy: the value must match the attribute's type (PRICE/NUMBER/PERCENT numeric, TEXT string within ad char limits since it can render in headlines/descriptions); a missing CustomizerAttribute must be created first via CustomizerAttributeService (separate). Customizer text that renders in ads must meet editorial policy. 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/replace a campaign-level customizer value used in ads (e.g. 'set the {Discount} customizer to 20% for this campaign'). Confirm the attribute exists, the value matches its type, and (for TEXT) that it fits ad char limits and editorial rules, then preview before committing.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID, dashes/spaces stripped. Tenant context server-derived. |
campaign_id | string | yes | Numeric campaign ID to attach/detach the customizer value on. |
customizer_attribute | string | yes | Existing CustomizerAttribute resource_name (customers/{cid}/customizerAttributes/{id}) or its unique name to resolve. Must already exist; create via CustomizerAttributeService first if not. |
value | string | yes | The value to bind, as a string matching the attribute type: TEXT (any string, watch RSA char limits), NUMBER/PERCENT/PRICE (numeric; PRICE is an amount with its ISO currency code and no space, e.g. '19.99USD' or 'USD19.99': spaces are removed, and a bare number is refused at preview). Required for create. |
value_type | string | no | CustomizerAttribute value type: TEXT | NUMBER | PRICE | PERCENT; defaults to the attribute's own type (read from the attribute). MUST match the attribute's own type or Google rejects the value. |
operation | string | no | CREATE (link the value) or REMOVE (unlink the CampaignCustomizer). Default CREATE. Enum-normalized. |
validate_only | boolean | no | Optional. 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_id | string | no | Omit 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
Customizer values can render directly inside ad text (headlines/descriptions), so they must meet Google editorial standards (no excessive capitalization, no gimmick punctuation/symbols, correct spelling) and must not assert a claim the landing page can't support (Misrepresentation = immediate suspension). Prices/percentages must be accurate.
Reminder
Customizer values may appear in live ads — keep them truthful and policy-compliant; don't retain account data beyond this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Customer ID not found or not linked. | Verify CID (dashes stripped); re-auth if stale. | no |
TOKEN_REVOKED | Authorization revoked / refresh token expired. | Trigger re-auth (needs_reauth); do not retry with the dead token. | no |
CUSTOMIZER_ATTRIBUTE_NOT_FOUND | The referenced CustomizerAttribute doesn't exist. | Create it via CustomizerAttributeService first; do not auto-create a guessed attribute. | no |
CUSTOMIZER_VALUE_TYPE_MISMATCH | Value doesn't match the attribute type (e.g. text for a NUMBER attribute). | Surface the platform message; coerce the value to the attribute's type or fix the attribute. | no |
DUPLICATE_CUSTOMIZER | A CampaignCustomizer for this attribute already exists on the campaign. | Remove/replace the existing binding instead of creating a duplicate. | no |
INVALID_ARGUMENT | Operation rejected (e.g. value violates editorial/char limits). | Surface the platform message; fix the value. Don't guess. | no |
PERMISSION_DENIED | Missing scope or read-only role. | Report missing scope / role; do not retry. | no |
MANAGER_ACCOUNT_WRITE | Target CID is a manager (MCC) account. | Ask which child serving account to target. | no |
RESOURCE_EXHAUSTED | Rate/quota limit (HTTP 429). | Backoff 5->10->20s cap 60s, honor retryDelay; retry. | yes |
PARTIAL_FAILURE | A bulk customizer op partially failed. | Report per-op; retry only failures. | no |
PLATFORM_UNAVAILABLE | Google Ads 5xx / INTERNAL / DEADLINE_EXCEEDED. | Idempotent retry with backoff. | yes |
Edge cases
- CREATE with value omitted -> success:false 'value required for create'.
- Attribute name resolves to multiple/zero attributes -> require the exact resource_name (don't guess).
- TEXT value too long to fit any RSA field -> warn it may never render; surface char count.
- REMOVE of a value already removed -> idempotent success (changed:false, already_removed; no preview to approve); REMOVE where the campaign never had a value for the attribute -> not_found.
- PRICE/PERCENT value with wrong format (currency/symbol) -> CUSTOMIZER_VALUE_TYPE_MISMATCH; normalize.
- Customizer value that overstates an offer the landing page lacks -> editorial/Misrepresentation block in preview.
- Expired token -> refresh once, retry.
- Preview expired before approval -> re-run validate_only before commit.