Hi there!
For Amplitude experiments, it is recommended to emit an exposure event.
We are using segment.io and are wondering how we can track those events properly.
Whenever we call `track` it ends up being an event with name `$exposure`.
Segment doesn’t seem to wanna pass `event_type` to the destination.
The alternative is to use the `identify` call, but I wonder if there are side effects compared to using the $exposure call.
Hello
May I know what the current concerns are with the $Exposure event that is being tracked? What do you mean by “how we can track those events properly”? What is currently not working?
If helpful to get you started with Segment and Amplitude Experiment there is a section in the documentation that walks over how to implement with Segment: https://www.docs.developers.amplitude.com/experiment/sdks/javascript-sdk/#integrations.
Hi
This actually works, as long as we provided the payload with flag_key and variant.
Should we only use exposure or can we use `identify(“Experiment] my_flag”, “variant”)` as well?
Hello
According to the documentation only $Exposure event is needed and Amplitude will fill in the user properties from the Experiment. If you have access to an Experiment playground I would recommend testing this out for yourself.
SegmentExposureTrackingProvider:
class SegmentExposureTrackingProvider implements ExposureTrackingProvider {
private analytics: Analytics;
constructor(analytics: Analytics) {
this.analytics = analytics;
}
track(exposure: Exposure) {
this.analytics.track('$exposure', exposure);
}
}
The Assignment event sets the user properties of the Experiment and then when the Exposure event is triggered the user properties from the Assignment event will carry over.
Yes, I’ve tried it and it appears to be working properly. But you can also fill user properties by calling identify. I wonder if the `$exposure` was triggering different mechanisms or if calling
```identify(userId, { ,“{Experiment] my_flag”]: “control” })```
is equivalent
Hello
The $identify call is only for setting user properties. The variant the user gets assigned is already handled by the Assignment event which sets a user property.
Got it! Thanks for the answer!
Reply
Welcome to the Amplitude Community!
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. You can also create a Guest account below!
If you're a current customer, select the domain you use to sign in with Amplitude.
analytics.amplitude.com analytics.eu.amplitude.comWelcome to the Amplitude Community!
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. Want to sign up as a guest? Create a Community account.
If you're a current customer, select the domain you use to sign in with Amplitude.
analytics.amplitude.com analytics.eu.amplitude.comEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.