checkout-completed event to Confidence,
Confidence stores it, and you can build metrics on it.
Events are the main way to record data for Confidence Cloud.
Event tracking has two parts:
- Send events to Confidence. Your app 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.
- Define the event schema, or skip this step and create the event later.
- Send events from your app.
- Create the event and verify arrival.
- Use events in metrics.
Before You Begin
- You need a Confidence account.
- You need the client secret of a client. Events authenticate with the same client credentials that the SDK uses to resolve flags. To create a client, see Create a client.
- You need a Confidence SDK that supports
track. This guide uses the JavaScript (Web) OpenFeature provider. For other SDKs, see SDK support. - For the AI path, set up Confidence for your AI assistant. The Flags MCP server manages event definitions and reports event usage.
Define the Event Schema
An event definition names an event type and describes its payload with a schema. The event name intrack must match the definition name. Names use lowercase letters, digits, and hyphens, and
are 4 to 63 characters long.
Define checkout-completed with these fields:
context.targeting_key: a string that identifies the user, with semantic type Entityvalue: a numbercurrency: a stringitem_count: an integer
- With AI
- In the App
createEventDefinition. To check existing definitions
first, it uses listEventDefinitions.Send Events from Your App
Calltrack on the same OpenFeature client that you use for flags. Tracking requires
@openfeature/web-sdk 1.3.0 or later and @spotify-confidence/openfeature-web-provider 0.3.22
or later.
context field and renames targetingKey to
targeting_key. The tracking details become top-level fields. See
Event payload.
track returns immediately and doesn’t report whether Confidence accepted the event. The SDK
queues events in memory and sends them in batches. See
Batches and delivery.
For Swift, Kotlin, and Flutter examples, see Track events.
Create the Event and Verify Arrival
If you skipped the schema step, Confidence rejects the events, detects a schema from the payload, and lists the event in the Events table as Sent but not stored. Create the event so that Confidence stores events of this type from then on.- With AI
- In the App
queryEventsUsage, which returns hourly publish and
validation failure counts for the last 1 to 7 days. getEventDefinition returns the schema
and publish count.No MCP tool creates an event from a detected schema. To create the event with AI, ask the
assistant to call createEventDefinition with the full schema. To add fields to an existing
event, it uses updateEventDefinition. You can’t change the type of an existing field.- Missing fields. Confidence drops fields that aren’t in the schema, and 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.
- Validation failures. Confidence rejects events with wrong field types. You can’t change a field’s type after you save it. Create a new event definition instead.
Use Events in Metrics
On Confidence Cloud, Confidence creates a fact table for each event that references an entity. Numeric fields become measurements, and other fields become dimensions. Build a metric on the fact table with Create your first metric. On Warehouse Native, also create an event connection so that Confidence writes event data to your warehouse. The Flags MCP toolcreateEventConnection creates it. See
Event connectors.
Related Resources
- Track events: SDK calls, payload format, and schema rules
- Fact tables: turn event data into metric sources
- MCP servers: event tools on the Flags MCP server
- Confidence Cloud: how data reaches the managed warehouse

