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).
- Download the template: zeotap-cdp-template.tpl
- In GTM, open your container → Templates → Tag Templates → New.
- Open the editor’s ⋮ menu → Import, choose the downloaded
zeotap-cdp-template.tpl, and Save. - 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 Type | Purpose | Inputs |
|---|---|---|
| Initialize SDK | Loads the SDK and initializes it with your write key. Fire once per page. | Write key, consent mechanism, options |
| Track Event | Records a named event. | Event name, properties |
| Page View | Records a page view. | Category, name, properties |
| Screen View | Records a screen view. | Category, name, properties |
| Identify | Associates a user ID and traits. | User ID, traits |
| Group | Associates the user with a group/account. | Group ID, traits |
| Alias | Links two user identifiers. | New ID, previous ID |
| Set User Identities | Sets 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 Identities | Removes stored identities. | Keys (empty = all) |
| Set Consent | Sets the user’s consent state. | Category booleans, TCF string, or US Privacy string |
| Reset | Clears 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)
| Field | Type | Default | Description |
|---|---|---|---|
| Write Key | string (required) | — | Your workspace source write key, from Events → Event Sources. Supports {{variable}} tokens. |
| Consent Mechanism | None | TCF v2 CMP | Custom | None | How consent gates event collection (see Consent). |
| Auto page view | boolean | on | Record a page view automatically when the SDK loads. |
| Debug logging | boolean | off | Verbose SDK console logging (visible in GTM preview/debug mode). |
| Flush after N events / Flush interval | number | 10 / 5000 ms | Event batching controls. |
| Track sessions | boolean | on | Group 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) | number | 30 | Inactivity before the next event starts a new session. Clamped to between 5 seconds and 30 minutes. |
| First-party cookie mode | boolean + proxy path | off | Server-set HttpOnly identifier via a proxy on your own domain — see First-Party Domain Setup. |
| Additional SDK options | key/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.
Consent
- 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
- Browser SDK — full API reference for what each tag type sends
- Write Keys — provisioning event sources
- First-Party Domain Setup — the proxy behind first-party cookie mode
- Event Contracts — enforce event schemas downstream