What this is
The Zeotap Web JavaScript SDK (zeotap.js) is a client-side library you embed in your website’s <head> tag to send first-party data — page views, events, user identities, user properties, and consent — into your Zeotap CDP account. In the CDP, the Web JS source is the object that receives every payload the browser posts against its write key, then makes the data available for segmentation, insights, and activation to your downstream platforms. This page covers the source side end-to-end: what the Web JS source is, how to create one, how to wire the snippet into your site, how to handle consent, and how to confirm data is landing.
Looking for the developer reference? The Zeotap Web JavaScript SDK developer documentation covers installation, configuration options, the full API reference, consent management, and release notes. This page focuses on creating and operating the Web JS source inside the Zeotap CDP.
Prerequisites
Before you configure the Web JS source, confirm that:
- You have access to the Zeotap CDP instance for your workspace.
- A Consent Management Platform (CMP) is integrated on the site the SDK will run on, if your consent strategy is anything other than the default opt-in.
- You can edit the HTML of the pages you want to track, or push a change through your tag manager.
Create the Web JS source
The source holds the write key, region, and incoming-data preview for a given site (or set of sites). Every SDK payload posts against that source’s write key.- In the Zeotap CDP app, go to the Sources application under Integrate.
- Start a new source and pick Website Events as the category, then Web JavaScript as the data source.
- Give the source a short descriptive name, add the website URL (recommended so you can track which sites are onboarded), and select the region of upload.
- Save the source. The new entry appears on the Sources listing page — open it to see the snippet code and write key on the Implementation Details tab.
Add the SDK snippet to your site
Copy the snippet from the Implementation Details tab and paste it into the<head> tag of the pages you want to track. The snippet initialises the SDK with your write key and the default options.
YOUR_WRITE_KEY with the write key from the Implementation Details tab. The snippet exposes window.zeotap, which your page code uses to call setPageProperties, setEventProperties, setUserProperties, setUserIdentities, and setConsent.
- Standard website
- Single-page application (SPA)
Paste the snippet into the
<head> tag of every page you want to track.Configure consent
The SDK honours user consent through options passed toinit:
useConsent: true— the SDK waits for a consent signal before capturing events, identifying the user, or running cookie sync.checkForCMP: true— the SDK queries the__cmpAPI on the page for the publisher’s consent. Use this when your site runs a TCF-compliant CMP.checkForCMP: false— the SDK uses the consent you provide viasetConsent. Use this for a custom consent flow where you supply granular signals per SDK purpose.
Verify data is landing
Once the snippet is live and users hit instrumented pages, open the source you created and go to the Preview tab. Incoming payloads appear there as the SDK posts them. When you see records with the event names and properties you called on the client —pageView, your custom event names, page URL and path, identity fields — the source is receiving data.
If the Preview tab stays empty after the snippet is live, work through the troubleshooting checks below.
Troubleshooting
The snippet is on the page but no events reach Preview
Confirm the write key in your snippet matches the one on the source’s Implementation Details tab. A mismatched or stale write key posts against a different source, so the current source’s Preview stays empty.Events fire in the browser but nothing lands in the source
WhenuseConsent: true is set and the SDK has not received a consent signal, it stays idle and does not post. Either supply the consent signal through your CMP (with checkForCMP: true) or call setConsent explicitly (with checkForCMP: false). Until one of those happens, the SDK captures nothing.
Identities are set on the client but do not stitch to profiles
The keys you pass tosetUserIdentities — for example email, cellno, crmID — must match the source field names configured for your write key. Unrecognised keys are dropped silently. Compare the keys in your setUserIdentities call against the source field configuration for this source.
When to contact support
Contact your Zeotap customer success representative if:- The Preview tab remains empty after you have confirmed the write key, verified consent is granted, and checked that events fire in the browser console.
- You see records in Preview but they do not appear in downstream segments or activations.
- The SDK throws an initialisation error the browser console does not resolve after you re-copy the snippet from Implementation Details.
- The source ID and a live URL where the SDK is loaded
- The write key (or a partial identifier) so support can match it against the source
- A browser HAR export or console log showing the SDK call and the outbound network request
- The
initoptions passed on the page (redact any secrets)
FAQ
Do I install the SDK on every page, or just the entry page?
Do I install the SDK on every page, or just the entry page?
For a standard multi-page website, add the snippet to the
<head> tag of every page you want to track. For a single-page application, add it once in the root index.html; it persists across client-side route changes.Does the SDK hash user identities for me, or do I hash them before calling setUserIdentities?
Does the SDK hash user identities for me, or do I hash them before calling setUserIdentities?
Both are supported. With
areIdentitiesHashed: false and hashIdentities: true, the SDK hashes raw PII (email, cell number) to SHA-256 before posting. With areIdentitiesHashed: true, the SDK treats the values as already hashed and forwards them as-is (SHA-256 hashes must be 64-character hex). Custom identities such as crmID are always forwarded as-is regardless of the hashing options.Can one source serve multiple websites?
Can one source serve multiple websites?
Yes — a single Web JS source and write key can serve multiple sites. To distinguish traffic by site in reporting or segmentation, add page properties (for example, the site name) via
setPageProperties on each site.How do I stop the SDK from attaching a user's identities after logout?
How do I stop the SDK from attaching a user's identities after logout?
Call
zeotap.unsetUserIdentities() on logout to remove all stored identities from the browser, or pass an array of specific keys — for example zeotap.unsetUserIdentities(['email', 'cellno']) — to remove only those.