Skip to content

Track Exposure

Exposure tracking is essential to tracking if and when a user has actually viewed the variable experience from your feature flag. Exposure tracking may be considered optional for feature flags which don't require analysis; however, it's essential when running experiment. Accurate exposure tracking is crucial for reliable results.

Analytics REST API

To keep things simple, this example is going to curl an exposure event to Amplitude using the Analytics REST API v2.0.

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 '' \
     --data '{"api_key":"","events":[{"event_type":"$exposure","user_id":"","event_properties":{"flag_key":"","variant":""}}]}'

The analytics API key from project which you created your flag and deployment in.
The user ID used to fetch variants. This should be the same user you fetched variants for.
The flag key of the flag or experiment the user has been exposed to.
The variant key, on if you're using the default flag variant.
The server zone for your Amplitude project
Track Exposure


If the request succeeded, you should see a user in the Exposures chart in Experiment.


Your flag is now active within your deployment and a user has been evaluated and exposed to a variant.


As with fetching variants, exposure tracking can be simplified by using a client-side Experiment SDK in your app. Client-side Experiment SDKs come equipped with the ability to automatically track exposures through your installed analytics SDK whenever a variant is accessed from the variant store.

Was this page helpful?