Mixpanel

Step-by-step guide to adding Mixpanel as a destination in RudderStack

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.

Getting Started

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

Once you have confirmed that the platform supports sending events to Mixpanel, perform the steps below:

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:

Connection Settings Mixpanel

We need your Mixpanel’s Token, please provide it into the Connection Settings in Rudder. Currently we do not support sending events through native SDK.

Page

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();

Identify

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, we will pass it as that distinct_id else, we will send anonymousId if userId is not present.

After making this request, we make a $create_alias with anonymousId as distinct_id and the new userId is mapped to alias so that both of these users are mapped to a single entity in Mixpanel dashboard.

A sample identify call is:

rudderanalytics.identify("12345",
{
firstname: "Tintin",
city: "Brussels",
country: "Belgium",
phone: "1234567890",
email: "tintin@twentiethcentury.com"
}
)

Mixpanel has some reserved properties:

  • $first_name

  • $last_name

  • $created

  • $email

  • $phone

  • $avatar

You may create custom properties but you should not create properties that begin with a $ sign.

Track

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"
});

Tracking Revenue

As Mixpanel tracks revenue, if you send revenue as a key in properties in track call, then we will send it as tracking 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:

rudderanalytics.track("Purchase", {
revenue: 30,
currency: "USD"
});

Contact Us

If you come across any issues while configuring Mixpanel with RudderStack, please feel free to contact us or start a conversation on our Discord channel. We will be happy to help you.