# Mixpanel Destination Setup Guide

This guide will help you set up Mixpanel as a destination in the RudderStack dashboard. It also lists the configuration settings required to correctly send data from the supported sources to Mixpanel.

## Connection compatibility

{{< destination-config >}}

{{< info >}}
Note that for the web device mode integration, that is, when using [JavaScript SDK]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/_index.md" >}}) as a source, RudderStack loads the Mixpanel native SDK from the `https://cdn.mxpnl.com/` domain.

Based on your website's content security policy, you might need to [allowlist this domain]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/load-js-sdk.md#allowlist-destination-domain" >}}) to load the Mixpanel SDK successfully.
{{< /info >}}

## Setup

Once you have confirmed that your source platform supports sending events to Mixpanel, follow these steps:

1. From your [RudderStack dashboard](https://app.rudderstack.com/), add a source. Then, from the list of destinations, select **Mixpanel**.
2. Assign a name to the destination and click **Continue**.

### Connection settings

| Setting | Description |
| :----| :-----|
| Project Token | Your [Mixpanel Project Token](https://developer.mixpanel.com/reference/project-token).  |
| Data Residency | Select the relevant option among `US`, `EU`, and `IN` (beta). RudderStack will send your event data to the Mixpanel server in that region. |
| Identity Merge | Select either **Original ID Merge** or **Simplified ID Merge** from the dropdown to track user journeys across devices. See the [Mixpanel documentation](https://help.mixpanel.com/hc/en-us/articles/14383975110292) for more information on the differences between these APIs.<br /><br/>If you select the **Simplified ID Merge** option, make sure to [turn on the Simplified ID Merge API for your project](https://help.mixpanel.com/hc/en-us/articles/14383975110292-Original-vs-Simplified-ID-Merge-FAQ#how-do-i-enable-the-simplified-api-on-a-project) before sending the events.  |

### Configuration settings

Configure the below settings depending on your [specified connection mode](#connection-compatibility) to receive the data correctly in Mixpanel.

#### Cloud mode

##### **Page settings**

| Setting | Description |
| :----| :-----|
| Use Custom Page Event Name | Toggle on this setting and specify the template for your `page` event names. RudderStack sets the event names for your `page` calls accordingly. <br /><br />For example, if you set the template as `Viewed {{category}} {{name}} page` and send the below `page` event payload:<br /><br /><pre>{<br />  "type": "page",<br />  "name": "Home",<br />  "properties": {<br />    "category": "Integration"<br />  }<br />}</pre> Then, RudderStack sends the `page` event name as `Viewed Integration Home Page` to Mixpanel. <br /><br />Note that:<br /><br /><ul><li>This setting is applicable for cloud mode and device mode.</li><li>You can skip the page category, name, or both while setting the template. For example, `Viewed {{category}} page`, `Viewed {{name}} page`, `Viewed a page` are all valid.</li><li>If you include the page category in the template, make sure to send it in the event's `properties` object.</li></ul> |

##### **Screen settings**

| Setting | Description |
| :----| :-----|
| Use Custom Screen Event Name | Toggle on this setting and specify the template for your `screen` event names. RudderStack sets the event names for your `screen` calls accordingly. <br /><br />For example, if you set the template as `Viewed {{category}} {{name}} screen` and send the below `screen` event payload:<br /><br /><pre>{<br />  "type": "page",<br />  "name": "Home",<br />  "properties": {<br />    "category": "Integration"<br />  }<br />}</pre> Then, RudderStack sends the `screen` event name as `Viewed Integration Home Page` to Mixpanel. <br /><br />Note that:<br /><br /><ul><li>This setting is applicable for cloud mode only.</li><li>You can skip the screen category, name, or both while setting the template. For example, `Viewed {{category}} screen`, `Viewed {{name}} screen`, and `Viewed a screen` are all valid.</li><li>If you include the screen category in the template, make sure to send it in the event's `properties` object.</li></ul> |

##### **Track settings**

| Setting | Description |
| :----| :-----|
| Drop Traits | Toggle on this setting to drop the persisted user traits (`context.traits`) from the `track` events. If this toggle is off, RudderStack passes the `context.traits` values along with the other `track` event properties. |

##### **Mixpanel configuration settings** {#mixpanel-config-cloud-mode}

| Setting | Description |
| :----| :-----|
| Strict Mode | If turned on, Mixpanel validates the requests and returns errors for each failed event. See [Mixpanel Import Events API](https://developer.mixpanel.com/reference/import-events) for more information. |
| Properties to increment in People | See [Increment properties in Mixpanel People]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#increment-properties-in-mixpanel-people" >}}) for more information. |
| Properties to set only once  | Specify the `identify` traits as Mixpanel properties whose values you do not want to change at the user profile level. Once specified, Mixpanel will **not** overwrite these fields with new values later. <br /><br />See [Properties to set only once]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#properties-to-set-only-once" >}}) section for more information. | 
| Properties for Union | Specify the `identify` traits whose values are added to a list property on a Mixpanel user profile so that they appear **only once**. <br /><br />See [Properties for union]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#properties-for-union" >}}) section for more information. |
| Properties for Append | Specify the `identify` traits whose values need to be appended in the list property on a Mixpanel user profile. <br /><br />See [Properties to append]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#properties-to-append" >}}) section for more information. |

##### **Event mapping settings**

| Setting | Description |
| :----| :-----|
| Use New Mapping | This option is turned off by default. However, RudderStack **recommends** turning it on as support for the current (old) mapping will be deprecated soon. <br /><br />When turned off, RudderStack sends the first name and last name to Mixpanel as:<br /><pre>$firstName: "John"<br />$lastName: "Keener"</pre><br />If you toggle on this option, RudderStack maps these fields to Mixpanel as:<br /><pre>$first_name : "John"<br />$last_name : "Keener"</pre><br />**Note**: RudderStack lets you pass empty and `null` values for the properties sent to Mixpanel. |

##### **Group key settings** {#group-settings-cloud-mode}

| Setting | Description |
| :----| :-----|
| Group Key Settings | RudderStack sends the `group` calls to Mixpanel only if one or more group keys are specified here. These group keys act as the group identifiers in Mixpanel. For more information, see [Group Key]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#group-key" >}}). |

##### **User deletion settings**

| Setting | Description |
| :----| :-----|
| User Deletion | Select the deletion API from the following options which RudderStack uses to [delete the user profile]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#deleting-a-user" >}}) in Mixpanel. <br /><br/><ul><li>**Delete Profile**: RudderStack deletes the user profile in Mixpanel but not the event data associated with it. For more information, see the [Mixpanel documentation](https://developer.mixpanel.com/reference/delete-profile).</li><li>**Delete Profile and Associated Events**: RudderStack deletes the user profile along with the associated data in Mixpanel. Note that it can take up to 60 days for the deletion to come into effect. For more information, see the [Mixpanel documentation](https://docs.mixpanel.com/docs/other-bits/privacy-and-security#create-a-deletion-task).</li><li>**GDPR API Token**: If you select **Delete Profile and Associated Events** for user deletion, enter the GDPR OAuth token. For more information on generating this token, see the [Mixpanel documentation](https://docs.mixpanel.com/docs/other-bits/privacy-and-security/export-or-delete-end-user-data#generate-oauth-token). </li></ul> |

##### **Consent settings**

| Setting | Description |
| :----| :-----|
| Consent management settings | Configure the consent management settings for the specified source by choosing the **Consent management provider** from the dropdown and entering the relevant consent category IDs. See [Consent Management in RudderStack]({{< ref "data-governance/consent-management/overview.md" >}}) for more information on this feature. |

##### **Other settings**

| Setting | Description |
| :----| :-----|
| Client-side Events Filtering | Filter events before sending them to Mixpanel. See the [Client-side Event Filtering]({{< ref "sources/event-streams/sdks/event-filtering.md" >}}) guide for more information. |

#### Web device mode

##### **Page settings**

| Setting | Description |
| :----| :-----|
| Use Custom Page Event Name | Toggle on this setting and specify the template for your `page` event names. RudderStack sets the event names for your `page` calls accordingly. <br /><br />For example, if you set the template as `Viewed {{category}} {{name}} page` and send the below `page` event payload:<br /><br /><pre>{<br />  "type": "page",<br />  "name": "Home",<br />  "properties": {<br />    "category": "Integration"<br />  }<br />}</pre> Then, RudderStack sends the `page` event name as `Viewed Integration Home Page` to Mixpanel. <br /><br />Note that:<br /><br /><ul><li>This setting is applicable for cloud mode and device mode.</li><li>You can skip the page category, name, or both while setting the template. For example, `Viewed {{category}} page`, `Viewed {{name}} page`, `Viewed a page` are all valid.</li><li>If you include the page category in the template, make sure to send it in the event's `properties` object.</li></ul> |

##### **Screen settings**

| Setting | Description |
| :----| :-----|
| Use Custom Screen Event Name | Toggle on this setting and specify the template for your `screen` event names. RudderStack sets the event names for your `screen` calls accordingly. <br /><br />For example, if you set the template as `Viewed {{category}} {{name}} screen` and send the below `screen` event payload:<br /><br /><pre>{<br />  "type": "page",<br />  "name": "Home",<br />  "properties": {<br />    "category": "Integration"<br />  }<br />}</pre> Then, RudderStack sends the `screen` event name as `Viewed Integration Home Page` to Mixpanel. <br /><br />Note that:<br /><br /><ul><li>This setting is applicable for cloud mode only.</li><li>You can skip the screen category, name, or both while setting the template. For example, `Viewed {{category}} screen`, `Viewed {{name}} screen`, and `Viewed a screen` are all valid.</li><li>If you include the screen category in the template, make sure to send it in the event's `properties` object.</li></ul> |

##### **Mixpanel configuration settings** {#mixpanel-config-device-mode}

| Setting | Description |
| :----| :-----|
| Properties to increment in People | See [Increment properties in Mixpanel People]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md#increment-properties-in-mixpanel-people" >}}) for more information. |

##### **Group key settings** {#group-settings-web-device-mode}

| Setting | Description |
| :----| :-----|
| Group Key Settings | RudderStack sends the `group` calls to Mixpanel only if one or more group keys are specified here. These group keys act as the group identifiers in Mixpanel. For more information, see [Group Key]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md#group-key" >}}). |

##### **Web SDK settings**

| Setting | Description |
| :----| :-----|
| Use Mixpanel People | Sends all your `identify` calls to Mixpanel People. See the [Mixpanel People]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md#mixpanel-people" >}}) section for more information. |
| Automatically set all Traits as Super Properties and People properties | When you turn on this setting, RudderStack sets all the `identify` traits as super properties and people properties if **Use Mixpanel People** setting is turned on. See [Setting People Properties and Super Properties]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md#setting-people-properties-and-super-properties" >}}) for more information. |
| Ignore "Do Not Track" | If turned on, the native Mixpanel SDK ignores the "Do Not Track" setting of your web browser. This setting is applicable when sending events in web device mode. <br /><br />The Mixpanel SDK cannot send events if `Send a 'Do Not Track' request with your browsing traffic` setting is turned on in the Chrome browser. |
| Track All Pages to Mixpanel with a Consolidated Event Name | This setting is turned on by default and tracks the `Loaded a Page` events to Mixpanel for all `page` method calls. <br /><br />**Note**: Do not turn off this setting as Mixpanel recommends using it to send your events. |
| Track Categorized Pages to Mixpanel | Turn on this setting to track events for `page` calls that have an associated category. <br /><br />For example, a `page` call like `rudderanalytics.page("Docs", "Index")` results in RudderStack sending the event `Viewed Docs Index Page` to Mixpanel. |
| Track Named Pages to Mixpanel | Turn on this setting to track events for `page` calls that have an associated name. <br /><br />For example, a `page` call like `rudderanalytics.page("Signup")` results in RudderStack sending the event `Viewed Signup Page` to Mixpanel. |
| Source Name | If specified, RudderStack sends this source name to Mixpanel for every event/`page`/`screen` call. |
| Cross Subdomain Cookie | Lets you persist the Mixpanel cookie between different pages of your application. | 
| Persistence Type | Lets you choose the persistence storage method for your Mixpanel cookies. RudderStack provides the following options:<br /><br/><ul><li>**None**: Mixpanel will not persist the cookie.</li><li>**Cookie**: Mixpanel persists the cookie in the browser's cookie storage.</li><li>**Local Storage**: Mixpanel persists the cookie in local storage.</li></ul> |
| Persistence Name | Specify a name for the Mixpanel cookie. RudderStack adds it as a suffix for the Mixpanel cookie name. | 
| Secure Cookie | Turn on this option to mark the Mixpanel cookie as secure, that is, it will only transmit over HTTPS. |
| Properties to send as Super Properties | Specify the event properties that RudderStack sets as Super Properties in Mixpanel. |
| Properties to set only once  | Specify the `identify` traits as Mixpanel properties whose values you do not want to change at the user profile level. Once specified, Mixpanel will **not** overwrite these fields with new values later. <br /><br />See [Properties to set only once]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md#properties-to-set-only-once" >}}) section for more information. | 
| Traits to set as People Properties | Specify the `identify` traits that RudderStack sets as People Properties in Mixpanel. |
| Events to increment in People | See [Incrementing events in Mixpanel People]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md#increment-events-in-mixpanel-people" >}}) for more information. |
| Percentage of SDK Initializations that qualify for Replay Data Capture |  Specify the percentage of events (0-100) that Mixpanel considers for session replay. If you do not specify any value, RudderStack sets this field to `0` by default, meaning Mixpanel **does not** consider any events for session replay. <br /><br />See [Events sent for session replay]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md#session-replay" >}}) for more information on using this setting. | 

##### **Consent settings**

| Setting | Description |
| :----| :-----|
| Consent management settings | Configure the consent management settings for the specified source by choosing the **Consent management provider** from the dropdown and entering the relevant consent category IDs. See [Consent Management in RudderStack]({{< ref "data-governance/consent-management/overview.md" >}}) for more information on this feature. |

##### **Other settings**

| Setting | Description |
| :----| :-----|
| Client-side Events Filtering | Filter events before sending them to Mixpanel. See the [Client-side Event Filtering]({{< ref "sources/event-streams/sdks/event-filtering.md" >}}) guide for more information. |

## Next steps

- [Send events to Mixpanel in cloud mode]({{< ref "destinations/streaming-destinations/mixpanel/cloud-mode.md" >}})
- [Send events to Mixpanel in device mode]({{< ref "destinations/streaming-destinations/mixpanel/device-mode.md" >}})

<br />
