Skip to main content
The engagement SDK is a zero-dependency TypeScript client for POST /v1/track. It runs in browsers (with sendBeacon drain on page hide) and in Node 18+ (global fetch).
The SDK is not yet published to npm - your 4D contact provides the package during integration onboarding. Everything it does rides on the public /v1/track endpoint, so you can always start with plain HTTP and adopt the SDK later without changing anything server-side.

Quick start

Events are batched (up to 20 per request, the server cap), auto-flushed every 2s while anything is queued, and drained via navigator.sendBeacon when the page is hidden or unloading. Every event carries a client-generated UUID event_id which the server dedupes on, so retries after network failures can never double-count tag affinity.

Identity

The platform only records engagement for known members. Identity comes from one of:
Events tracked with no identity available are dropped and reported through onError - call identify() as soon as you know who the user is.

Delivery semantics

track() never throws. The only error surface is the onError callback:

Flushing

Config reference

Tags

Tags are trimmed + lowercased client-side (matching server normalisation) and must fit ^[a-z0-9][a-z0-9_.:-]{0,63}$ - max 10 per event. Invalid tags are filtered out; an event whose tags are all invalid is dropped and reported. The tracking key is publishable - it ships in client code like an analytics measurement id. Abuse controls are the key’s per-origin allowlist and per-key rate limiting (issue keys via the API), not key secrecy.