Exposure Tracking
An exposure event is a strictly defined analytics event sent to Amplitude to inform Amplitude Experiment that a user was exposed to a variant of an experiment or feature flag. Exposure events contain the flag key and the variant of the flag or experiment that the user has been exposed to in the event's event properties.
When Amplitude ingests an exposure event, it uses the flag key and variant to set or unset user properties on the user associated with the event. Setting user properties is essential for experiment analysis queries on primary and secondary success metrics.
Event Volume Billing
If you've purchased Amplitude Experiment's End-to-end feature flagging and experimentation solution, Amplitude defined exposure events don't count toward your organization's event volume billing. If you have purchased Experiment Results or have not purchased Experiment then all events will be billed in full.
Automatic exposure tracking¶
Client-side Experiment SDKs support automatic exposure tracking through an exposure tracking provider implementation. Without an integration or custom implementation, exposure events aren't tracked automatically.
Integrations
Client-side SDKs currently support two integrations, Amplitude and Segment. You can also implement your own custom integration.
SDK Integrations |
Minimum Version |
---|---|
JavaScript SDK | 1.4.1+ |
Android SDK | 1.5.1+ |
iOS SDK | 1.6.0+ |
React Native | 0.6.0+ |
Exposure event¶
The exposure event is simple enough to send through any analytics implementation or customer data platform without needing to manipulate user properties directly. When Amplitude ingests an $exposure
event, the requisite user properties are automatically set or unset for 100% accuracy and confidence.
Definition¶
Event Type | Event Property |
Requirement | Description |
---|---|---|---|
$exposure |
flag_key |
Required | The flag or experiment key which the user is being exposed to. |
variant |
Optional | The variant for the flag or experiment that the user has been exposed to. If null or missing, the user property for the flag/experiment is unset, and the users is no longer a part of the experiment. |
Example¶
Potential data changes
This example makes real requests to the API and can potentially change the data in your Amplitude project. We recommend using a development project when testing APIs.
curl --request POST \
--url https://api2.amplitude.com/2/httpapi \
--data '{"api_key":"","events":[{"event_type":"$exposure","user_id":"","device_id":"","event_properties":{"flag_key":"","variant":""}}]}'
Variable |
Description |
---|---|
The analytics API key from project which you created your flag and deployment in. | |
The user's ID. | |
The user's device ID. | |
The flag key of the flag or experiment the user has been exposed to. | |
The variant value (e.g. on , control , treatment ). |
|
Track Exposure |
Result:
Still have questions? Ask them in the Community.