Event types
- Exposure
- Track
- Decision
Exposure events are emitted automatically when the SDK resolves parameters. They record the user’s assignment for each layer they touched.Exposure events are deduplicated within a session, so the same user/assignment combination isn’t tracked over and over.They form the denominator in conversion-rate metrics: how many users were exposed to each variant.
Event definitions
Event definitions describe the track events your system emits. They’re created in three ways:- Config-as-code — declared in
.traffical/config.yamland synced withtraffical push - Dashboard — created manually in the UI
- Auto-discovered — created automatically the first time the SDK sends an event name the platform hasn’t seen before
Value types
| Value type | Description | Typical example |
|---|---|---|
currency | Monetary values | Revenue in USD |
count | Numeric counts | Items added, pages viewed |
rate | Proportions or percentages | Completion rate |
boolean | Binary outcomes | Converted / didn’t convert |
Property schemas
Events can declare schemas for their payload properties. Schemas serve three purposes: they generate TypeScript types fortrack(), they let the edge validate incoming events, and they mark which properties are dimensions for slicing metrics in the warehouse-native pipeline.
schemaEnforcement controls what happens when an event doesn’t match its schema: off skips validation, warn validates and returns warnings in the API response but still accepts the event, reject drops invalid events before they reach the pipeline.
Common properties used across many events can be extracted into property groups for reuse:
Attribution
Events are attributed to decisions via thedecisionId field. When the SDK resolves parameters, it generates a decision ID. When you call track() shortly afterwards, the SDK includes the same decisionId so the event is causally linked to the assignment.
The SDK supports two attribution modes:
| Mode | Behaviour | Use when |
|---|---|---|
cumulative (default) | A track event is attributed to every layer the user has been exposed to in the session. | Cross-page funnels (catalog → PDP → checkout) where multiple experiments contributed to the outcome. |
decision | A track event is attributed only to the layers from the specific decision it’s tied to. | When you need strict single-decision attribution (often warehouse-native analyses). |
decisionId through your external system and back in when the outcome event arrives. See the email / batch pattern.
If a track event has no decisionId and no SDK-built attribution array, the pipeline still attributes it: metrics join track events to assignments on unit_key with a temporal constraint (any track event after the user’s first exposure to an allocation counts toward that allocation). This is what makes events from webhooks and batch processes work without any explicit threading.
For finer-grained attribution — e.g. strictly tying a click to the specific decision that preceded it, ignoring other decisions in the same session — pass decisionId and set attributionMode: "decision" on the client. See decisions & attribution.
Type-safe events
The CLI can generate TypeScript types from your event definitions:TrafficalEventProperties map you can use to type your track() calls — invalid event names and property keys become compile errors. See the CLI page for the wrapper pattern.
What happens after an event is sent?
SDKs batch events in memory and flush to Traffical in the background. They’re used for:- Metric computation — for dashboards, significance tests, and the optimization engine.
- Bandit learning — adaptive policies use track events as reward signals; the optimization engine periodically retrains and republishes allocations or coefficients into the bundle.
Next steps
Decisions & attribution
How decision IDs flow through your application.
Warehouse-native
Compute metrics directly from your data warehouse.
A/B testing
End-to-end experiment with events.
Optimization
Events as reward signals for adaptive policies.