Exposure tracking in Amplitude Experiment
Exposure tracking is optional for feature flags that don't require analysis.
Analytics REST API
In this example, the Analytics REST API v2.0 sends an exposure event to Amplitude withcurl.Exposure example
POST · /2/httpapiHTTP V2 APIcURLPOST · /2/httpapi
curl --request POST \ --url 'https://api2.amplitude.com/2/httpapi' \ --data '{"api_key":"","events":[{"event_type":"$exposure","user_id":"","event_properties":{"flag_key":"","variant":""}}]}'$ awaiting send…
When the request succeeds, a user appears in the Exposures chart in Amplitude Experiment.
The flag is now active in your deployment, and your experiment evaluated a user and served them the variant.
SDKs
As with fetching variants, you can simplify exposure tracking using a client-side Experiment SDK in your app. Client-side Amplitude Experiment SDKs automatically track exposures through your installed analytics SDK whenever the Experiment SDK accesses a variant from the variant store.Was this helpful?