- Send events to Confidence. Your application calls
trackon a Confidence SDK. - Set up an event schema. Confidence stores an event only when an event definition with a matching name and schema exists.
Application events are different from apply events. SDKs send
apply events automatically when your application uses a flag. You send application events explicitly
with
track.SDK Support
Events authenticate with the same client credentials that the SDK
uses to resolve flags.
JavaScript (Web)
OpenFeature Provider
The Confidence OpenFeature provider for web browsers implements the OpenFeature tracking API. Calltrack on
the same OpenFeature client that you use for flags.
Tracking in the web provider requires
@openfeature/web-sdk 1.3.0 or later and
@spotify-confidence/openfeature-web-provider 0.3.22 or later, with a matching version of the
@spotify-confidence/sdk peer dependency.Confidence SDK: track(name, data?)
The @spotify-confidence/sdk package exposes track on any Confidence instance. The SDK appends
the context set on the instance to each event.
Confidence plans to retire the standalone
Confidence class. For new integrations, use the
OpenFeature provider.Confidence SDK: track(manager)
Pass a tracking manager instead of an event name to track data automatically. The web SDK includes
these managers:
Event Payload
The web provider builds the payload from two sources:- Tracking details. The object you pass to
trackbecomes top-level fields in the payload. - Evaluation context. The provider adds the current evaluation context under a
contextfield. It renamestargetingKeytotargeting_keyand convertsDatevalues to ISO 8601 strings.
context for the evaluation context and ignores a tracking detail named context.
Batches and Delivery
track returns immediately and doesn’t report whether Confidence accepted the event. The SDK queues
events in memory and sends them in batches.
- Rejected events. The SDK logs a warning and doesn’t resend them.
- Network errors, server errors, and HTTP 429. The SDK retries the batch with increasing delays, from 5 seconds up to 5 minutes. It stops retrying 30 minutes after the first try and drops the batch.
- Other request errors, such as an invalid client secret. The SDK logs an error and drops the batch.
- Page hidden. The SDK tries to send up to 25 queued events with the browser
sendBeaconAPI.
Swift
Android (Kotlin)
Flutter
Unity and .NET
Go
Track returns a *sync.WaitGroup.
Java
JavaScript (Server)
Python
Rust
Ruby
track! method with the same parameters.
Event Schema
An event definition names an event type and describes its payload with a schema. The event name intrack must match the event definition name. Event definition names use lowercase letters, digits,
and hyphens, and are 4 to 63 characters long, for example checkout-completed.
Define the Schema in Advance
- In the sidebar, select Events and click Create. The Create event dialog opens.
- Enter the event name.
- Edit the Schema to add fields. Set the field that identifies the user, such as
context.targeting_key, to type String with semantic type Entity.
Send Events First, Then Create the Event
- Send the event from your application.
- Confidence rejects events with no matching definition, detects a schema from the payload, and lists the event in the Events table as Sent but not stored.
- In the event’s row, click the outlined Create.
- Review the schema. Set at least one String field to semantic type Entity.
- Click Create.
Schema Changes
- Fields missing from the schema. Confidence drops fields that aren’t in the schema and accepts the rest of the event. The event page shows a warning. Click Update in the warning to add the fields. Confidence doesn’t recover values it dropped before the update.
- Wrong field types. Confidence rejects the event and counts it as a validation failure.
- Type changes. You can’t change a field’s name or type after you save it. Create a new event definition instead.
Verify That Events Arrive
After your application starts sending an event:- The Events page shows a status icon for each event type that indicates when the event last received data.
- The event page shows a Usage chart with hourly counts of published events and validation failures.
- A missing-fields warning on the event page means clients send fields that Confidence drops.
- Events with no definition appear as Sent but not stored.
Related Resources
Fact Tables
Turn event data into metric sources
Event Connectors
Export events to your own warehouse
Evaluation Context
Configure the context that SDKs attach to events
Apply Events
Understand automatic flag assignment tracking

