Pass an options object as the second argument to init() to configure SDK behavior:
window.zeotap.init("YOUR_WRITE_KEY", {
useConsent: true,
checkForCMP: true,
hashIdentities: true,
// ...
});
Core options
| Parameter | Type | Default | Description |
|---|
[options.optOut] | Boolean | false | Master switch. If true, no events are posted. Used as a fallback when user consent is not specified. |
[options.useConsent] | Boolean | false | If true, the SDK waits for a consent signal before recording events. Combine with checkForCMP to choose the consent source. |
[options.checkForCMP] | Boolean | true | If true, the SDK queries the TCF 2.0 CMP on the page. If false, consent must be supplied via setConsent. See Consent Resolution. |
[options.user_country] | String | null | Alpha-ISO3 country code attached to every request as user.user_country. Determines storage region. Defaults to IP-derived country when omitted. |
[options.debug] | Boolean | false | If true, events are logged to the console instead of posted. Useful for local testing. |
Identity & hashing
| Parameter | Type | Default | Description |
|---|
[options.areIdentitiesHashed] | Boolean | false | Set to true if your setUserIdentities calls already supply hashed PII (email_sha256_lowercase, etc.). |
[options.hashIdentities] | Boolean | false | If true, raw PII passed to setUserIdentities is hashed by the SDK before being sent. |
Both flags apply only to PII fields. Custom identities (crmID, visitorID, etc.) are always sent as-is.
See API Reference → Set User Identities for the full list of PII fields and supported hash variants.
Cookies & storage
| Parameter | Type | Default | Description |
|---|
[options.storageExpirationDays] | Number | 365 | Expiry (days) for cookies used for default user identification and custom consent. |
[options.domain] | String | top-level domain | Domain to scope cookies against. Defaults to the top-level domain (e.g. .zeotap.com for www.abc.zeotap.com). |
[options.onlySecureCookie] | Boolean | true | Whether cookies are marked secure. Keep at the default unless you have a specific reason to change it. |
[options.persistenceInCookieStorage] | Boolean | false | If true, the SDK persists consent and identity data in cookies. If false, session storage is used instead. |
Event delivery
| Parameter | Type | Default | Description |
|---|
[options.eventUploadThreshold] | Number | 1 | Maximum events allowed in the unsent queue before the next batch is dispatched immediately. |
[options.uploadBatchSize] | Number | 1 | Number of events posted per batch. |
[options.eventUploadPeriodMillis] | Number | 500 | If the queue is below the threshold, the next post is scheduled after this delay (ms). |
[options.eventRetryDelayMillis] | Number | 500 | Delay (ms) added per back-off when retrying a failed post. |
[options.maxRetries] | Number | 3 | Number of retries before an event is dropped. |
Cookie sync
| Parameter | Type | Default | Description |
|---|
[options.allowCookieSync] | Boolean | true | If true, the SDK performs daily-capped cookie syncs with ALL channel partners. To restrict, contact zeotap representative or support team. |
[options.cookieSync] | Boolean | true | Enables/disables cookie syncing with Zeotap’s integrated channels (configured on your account). Tie this to a consent signal to gate cookie sync on the user’s choice. |
TCF integration
| Parameter | Type | Default | Description |
|---|
[options.includeTCFString] | Boolean | false | If true, the SDK looks for the TCF API and passes the gdpr_consent string in the payload. Events still go through even if no TCF API is present. |
[options.purposesForTracking] | number[] | [1,3,4] | TCF purpose IDs that gate tracking. See the TCF purposes appendix. |
[options.purposesForCookieSyncing] | number[] | [1,3,4] | TCF purpose IDs that gate cookie syncing. |
Google Analytics integration
Enable these options to forward GA Client ID / User ID cookies into Zeotap events.
| Parameter | Type | Default | Description |
|---|
[options.allowGAClientId] | Boolean | true | If false, GA Client ID is not forwarded in POST calls. |
[options.gaClientIdCookiePrefix] | String | "" | Prefix for the GA Client ID cookie name. If 'client', the SDK reads client_ga. If empty, it reads _ga. |
[options.gaUserIdCookieName] | String | "" | Cookie name for the GA User ID. |
[options.gaUserIdOnlyLoginEvent] | Boolean | false | If true, the GA User ID is only sent on setUserIdentities calls (not every event). |
ID5 integration
Capturing the ID5 universal ID requires a separate agreement with Zeotap (third-party tag). Contact your Zeotap POC to enable.
<!-- 1. Load the ID5 library after your CMP, before Zeotap -->
<script src="https://cdn.id5-sync.com/api/1.0/id5-api.js"></script>
<!-- 2. Initialize Zeotap with id5 + id5PartnerID -->
<script type="text/javascript">
window.zeotap.init("YOUR_WRITE_KEY", {
useConsent: true,
checkForCMP: true,
id5: true,
id5PartnerID: <YOUR_ID5_PARTNER_ID>
});
</script>
The encrypted ID5 user ID flows in the event payload under user identity. Decrypt server-side using the ID5 Decryption API.
A complete example
window.zeotap.init("YOUR_WRITE_KEY", {
useConsent: true,
checkForCMP: false, // custom consent flow
hashIdentities: true, // hash raw PII at the SDK
user_country: "DEU",
persistenceInCookieStorage: true,
storageExpirationDays: 180,
debug: false,
allowGAClientId: true,
gaClientIdCookiePrefix: ""
});