Split + Mixpanel is a community-supported integration. Community-supported integrations are not owned or maintained by the engineering teams at Split or Mixpanel. We do our best to ensure that we share only high-quality community integrations and solutions but we do not work on these projects directly, nor can we guarantee that they’re consistently maintained.
We encourage contribution to all community-supported integrations, you can find the repo that backs this integration on GitHub.
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 firstname.lastname@example.org.
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 to supply the 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 will have to have some code written that uses a getTreatment call to evaluate a feature flag. Once the listener is registered, each getTreatment call will generate an impression, and within several seconds the impression will arrive at the listener.
Using your cloud's native logging infrastructure (i.e. 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 will include 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.
If you have questions or comments, contact the contributor David Martin.
The source code referenced can be found in GitHub - Java AWS Lambda and Java Google Cloud Function.
Please sign in to leave a comment.