All functions are exported from zeo-collect. Import what you need per component:
import {
initialiseZeoCollect,
setEventProperties,
setEventNameProperties,
setUserIdentities,
setConsent
} from 'zeo-collect';
Initialization
initialiseZeoCollect
Initializes both native SDKs with a shared options object.
initialiseZeoCollect(options, callback?);
| Parameter | Type | Description |
|---|
options | Object | Configuration object — see Configuration. |
callback | Function | Optional (data) => void receiving {status, message}. |
Events
setEventNameProperties
Sends an event by name (no properties).
import { setEventNameProperties } from 'zeo-collect';
setEventNameProperties("primary_button_clicked");
// with callback
setEventNameProperties("primary_button_clicked", (res) => {
// handle res.status / res.message
});
setEventProperties
Sends an event with properties.
import { setEventProperties } from 'zeo-collect';
const eventProperties = { name, description, price };
setEventProperties("primary_button_clicked", eventProperties);
// with callback
setEventProperties("addToCart", eventProperties, (res) => {
// handle response
});
setInstantEventNameProperties
Same as setEventNameProperties but bypasses the batch queue — sent immediately.
setInstantEventNameProperties("checkout_complete");
setInstantEventProperties
Same as setEventProperties but bypasses the batch queue — sent immediately.
setInstantEventProperties("checkout_complete", { orderID, total });
Event types
| Type | Description |
|---|
| System events | Predefined events emitted automatically by the native SDKs: Set consent, Update consent, Set identities, Update identities. |
| Custom events | User-defined actions specific to your app. |
Page tracking
setPageProperties
Logs page properties attached to every subsequent event.
import { setPageProperties } from 'zeo-collect';
setPageProperties({ name: "Product" });
User attributes
setUserProperties
Sends user attribute information attached to the current zi and any identities set via setUserIdentities.
import { setUserProperties } from 'zeo-collect';
setUserProperties({ plan: "premium", country: "DEU" });
PII keys passed to setUserProperties are hashed before sending. Prefer setUserIdentities for identifiers so they persist across events.
Identities
setUserIdentities
Captures user identities that persist across subsequent events.
import { setUserIdentities } from 'zeo-collect';
setUserIdentities({
email: "test@gmail.com",
loginid: "testUser123",
cellno: "1234890987"
});
Raw identities
| Scenario | Options | Behavior |
|---|
| Forward raw PII as-is | are_identities_hashed: false, hash_identities: false | Sent unchanged. |
| Let the package hash | are_identities_hashed: false, hash_identities: true | Hashed to sha256, sha1, md5 before sending. |
Reserved raw PII keys — email, cellno (no country code), cellno_cc (with country code), loginid, fpuid.
Hashed identities
If you hashed PII client-side, send the hash keys directly with are_identities_hashed: true:
setUserIdentities({
email_sha256_lowercase: "...",
cellno_with_country_code_sha256: "..."
});
Full matrix matches the native SDKs: email_{sha256,sha1,md5}_{lowercase,uppercase}, cellno_{with,without}_country_code_{sha256,sha1,md5}, loginid_{sha256,sha1,md5}_{lowercase,uppercase}.
See hashing guidelines.
Custom identities
Any first-party identifier outside the reserved PII keys (e.g. crmID, ECID) — always sent as-is.
setUserIdentities({ crmId: "12345" });
unSetUserIdentities
Clears persisted identities. Call this on logout.
import { unSetUserIdentities } from 'zeo-collect';
unSetUserIdentities();
Consent
setConsent
Sets consent in the non-TCF flow. Pass primary consent (track, identify) for Custom mode, or brand consent under any mode.
import { setConsent } from 'zeo-collect';
setConsent({ track: true, identify: true });
// with callback
setConsent({ track: true, identify: true }, (res) => {
// handle response
});
Full walkthrough: Consent Resolution.
listenToAskForConsent
Registers a callback that fires when the package needs consent. Applies only to custom consent.
import { listenToAskForConsent } from 'zeo-collect';
listenToAskForConsent(() => {
// show your consent UI
});
Pause / resume
import { pauseCollection, resumeCollection } from 'zeo-collect';
pauseCollection();
// ... no events sent in this window
resumeCollection();
Callback signature
Most functions accept an optional (res) => void callback. res is an object with:
status — SUCCESS / WARNING / ERROR
message — descriptive string
See SDK Reference for the full callback contract. Last modified on June 22, 2026