gads_get_remarketing_tag
Google Ads read low risk
Part of the Google Ads Audience Agent.
What it does
Fetch the remarketing tag/pixel snippets for a remarketing action (GAQL on remarketing_action.tag_snippets). Returns the global site tag and event snippet(s) the client must install to populate remarketing lists, with their type and page_format. Read-only; no metrics. Use after creating a remarketing action to hand the install code to the user. Returns {success, data:[{remarketing_action:{id, name, tag_snippets:[{type, page_format, global_site_tag, event_snippet}]}}], count, warnings}. An unknown id is not_found, naming the gads_run_gaql_query read that lists the account's remarketing actions.
When to use it
When the user needs the remarketing/site tag snippet or asks whether remarketing tagging is set up on the account.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID; strip dashes. |
remarketing_action_id | string | yes | Numeric remarketing action ID to fetch snippets for. |
manager_id | string | no | Optional MCC login-customer-id. |
Safeguards
Policy
The remarketing tag enables behavioral tracking — the client must have a compliant privacy policy and (in EEA/UK) a consent mechanism before installing it. Do not embed the tag on sensitive-category pages.
Reminder
The tag must be installed only on pages covered by the client's disclosed privacy/consent policy; do not log or expose any visitor data.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
NOT_FOUND | No remarketing action with that ID exists. | List the account's remarketing actions with gads_run_gaql_query (SELECT remarketing_action.id, remarketing_action.name FROM remarketing_action) and confirm the ID. | no |
TOKEN_REVOKED | OAuth token expired/revoked. | Refresh and retry once; else prompt reconnect (needs_reauth). | yes |
CUSTOMER_NOT_FOUND | Customer ID not found/accessible. | Verify the CID is authorized. | no |
PERMISSION_DENIED | No access or out-of-bearer-scope read. | Confirm read access; else refuse. | no |
MANAGER_ACCOUNT_NOT_QUERYABLE | Queried an MCC; remarketing actions live on client accounts. | Query the specific client account CID, not the manager. | no |
RESOURCE_EXHAUSTED | Rate/quota exceeded (HTTP 429). | Backoff 5/10/20s cap 60s, then retry. | yes |
INTERNAL_ERROR | Transient Google server error (5xx). | Retry after backoff. | yes |
Edge cases
- Action exists but has no snippets yet -> return success with empty tag_snippets and a note.
- Action ID not found -> NOT_FOUND (success:false), not an empty success.
- Expired token -> refresh once and retry.
- page_format distinguishes HTML vs AMP snippets (TrackingCodePageFormat); event_snippet present only for event-based actions, while the global site tag applies regardless of page_format.