Enabling the RudderStack integration for Statsig will allow Statsig to pull in your RudderStack events. This allows you to run your experiment analysis on Statsig with all of your existing events from RudderStack without requiring any additional logging.
When Statsig receives events from RudderStack, these will be visible and aggregated in the Metrics tab in the Statsig console. These events will automatically be included in your Pulse results for A/B tests with Statsig's feature gates as well as all your Experiment results.
Configuring Incoming Events
To ingest your events from RudderStack,
- On app.rudderstack.com, navigate to "Connections" and click Add Destination .
- Search for “Statsig” in the Destinations Catalog, and select the “Statsig” destination.
- Give your connection a name and choose which Source should send data to the “Statsig” destination.
- From the Statsig dashboard, copy the Statsig "Server Secret Key”.
- Enter the Statsig “Server Secret Key” in the “Statsig” destination settings in RudderStack.
- On the Statsig Integration page enable the RudderStack integration.
- As your RudderStack events flow into Statsig, you'll see a live Log Stream in the Metrics tab in the Statsig console. You can click one of these events to see the details that are logged as part of the event.
User IDs and Custom IDs
Statsig automatically detects the
userID fields that you log through your RudderStack events. If you're running an experiment with the user as your unit type, this userID should match the user identifer that you log with the Statsig SDK.
If you're using a custom ID as the unit type for your experiment, you can provide this identifier using the key
statsigCustomIDs as part of the RudderStack
properties field as shown below.
"statsigCustomIDs": [ "companyID", "<this_company_id>", "stableID", "<this_stable_id>",]
statsigCustomIDs field in properties should be an array, where the even index is the name of the user ID type and the odd index is the value of the previous element in the array. Assuming you've created this custom ID type on Statsig (under ID Type Settings in your Project Settings), Statsig will automatically recognize these custom identifiers to compute your experiment results appropriately.
By default, all events are treated as "production" events, but you can also differentiate your event traffic by specifying the environment that the events are coming from. This allows you to avoid non-produciton data making it into your production metrics.
If you would like to include the environment tier, you can add it to the properties object of your event. The required format is below:
To learn more about environments see Using Environment.
Configuring Outbound Events
To export your Statsig events to RudderStack,
- Log into the Statsig console and navigate to the Integrations page.
- Click on the RudderStack card and switch to the Outbound tab.
- Follow the steps outlined in RudderStack's Webhook Source to get the required "Write Key" and "Data Plane URL".
- Once filled out, hit enable to save your changes.
You can customize which events should be sent and received via RudderStack using Event Filtering