When running experiments with both anonymous and logged-in users using Segment and Statsig, it is crucial to have a common identifier to track user interactions accurately.
For anonymous users, you can either pass the stable ID generated by Statsig to Segment or generate a stable ID and pass it to Statsig. This ensures that there is a consistent identifier across both platforms.
For logged-in users, you can use the Segment userID, which should be included in the userObject during initialization. This setup allows Statsig to recognize both anonymous and logged-in users in the experiment. To facilitate this, you may need to provision a new custom ID, such as segmentAnonymousId
, and map Segment's anonymousId
to this new custom ID in the integration settings.
This approach ensures that exposure events sent via the Statsig SDK and custom events sent via Segment are associated with the same user, regardless of their logged-in status.