URL tracking tags
Read and update a Google campaign's tracking template and final URL suffix through GET and PATCH /v1/ads/{adId}/tracking-tags.
By the end of this page, a Google campaign's click URLs carry your tracking template and final URL suffix.
Read the parameters
A campaign carries two click-URL parameters:
trackingUrlTemplateis the redirect or tracking template, and must contain{lpurl}.finalUrlSuffixis the parse-onlykey=valueparams appended to the landing page. It is the part that survives parallel tracking.
Both live at the campaign level. You operate on them through the ad endpoints, by passing any ad in the campaign.
These are click-URL parameters, not the site tag. The Google tag (AW-<id>) you install on a website, with its conversion labels, is on Google tag.
Call GET /v1/ads/{adId}/tracking-tags with the Zernio _id of an ad in the campaign.
import Zernio from '@zernio/node';
const zernio = new Zernio();
const { data: tags } = await zernio.trackingtags.getAdTrackingTags({
path: { adId: '66f0a1b2c3d4e5f6a7b8c9d0' }
});
console.log(tags.trackingUrlTemplate);Response (200):
{
"platform": "google",
"level": "campaign",
"trackingUrlTemplate": "{lpurl}?utm_source=google",
"finalUrlSuffix": "utm_medium=cpc"
}Update either field
Call PATCH /v1/ads/{adId}/tracking-tags with only the fields you want to change. Omit a field to leave it untouched, or pass an empty string to clear it.
const { data: updated } = await zernio.trackingtags.updateAdTrackingTags({
path: { adId: '66f0a1b2c3d4e5f6a7b8c9d0' },
body: {
trackingUrlTemplate: '{lpurl}?utm_source=google&utm_campaign={campaignid}',
finalUrlSuffix: 'utm_medium=cpc'
}
});
console.log(updated.trackingUrlTemplate);Response (200):
{
"platform": "google",
"level": "campaign",
"trackingUrlTemplate": "{lpurl}?utm_source=google&utm_campaign={campaignid}",
"finalUrlSuffix": "utm_medium=cpc"
}Both calls go straight to Google, against the developer-token quota Zernio shares across all customers.
They do not pass the per-user burst limit that gates GAQL and Keyword Planner (quotas).
A one-off audit is fine. Before auditing tags across a large number of campaigns, contact support so the capacity is provisioned.
If it fails
| Error | Cause | Fix |
|---|---|---|
platform_api_error with MISSING_TRACKING_URL_TEMPLATE_TAG | The template has no {lpurl}, which Google requires | Put {lpurl} back and send the PATCH again |
platform_api_error with MALFORMED_TRACKING_URL_TEMPLATE | The template is not a URL | Send a valid URL template |
platform_api_error with INVALID_TAG_IN_TRACKING_URL_TEMPLATE | The template uses a macro Google does not know | Use Google's own macros |
404 | adId is not an ad on one of your connected accounts | Pass the Zernio _id of an ad in the campaign |
A template without {lpurl} comes back as a forwarded platform error carrying Google's own code and message. The campaign keeps the template it had:
{
"error": "Google Ads API error (400): The tracking url template must contain at least one tag (for example, {lpurl}).",
"type": "platform_error",
"code": "platform_api_error",
"platform": "google",
"platformError": {
"code": 3,
"message": "Request contains an invalid argument.",
"details": [
{
"errors": [
{
"errorCode": { "urlFieldError": "MISSING_TRACKING_URL_TEMPLATE_TAG" },
"message": "The tracking url template must contain at least one tag (for example, {lpurl})."
}
]
}
]
}
}Read the code from platformError.details[0].errors[0].errorCode.
Related
- Conversions: server-side conversion events for the same campaigns.
- Google tag: the site tag and its conversion labels, which is a different thing.
- LinkedIn tracking tags and Meta Ads tracking tags: the same endpoint on the other networks.
- Get ad tracking tags and Set ad tracking tags: every field.
Google Tag
Read or switch on a Google Ads account's Google tag, manage its website conversion actions and auto-tagging, check conversion counts, and install it on Shopify or WordPress.
Manage ads
Pause and resume Google campaigns, ad groups and ads, change a campaign's budget and bidding, rename ad groups, and delete any level.