Mixpanel is an analytics platform that helps you to track user actions with your application. It also provides specific tools for targeted business communication and engagement with your customers. In-app A/B testing, user survey forms, and custom reports to measure customer retention are some of the other features offered by Mixpanel.
RudderStack supports Mixpanel as a destination to send your event data through our APIs.
Before configuring your source and destination on the RudderStack, please verify if the source platform is supported by Mixpanel by referring to the table below:
Connection Mode | Web | Mobile | Server |
Device mode | - | - | - |
Cloud mode | Supported | Supported | Supported |
To know more about the difference between Cloud mode and Device mode in RudderStack, read the RudderStack connection modes guide.
Once you have confirmed that the platform supports sending events to Mixpanel, perform the steps below:
From your RudderStack dashboard, add the source. From the list of destinations, select Mixpanel.
Please follow our guide on How to Add a Source and Destination in RudderStack to add a source and destination in RudderStack.
Give a name to the destination and click on Next. You should then see the following screen:
We need your Mixpanel’s Token
, please provide it into the Connection Settings in Rudder. Currently, we do not support sending events through the native SDK.
Choose EU in Data Residency settings to send your event data to the Mixpanel EU server.
We pass all the page properties that you provide through our page
call along with the properties that we auto collect through our SDK to Mixpanel. The event name would be Page for page
call and Screen for a screen
call. A sample page call is:
rudderanalytics.page();
To identify a user to Mixpanel, you need to call the identify
API. Mixpanel needs a unique identifier to identify a user. So, if you provide userId
in your identify
call, RudderStack will pass it as that distinct_id
. Otherwise, it will send an anonymousId
if userId
is not present, and set the traits that you have provided as the properties corresponding to the distinct ID.
After making this request, RudderStack makes a $merge
of anonymousId
and userId
as a distinct_id
and the new userId
is mapped to alias
so that both of these users are mapped to a single entity in the Mixpanel dashboard.
A sample identify
call is as shown:
rudderanalytics.identify("12345",{firstname: "Tintin",city: "Brussels",country: "Belgium",phone: "1234567890",email: "tintin@twentiethcentury.com"})
Mixpanel has some reserved properties:
$first_name
$last_name
$name
$username
$created
$email
$phone
$avatar
You may also create custom properties but you should not create properties that begin with a $
sign.
To track users' actions, you can use our track
API. You can call track
with eventname
and properties. A sample track call is:
rudderanalytics.track("track event", {test_prop1: 50,test_prop2: "prop_value"});
As Mixpanel also tracks revenue, if you send revenue as a key in properties
in track
call, then RudderStack will track it as a revenue event.
Revenue tracking is done with distinct_id
(that is userId
that you provide in your identify
call, if userId
is not present then it will be associated with anonymousId
.)
A sample revenue track
call is as shown:
rudderanalytics.track("Purchase", {revenue: 30,currency: "USD"});
Mixpanel supports historical event data import. But the timestamp of the event should be within the last 5 years. Mixpanel rejects any data older than this duration. To send historic events, you need to provide the timestamp at the timestamp
field in the message. RudderStack will then send the event with the same timestamp to Mixpanel.
Below is the mapping of some of Mixpanel properties with the Rudder properties that we send over their HTTP API.
We map these fields only in identify
requests
Mixpanel properties | Rudder properties |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you come across any issues while configuring Mixpanel with RudderStack, please feel free to contact us. You can also start a conversation on our Slack channel; we will be happy to talk to you!