Skip to main content

Best practices

If your site has a TCF 2.0 CMP, use the TCF strategy — don’t fall back to default opt-in. The TCF flow captures the gdpr_consent string for downstream compliance.
window.zeotap.init("YOUR_WRITE_KEY", {
  useConsent: true,
  checkForCMP: true
});
Do not initialize the SDK only after the user interacts with your CMP banner. The SDK queries the TCF API on its own and waits for the signal — initializing it early ensures no events are missed. If you’re rolling your own consent flow:
window.zeotap.init("YOUR_WRITE_KEY", {
  useConsent: true,
  checkForCMP: false
});

// when the user accepts
window.zeotap.setConsent({ track: true, cookieSync: true });

Capture identities with the right method

Use setUserIdentities (not setUserProperties) for email, cellno, loginid, fpuid, and any custom identifier. Identities set via setUserIdentities persist across subsequent event payloads — setUserProperties values do not. Case 1 — raw identities, sent as-is
// init
window.zeotap.init("YOUR_WRITE_KEY", {
  areIdentitiesHashed: false,
  hashIdentities: false
});

// later
window.zeotap.setUserIdentities({
  email: 'xyz@gmail.com',
  crmID: '12345'
});
Case 2 — raw identities, hashed by the SDK before sending
window.zeotap.init("YOUR_WRITE_KEY", {
  areIdentitiesHashed: false,
  hashIdentities: true
});

window.zeotap.setUserIdentities({
  email: 'xyz@gmail.com',   // will be hashed
  crmID: '12345'            // custom identity, sent as-is
});
Case 3 — identities already hashed client-side
window.zeotap.init("YOUR_WRITE_KEY", {
  areIdentitiesHashed: true
});

window.zeotap.setUserIdentities({
  email_sha256_lowercase: '32e19a491662fd86de7d3806b1199b76f0ee44e928d3475f05b0c8a59912c097',
  crmID: '12345'
});

Capture Google Analytics IDs

Forward GA Client ID and User ID for retargeting on Google Optimize 360 and other GA-connected platforms:
window.zeotap.init("YOUR_WRITE_KEY", {
  allowGAClientId: true,
  gaClientIdCookiePrefix: 'client',   // reads 'client_ga'
  gaUserIdCookieName: 'user_ga'
});

Contextual data Zeotap captures automatically

You don’t need to send these explicitly — the SDK appends them to every event:
  • IP-derived — IP country, WiFi/cellular, operator/carrier
  • User-Agent-derived — device OS, device model, manufacturer, device type, browser type
  • Page-URL-derived — URL, domain, path

AMP pages support

The SDK runs inside <amp-script> for Accelerated Mobile Pages. Pattern:
1

Create a script that initializes the SDK

Save as zeotapSDKSetup.js on your CDN:
!function(e, t) {
  var n = t.createElement("script");
  n.type = "text/javascript";
  n.crossorigin = "anonymous";
  n.async = !0;
  n.src = "https://content.zeotap.com/sdk/zeotap.min.js";
  n.onload = function() {};
  var s = t.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(n, s);
  function o(e, t, n) {
    function s(t) {
      e[t] = function() {
        e[n].push([t].concat(Array.prototype.slice.call(arguments, 0)));
      }
    }
    for (var o = 0; o < t.length; o++) s(t[o]);
  }
  var r = e.zeotap || { _q: [], _qcmp: [] };
  o(r, ["init", "setEventProperties", "setUserProperties", "setPageProperties", "setMetaProperties", "setUserIdentities", "unsetUserIdentities", "setZI"], "_q");
  o(r, ["setConsent", "addAskForConsentActionListener"], "_qcmp");
  e.zeotap = r;
}(window, document);

window.zeotap.init("YOUR_WRITE_KEY");

function setZeotapEventProperties(eventName, eventProperties) {
  zeotap.setEventProperties(eventName, eventProperties);
}

function setZeotapUserIdentities(userDetails) {
  zeotap.setUserIdentities(userDetails);
}

function setZeotapPageProperties(pageDetails) {
  zeotap.setPageProperties(pageDetails);
}

function setZeotapUserProperties(userProperties) {
  zeotap.setUserProperties(userProperties);
}
2

Add amp-script in your AMP page header

<script async custom-element="amp-script"
  src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
3

Reference your setup script

<script id="zeotap-js" src="zeotapSDKSetup.js" target="amp-script"></script>
4

Use it in the page body

<body>
  <amp-script script="zeotap-js">
    <button
      type="button"
      onclick="setZeotapEventProperties('addToCart', { product: 'handbag' })">
      Add to Cart
    </button>
  </amp-script>
</body>

AMP page tracking

Same as regular page tracking — call setPageProperties on page load:
zeotap.setPageProperties({ name: 'Product' });

AMP event tracking

zeotap.setEventProperties('viewProduct', { productID: '1234' });
AMP consent tracking uses the same setConsent method. See Consent Resolution for details.

Common payloads

Login event with identity stitch
zeotap.setUserIdentities({ email: 'user@example.com', fpuid: 'crm_42' });
zeotap.setEventProperties('login', { method: 'password' });
Add to cart
zeotap.setEventProperties('addToCart', {
  productID: 'sku_123',
  quantity: 1,
  price: 29.99
});
Purchase
zeotap.setEventProperties('purchase', {
  orderID: 'order_456',
  total: 89.97,
  currency: 'EUR',
  items: [
    { productID: 'sku_123', quantity: 1, price: 29.99 },
    { productID: 'sku_456', quantity: 2, price: 29.99 }
  ]
});
Logout
zeotap.unsetUserIdentities();
Last modified on June 22, 2026