Split + Mixpanel
Split impressions describe the treatment that each user receives when a feature flag is evaluated. Set up a Split webhook to listen for impressions as they’re captured and send them to Mixpanel. The webhook will transform the impressions into Mixpanel events. Using either AWS Lambda or a Google Cloud Function you can easily transform Split impressions into Mixpanel events.
To connect Mixpanel to Split, you need:
- A Mixpanel project token
- Administrator access to your Split account
How to use
Publish a Split impressions webhook
Using Java AWS Lambda (AWS) and Java Google Cloud Function (GCF) parse the input stream into impression instances. Then create a new series of Mixpanel events that include the data from the impressions, setting the Mixpanel distinct_id to the impression's key and passing other properties through as event properties. Base64 encode the resulting events and post them to Mixpanel events endpoint. For the code to compile, you need the following Mixpanel token:
Both AWS and GCF versions cache the HTTP client used to POST to Mixpanel in their execution runtimes. After cold start, the cheapest, default runtimes show timings in the 100-200ms range for handling batches of 50 impressions.
Configure Split to use your webhook
Copy your function/lambdas URL endpoint and paste it into the Split impressions webhook configuration. Learn more about configuring a Split impressions webhook.
Make sure you choose the environment from which you wish to receive impressions. If you're generating traffic in a testing environment, you won't see those impressions in production, and vice-versa.
Trigger Split impressions
You must have some code written that uses a getTreatment call to evaluate a feature flag. Once the listener is registered, each getTreatment call generates an impression, and within several seconds the impression arrives at the listener.
Using your cloud's native logging infrastructure (e.g., CloudWatch for AWS and LogViewer for Google) you can check that the impression function/lambda is being invoked. The sample source code includes good logging to verify success. If you don’t see logging, your function may not be installed correctly, or there may be no impressions. Check the impressions tab for your feature flag. If you see impressions arriving, but your function/lambda is not being invoked, the connection may be misconfigured.
Note that AWS Lambda functions ought to be installed with a POST method on the API Gateway in order to get a URL for use with Split.
Verify Mixpanel events are arriving from Split
Use the Mixpanel LiveView to verify that your Split events are arriving as expected.
The distinct_id is the Split impression's key -- the identifier with which getTreatment was evaluated. If Mixpanel has more events with the same distinct_id, you will be able to join against that data and use Split impressions to further understand your customer behavior by building cohorts.
The event in Mixpanel includes the treatment (typically on or off or whichever treatments you configured in Split), a descriptive label for why the treatment was returned, the name of the feature flag evaluated, a timestamp, and some accompanying details about the Split SDK which evaluated the getTreatment call.
These functions have not been heavily performance tested. Further tuning may be necessary for high volumes of event traffic.
To learn more about all our integrations check out our integrations page. If you’d like a demo of Split, or help to implement any of our integrations, contact email@example.com.