Skip to Content
StreamsGoogle Tag Manager

Google Tag Manager Template

The Google Tag Manager (GTM) custom tag template deploys the Zeotap Browser SDK through GTM instead of a hand-placed <script> snippet. Marketers import the template once, add tags in the GTM UI, and wire them to triggers — no page-side JavaScript required.

It’s one of three ways to run the browser SDK: the snippet (embed directly in your page), Adobe Launch, or Google Tag Manager (this page). All three send the same Segment-compatible events to the same ingest API.

Install

The template is distributed as a .tpl file imported directly into your container — no gallery listing or marketplace approval is required (a Community Template Gallery listing is planned).

  1. Download the template: zeotap-cdp-template.tpl 
  2. In GTM, open your container → Templates → Tag Templates → New.
  3. Open the editor’s ⋮ menu → Import, choose the downloaded zeotap-cdp-template.tpl, and Save.
  4. The template appears in your tag catalog as Zeotap Composable CDP.

One template, every SDK call

When you add a tag, the Tag Type selector chooses what the tag does. A container typically has one Initialize SDK tag plus one tag per interaction:

Tag TypePurposeInputs
Initialize SDKLoads the SDK and initializes it with your write key. Fire once per page.Write key, consent mechanism, options
Track EventRecords a named event.Event name, properties
Page ViewRecords a page view.Category, name, properties
Screen ViewRecords a screen view.Category, name, properties
IdentifyAssociates a user ID and traits.User ID, traits
GroupAssociates the user with a group/account.Group ID, traits
AliasLinks two user identifiers.New ID, previous ID
Set User IdentitiesSets PII identities — raw email/phone/login ID are hashed in the browser before any network call.Identity key/value pairs, pre-hashed toggle
Unset User IdentitiesRemoves stored identities.Keys (empty = all)
Set ConsentSets the user’s consent state.Category booleans, TCF string, or US Privacy string
ResetClears identity and queued state (fire on logout).—

Every tag type works before and after the SDK bundle finishes loading — calls made early are queued and replayed in order once the SDK is ready, exactly like the snippet. Tag firing order is preserved.

Worked example

  • Tag: Initialize — Tag Type Initialize SDK, Write Key from Events → Event Sources, trigger Initialization — All Pages.
  • Tag: Track add-to-cart — Tag Type Track Event, name Product Added, properties mapped from GTM variables ({{Product ID}}, {{Product Price}}), trigger: your add-to-cart event.
  • Tag: Identify on login — Tag Type Identify (user ID + traits) and a second tag Set User Identities (email/phone), trigger: your login event.

Configure (Initialize SDK)

FieldTypeDefaultDescription
Write Keystring (required)—Your workspace source write key, from Events → Event Sources. Supports {{variable}} tokens.
Consent MechanismNone | TCF v2 CMP | CustomNoneHow consent gates event collection (see Consent).
Auto page viewbooleanonRecord a page view automatically when the SDK loads.
Debug loggingbooleanoffVerbose SDK console logging (visible in GTM preview/debug mode).
Flush after N events / Flush intervalnumber10 / 5000 msEvent batching controls.
Track sessionsbooleanonGroup activity into sessions (visits) and carry the session id plus its rollup on every event. Zeotap emits a session_end event when a visit goes quiet — see Sessions.
Session timeout (minutes)number30Inactivity before the next event starts a new session. Clamped to between 5 seconds and 30 minutes.
First-party cookie modeboolean + proxy pathoffServer-set HttpOnly identifier via a proxy on your own domain — see First-Party Domain Setup.
Additional SDK optionskey/value table—Advanced escape hatch: any SDK load option by name (values keep their JSON types), so new SDK options never require a template update.

Infrastructure endpoints are not exposed; the template targets production automatically.

  • None — events flow immediately; a Set Consent tag merely attaches the consent state to subsequent events.
  • TCF v2 CMP — opt-in gating with automatic CMP integration: events are held until your CMP answers via window.__tcfapi, and are dropped fail-closed if GDPR applies and the CMP never loads. Pair the Initialize SDK tag with GTM’s Consent Initialization trigger when your CMP loads through GTM.
  • Custom — opt-in gating without a CMP: events are held until a Set Consent tag fires (wire it to your own banner’s accept/reject).

Consent decisions persist across pages, so returning visitors are not re-gated.

Raw PII passed to Set User Identities is hashed client-side (SHA-256 + SHA-1) before any network call — raw values never leave the browser. On plain-HTTP pages, where the browser’s crypto APIs are unavailable, raw identifiers are dropped rather than sent unhashed; pre-hashed values are unaffected.

For internal and staging testing, Zeotap-owned pages can point the template at a non-production ingest by pushing zeotapApiHost (and, for bundles hosted under content.zeotap.com, zeotapSdkUrl) to the dataLayer before the container loads. These keys are read by the template but are never part of customer configuration — customer sites always use production.

Verifying your setup

Use GTM’s Preview mode: each tag shows as fired, and the SDK logs to the console when Debug logging is on. Events appear in your workspace under Events → Live Stream within seconds. Every event sent through the template carries context.library.integration = {"name": "gtm-template", …}, so you can confirm traffic is coming from GTM rather than a stray snippet.

Next Steps

Last updated on