Campaign SDK
Know where every event comes from
Campaign analytics combine browser observations, tday-hosted interactions, redirects, trusted backend conversions, and paid-provider reconciliation. Their trust levels stay explicit.
Event source map
assignmentUnverifiedOne functional assignment for the visitor, release, and arm while retained.exposureUnverifiedAutomatic only with granted consent and viewability, or explicit through expose().Your event nameUnverifiedQueued browser reporting tied to a current signed assignment.impression, visit, clickUnverifiedAssignment and impression are recorded, visit requires consent, and CTA interaction records click.clickUnverifiedServer-observed click that hands a signed td_at bootstrap to the destination.qr_scanUnverifiedServer-observed scan tied to the published QR arm.Primary or customServer-verifiedAuthenticated with the installation secret through the conversions endpoint.Aggregate deliveryProvider-verifiedReconciled impressions, clicks, spend, and conversions supplied by the connected provider.Track a browser event
Event names start with a lowercase letter and contain at most 64 lowercase letters, numbers, underscores, periods, colons, or hyphens. The call returns its event ID immediately.
const eventId = campaign.track("pricing_viewed", {
eventId: "pricing_view_01J8M6Y7QK",
valueMinor: 2500,
currency: "USD",
properties: {
plan: "team",
placement: "homepage_hero"
}
});valueMinor is a non-negative integer in the currency's minor unit and requires a three-letter currency. The currency must match the campaign currency when the event is ingested.
Make retries idempotent
Every event has an ID. When omitted, the SDK generates one and keeps it unchanged across offline storage, fetch retries, and page-hide keepalive delivery. If your application may invoke track()again for the same business action, provide the same stable eventId on every attempt. IDs are deduplicated within the SDK installation.
campaign.track("checkout_started", {
eventId: `checkout_${checkoutAttemptId}`
});Assignment and event timing
- Without an explicit
assignmentToken, the SDK uses the last exposed assignment, then the first assignment in the current decision. - Events called before the initial decision are held in a bounded pending list and associated after an assignment arrives.
- The first-party offline queue retains at most 500 events, sends at most 50 per batch, and normally flushes every five seconds.
- Raw attribution events and the anonymous visitor record have a 90-day retention boundary.
Primary event matching
The primary event is configured on the campaign and compared as an exact, case-sensitive string. If the campaign primary event is signup_completed, then signup, Signup_Completed, and signup-completed do not count as that primary conversion. Other valid event names remain available in the raw reporting stream.
Consent and data minimization
Automatic behavior
Unknown or denied consent still permits a deterministic decision but suppresses automatic exposure. Explicit track()and expose() calls remain explicit application actions and retain the token consent state.
Minimized payloads
The SDK sends pathnames, not query strings or fragments. It does not automatically read DOM text, forms, email addresses, user agents, IP addresses, or device fingerprints.
Event properties are bounded and sanitized. Keys and values that look like PII, secrets, unsafe object keys, HTML, form data, or full URLs are removed or reduced to a safe pathname before transport.
Continue reading