SCALIX help

← All tools

gads_link_merchant_center

Google Ads write high risk

Part of the Shopping Campaign Agent.

What it does

Link a Google Merchant Center account to the Google Ads account (ProductLinkService.CreateProductLink) so Shopping and Performance Max retail campaigns can use its product feed, or remove an existing link (ProductLinkService.RemoveProductLink). Accuracy (Google Ads API guide 'Linked Merchant Center and Google Ads accounts'): linking from Google Ads needs admin access to BOTH accounts, and the link is then active at once; without Merchant Center admin access Google refuses it, and the link request has to be sent from Merchant Center (web interface or Merchant API) and accepted in Google Ads. The commit returns the product link's resource_name. Flow: preview -> approval -> execute -> confirm + immutable audit log. PREVIEW SEMANTICS (this tool differs): the preview sends nothing to Google — CreateProductLink has no validation mode in v24, so Google checks the Merchant Center id and your access to both accounts only at commit, and the preview says so. The preview reads the account's product links: a Merchant Center id already linked, or a REMOVE of a link the account doesn't have, returns changed: false and no preview_id; a REMOVE names the linked Merchant Center id and warns that its campaigns stop. The preview 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. ACTIONS: CREATE (default; alias attach) sends the link, REMOVE (alias detach) removes an existing ProductLink. APPROVE/REJECT are NOT supported — accepting or rejecting an invitation happens in the Merchant Center / Google Ads UI (Settings -> Linked accounts); the tool returns a clean unsupported error naming that path before any preview.

When to use it

Use to connect a Merchant Center feed to the Ads account so Shopping/PMax-retail can run, or to remove a link. Confirm the advertiser owns/controls the MC account and has admin access to it; say that Google checks the id and that access only at commit, and that without it the link request has to come from Merchant Center. First call gads_plan_shopping_campaign for the campaign blueprint, operation ordering, and policy pre-checks.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit Google Ads CID; strip dashes.
merchant_center_idstringyesMerchant Center account ID to link (numeric; required for CREATE, unused by REMOVE). Google checks it, and your admin access to it, only at commit.
actionstringnoCREATE (default; alias attach) or REMOVE (alias detach), case-insensitive. APPROVE/REJECT are UI-only and return a clean unsupported error.
product_link_resource_namestringnoExisting product link (customers/{cid}/productLinks/{id}); required for REMOVE. List them with gads_run_gaql_query (SELECT product_link.resource_name, product_link.merchant_center.merchant_center_id FROM product_link).
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

Only link Merchant Center accounts the advertiser owns or is authorized to use; the product data must comply with Shopping ads policy (accurate pricing/availability, no misrepresentation, no prohibited products). Do not link to launder disapproved products across accounts (Circumventing Systems = egregious).

Reminder

Link only authorized MC accounts; do not expose or retain feed data beyond this request; account-isolated.

Errors

Error classMeansWhat to doRetry
MERCHANT_CENTER_ACCOUNT_NOT_FOUNDMC account id invalid or not visible to the authorized user.Verify the MC id and that the user can administer it.no
LINK_ALREADY_EXISTSAn active link to this MC account already exists.Treat as idempotent; report the existing link status.no
PERMISSION_DENIEDUser lacks admin rights on the Ads or MC account to manage the link (or the action is out of the bearer token's scope).Out-of-scope; require an authorized admin / proper grant.no
TOKEN_REVOKEDToken revoked/expired.Set needs_reauth; prompt reconnect.no
RESOURCE_EXHAUSTEDQuota/QPS exceeded (HTTP 429).Backoff 5/10/20s cap 60s, retry once.yes
PLATFORM_UNAVAILABLEBackend 5xx/INTERNAL.Retry once after backoff.yes

Edge cases

  • Ads-initiated link without admin on the Merchant Center account -> Google refuses it at commit; the link request has to be sent from Merchant Center and accepted in Google Ads -> state that next step clearly.
  • Direct link (admin on both accounts) becomes ACTIVE immediately.
  • Merchant Center id already linked -> success with changed: false and the link's resource_name, and no preview_id (nothing to approve).
  • Removing a link disables Shopping/PMax-retail serving that depends on the feed -> the preview warns and names the linked Merchant Center id.
  • validate_only=true makes no change; preview TTL expiry -> re-preview.