Skip to main content
Events are how Traffical sees what happened in your application: which variants users were exposed to and what they did afterwards. Events power metric dashboards, statistical significance calculations, and the optimizer that learns from user behaviour. Events are the raw material; metrics aggregate them into the numbers experiments are judged on, computed with the methods in the statistics overview. There are three kinds of events.

Event types

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:
  1. Config-as-code — declared in .traffical/config.yaml and synced with traffical push
  2. Dashboard — created manually in the UI
  3. Auto-discovered — created automatically the first time the SDK sends an event name the platform hasn’t seen before

Value types

Property schemas

Events can declare schemas for their payload properties. Schemas serve three purposes: they generate TypeScript types for track(), 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:
See Type-safe events for the full end-to-end flow including CLI codegen, SDK type parameters, and dev-mode validation warnings.

Attribution

Events are attributed to decisions via the decisionId 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: For batch and offline systems (email sends, push notifications) you can pass 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:
This produces a 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 optimizer.
  • Bandit learning — adaptive policies use track events as reward signals; the optimizer periodically retrains and republishes allocations or coefficients into the bundle.
If you’d rather compute metrics from your own data warehouse instead of (or in addition to) Traffical-native events, see warehouse-native.

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.