Zernio
Zernio
PlatformsGoogle Ads

Build

Create AdsPerformance MaxDemand Gen

Target

KeywordsCustomer Match

Measure

Insights & GAQLConversionsGoogle TagURL Tracking Tags

Operate

RecommendationsAccounts & LabelsLimits and errors
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
Google Ads

Google Tag

Read or switch on a Google Ads account's Google tag, manage its website conversion actions, set auto-tagging, check conversion counts and install it on Shopify or WordPress through the tracking tags API.


Every Google Ads account has exactly one Google tag (AW-<id>), and its website conversion actions are the events a site fires through it. Zernio exposes that tag under the platform-neutral tracking tags API on your googleads connection, so you can read its code and conversion labels, switch conversion tracking on, set auto-tagging, create and edit its website conversion actions, see conversion counts and install it on a connected Shopify store or WordPress site. This is the site tag; the campaign's click-URL tracking template is a different thing, on URL tracking tags.

Ids

FieldValue
accountIdThe googleads connection
tagIdThe customer id, 10 digits (123-456-7890 and 1234567890 both work). The tag is per customer, so the tag id is the customer id.
siteTagIdAW-<conversion tracking id>: what gtag.js loads. Under cross-account conversion tracking it is the manager account's id.
events[].idThe conversion action id
events[].siteEventIdThe conversion label from the action's event snippet (send_to: 'AW-.../<label>')

events holds the account's WEBPAGE conversion actions: GA4-imported and upload actions are not fired from a page. On GET .../tracking-tags/{tagId} only enabled ones appear; the /events list also returns removed (archived) ones. siteEvent is set when the action's category maps to a storefront event: PAGE_VIEW to page_view, ADD_TO_CART to add_to_cart, BEGIN_CHECKOUT to initiate_checkout and PURCHASE to purchase.

Read the tag

GET /v1/accounts/{accountId}/tracking-tags lists one tag per customer on the connection without calling Google, so it costs no quota. GET .../tracking-tags/{tagId} reads the tag's settings and conversion actions and adds the gtag.js base code.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data } = await zernio.trackingtags.getTrackingTag({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', tagId: '1234567890' }
});

Response (200):

{
  "platform": "googleads",
  "tag": {
    "id": "1234567890",
    "name": "Google tag (Acme Store)",
    "platform": "googleads",
    "kind": "tag",
    "status": "active",
    "ownerAdAccountId": "1234567890",
    "siteTagId": "AW-16799533812",
    "code": "<!-- Google tag (gtag.js) -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-16799533812\"></script>...",
    "events": [
      {
        "id": "7012345678",
        "name": "Purchase",
        "type": "PURCHASE",
        "status": "ENABLED",
        "siteEventId": "AbC-D_efG123hIjK",
        "siteEvent": "purchase"
      }
    ]
  }
}

status is inactive while the account does not track conversions. Reads go through Zernio's Google read cache, because every Google call bills the shared developer token's daily quota.

Conversion counts

GET .../tracking-tags/{tagId}/stats returns one row per conversion action with conversionActionId, conversionActionName, category, allConversions and allConversionsValue. The window defaults to the last 30 days; startTime and endTime (Unix seconds) are applied as whole days in the account's time zone, so an edge can shift by a day. aggregation is Meta only and answers 400 here.

Switch the tag on and set auto-tagging

POST /v1/accounts/{accountId}/tracking-tags with adAccountId (the customer id) and name is idempotent on Google. An account that already tracks conversions gets its existing tag back and nothing is created. Otherwise Zernio creates a WEBPAGE conversion action named name (category DEFAULT), which is what turns Google's conversion tracking on, and returns the tag.

PATCH .../tracking-tags/{tagId} takes autoTagging (true or false): gclid auto-tagging, the only tag-level setting the Google Ads API lets Zernio write. Every other tag field answers 400.

Conversion events

The tag's events are its WEBPAGE conversion actions, managed on /tracking-tags/{tagId}/events:

FieldMeaning
nameUnique per customer, so a replayed create fails with a duplicate-name error instead of making a second action
type or siteEventA ConversionActionCategory (PURCHASE, ADD_TO_CART, BEGIN_CHECKOUT, PAGE_VIEW, SIGNUP, DEFAULT, ...), or page_view, add_to_cart, initiate_checkout, purchase (the other site events have no Google category and answer 400)
defaultValue, currency, alwaysUseDefaultValueThe action's value settings
clickWindowDays, viewWindowDaysLookback windows, 1 to 90 and 1 to 30 days
primaryPrimary for goal (counts toward bidding) or secondary
countingTypeone (one per click) or every (every conversion)
enabledfalse removes the action; true restores a removed one
const { data: created } = await zernio.trackingtags.createTrackingTagEvent({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', tagId: '1234567890' },
  body: { name: 'Add to cart', siteEvent: 'add_to_cart', countingType: 'every', primary: false }
});

Response (201), with the conversion label read back from Google:

{
  "platform": "googleads",
  "event": {
    "id": "7012345699",
    "name": "Add to cart",
    "type": "ADD_TO_CART",
    "status": "ENABLED",
    "siteEvent": "add_to_cart",
    "siteEventId": "XyZ-1a_bC2dEfGh3",
    "primary": false,
    "countingType": "every",
    "clickWindowDays": 30,
    "viewWindowDays": 1
  }
}

DELETE .../events/{eventId} removes the action, which on Google is an archive (state: "archived"): Google keeps it as REMOVED with its history, and PATCH with enabled: true restores it. An action is always created enabled. The same actions are also reachable as website tag actions.

What the API cannot do

OperationAnswerEvidence
Share the tag501Cross-account conversion tracking (google_ads_conversion_customer) answers SERVICE_ACCESS_DENIED to every write from Zernio's developer token; set it up from the manager account in the Google Ads UI.
Diagnostics501ConversionAction has no tag status or last-fired field, and there is no test-event service. Use the stats or Google Tag Assistant.
Change the tag id or enhanced conversions for leadsNot offeredBoth are output-only in the Google Ads API.
Disable an event without removing itNot offeredGoogle rejects HIDDEN on WEBPAGE actions, so enabled: false removes (archives).
Delete the tagNot offeredThe tag is part of the account.

Install on a store

POST .../tracking-tags/{tagId}/install with a storeAccountId installs the tag. What it fires depends on the conversion actions:

  • Shopify: Google counts only events that have their own conversion action, so the store sends a conversion only for page_view, add_to_cart, initiate_checkout and purchase, and only when the account has an enabled WEBPAGE action of the matching category with a label (the primary-for-goal action wins, then the lowest id). Product views, searches and payment info are never sent: Google has no category for search or payment info, and pointing product views at the page-view action would count every product page twice. A tag with no mapped action installs but sends nothing. See the event mapping.
  • WordPress: the gtag.js base code (its config call is the page view) plus the PAGE_VIEW conversion snippet when the account has one. The official fallback is Google's Site Kit by Google plugin.

Install calls read the tag first, so re-install after you add or relabel conversion actions: the store keeps the labels it was installed with.

Related

  • Pixels and tracking tags: the cross-platform model and capability matrix.
  • Conversions: server-side uploads and conversion goals.
  • URL tracking tags: the campaign's tracking template and final URL suffix.
  • Get tracking tag and Install on a store: every field.
Was this page helpful?

Conversions

Import offline and enhanced conversions into Google Ads through the Data Manager API with POST /v1/ads/conversions, and choose which conversions Google bids on with account, campaign and custom conversion goals.

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.

On this page

IdsRead the tagConversion countsSwitch the tag on and set auto-taggingConversion eventsWhat the API cannot doInstall on a storeRelated