> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mixpanel

> Import Mixpanel cohorts into MoEngage for targeted campaigns and stream MoEngage campaign events back to Mixpanel for deeper analytics.

## Introduction

[Mixpanel](https://mixpanel.com/) makes analytics self-serve for your product teams and enables everyone to answer questions around user conversion, retention, and activation.

## Scope

The MoEngage and Mixpanel integration allow you to import Mixpanel Cohorts into MoEngage to create segments that can be used to target users in future campaigns. You can also leverage MoEngage streams to export your campaign events to Mixpanel to drive deeper analytics into conversions, retention, and product usage.

## Benefits and Use Cases

Analyze your users in Mixpanel and engage with them using MoEngage.

The following use-cases provide integration value addition to your analytics + user engagement activities:

### E-commerce

Understand the seasonal changes in purchase trends that are happening and send rich push notifications to such users via MoEngage. For example, target the cohort of users who purchase high-value items during summers and send rich push notifications with similar recommended items.

### Travel

You can create a cohort in Mixpanel of millennial users who are also premium users of your app and send them popular and unique holiday destination recommendations via MoEngage emails.

### E-learning

Understand where your users are dropping off while watching a video series on your platform and bring them back with engaging campaigns! Through insights into user behavior, you are armed with a holistic picture of exactly what actions can trigger a user to return to the app.

## Integration

<Info>
  **Prerequisites**

  Ensure you have login credentials for MoEngage and Mixpanel.
</Info>

The Mixpanel Integration with MoEngage consists of two parts:

### Cohort Sync from Mixpanel to MoEngage

Mixpanel to MoEngage integration allows you to export cohorts in Mixpanel to MoEngage and send personalized campaigns to all the users under this cohort from MoEngage.

### Streaming MoEngage Events to Mixpanel

MoEngage to Mixpanel integration allows you to export the campaign interaction events generated after your users engage with the MoEngage campaigns to Mixpanel.

## Setting up MoEngage integration on Mixpanel

To setup MoEngage Integration on Mixpanel, follow the below steps:

1. Log in to Mixpanel and navigate to **Data Management** > **Integrations**.

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418346033812.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=cc26d2e1ff98ffea42fd1577a051d104" alt="Mixpanel Data Management Integrations menu" width="1440" height="522" data-path="images/partner_4418346033812.png" />
2. On the Integrations page, search MoEngage and click on the **CONNECT** button. You will see a pop-up to enter the MoEngage credentials as described:

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418355207444.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=509ebaaa721c4ebf10f010d16641c24c" alt="Mixpanel MoEngage integration connect popup" width="1050" height="1124" data-path="images/partner_4418355207444.png" />
3. Fill the following fields from the MoEngage dashboard by navigating to **Settings** > **Account** > **API Settings**:

   | Field                   | Action                                                                                                                                                                                                                                                          |
   | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | **USERNAME**            | Type or copy and paste the Data API ID. The Data API ID and the Workspace ID of your MoEngage account are the same.                                                                                                                                             |
   | **PASSWORD**            | Type or copy and paste the Data API Key. The Data API key of your MoEngage account is available in the following navigation: **Settings** > **Account** > **APIs** > **API keys** > **Data** API settings.                                                      |
   | **MOE-APPKEY**          | Type or copy and paste the Workspace ID. The Workspace ID of your MoEngage account is available in the following navigation: **Settings** > **Account** > **APIs** > **Workspace ID**.                                                                          |
   | **MOENGAGE DATACENTER** | MoEngage data center that you signed with you on MoEngage. For more information about the data center that you signed up with, please refer to [Data centers in MoEngage](https://www.moengage.com/docs/user-guide/data/key-concepts/data-centers-in-moengage). |

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418364492180.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=a6a4537a8a7a1fe1638e1e6dd2061f98" alt="MoEngage General Settings page showing the Workspace ID and API keys" width="1578" height="370" data-path="images/partner_4418364492180.png" />
4. Click save on continue to connect MoEngage as an integration.

For more information, refer to [Mixpanel - MoEngage Integration](https://help.mixpanel.com/hc/en-us/articles/360049332572-MoEngage-Integration).

## Exporting Cohorts from Mixpanel to MoEngage

<Note>
  Ensure your cohort name starts with a period (.) and must not contain the following restricted characters: `|`, `*`, `?`, `\`, `:`, `<`, `>`, `=`, `$`, `"`.
</Note>

To export specific cohorts from Mixpanel to MoEngage, follow these steps:

1. Navigate to the cohorts page on Mixpanel dashboard.

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418355207060.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=93ed44224315fb088c7ef4b673b27089" alt="Mixpanel cohorts page showing the cohort list" width="1437" height="267" data-path="images/partner_4418355207060.png" />
2. Click on the three dots menu on the right-hand side of any cohort and use the **Export to** option to export the particular cohort to MoEngage.

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418346033172.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=bf84c52e08f02be73d91db99b8e9774e" alt="Mixpanel cohort Export to option" width="1440" height="631" data-path="images/partner_4418346033172.png" />

   A pop-up is displayed.
3. In the **Export to MoEngage** pop-up, select one of the following:

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418364490772.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=04bc35bc9f5fff78165fa4dfdbea0b44" alt="Export to MoEngage popup with sync options" width="1046" height="908" data-path="images/partner_4418364490772.png" />

   | Selection           | Description                                                                                                                                                                                         |
   | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | **One-time export** | Only export the users under the cohort to MoEngage once and the cohort will not sync thereafter.                                                                                                    |
   | **Dynamic sync**    | Ensure that the updated information of the cohorts like the new users who qualify for this cohort and the existing users who are removed from the cohort are sent to MoEngage every **15 minutes**. |
4. Click **Begin Sync** to export.
5. Check the export status after you export the cohort as described.

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418346032660.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=3290193b127fd37aa2a4b3edfe738c73" alt="Mixpanel cohort export status" width="522" height="378" data-path="images/partner_4418346032660.png" />

### Using Cohorts in MoEngage Campaigns

Once an export is complete, you will be able to see the cohort as a custom segment in MoEngage as in the following image:

<img src="https://mintcdn.com/moengage/7iGV38YjgdBKSU0B/images/partner_23582841735316.png?fit=max&auto=format&n=7iGV38YjgdBKSU0B&q=85&s=dd14c05613f41136b0e91751f029cdf2" alt="Mixpanel cohort as a custom segment in MoEngage" width="2664" height="634" data-path="images/partner_23582841735316.png" />

The custom segment can be used in any MoEngage campaigns to send personalized messages to the users under this segment.

### User Mapping between Mixpanel and MoEngage

When you are exporting cohorts from Mixpanel to MoEngage, all users in your Mixpanel cohort will be attempted to be mapped with unique user profiles in MoEngage. We will be relying on a unique user identifier that will be present across Mixpanel and MoEngage users for mapping. This identifier will also be used when sending campaign events from MoEngage to Mixpanel.

You need to ensure that you are adding an alias for your Mixpanel `distinct_id` and that the same identifier is used as ID (unique user id) in MoEngage.

For more information on tracking unique user id in MoEngage, refer to:

* [Android](https://www.moengage.com/docs/developer-guide/android-sdk/data-tracking/basic/track-user-attributes)
* [iOS](https://www.moengage.com/docs/developer-guide/ios-sdk/data-tracking/basic/tracking-user-attributes)

<Warning>
  Users in your Mixpanel cohort attempted to map with unique user profiles in MoEngage. If MoEngage systems do not have that user profile, the user is not mapped and not added to the cohort/segment.

  In this scenario, you may find fewer users in the MoEngage cohort compared to the Mixpanel cohort. Make sure you have all users in MoEngage before you perform the cohort sync.
</Warning>

## Exporting Campaign Data from MoEngage to Mixpanel

<Info>
  **Prerequisites**

  Exports to Mixpanel makes use of MoEngage Streams, which is an add-on.
</Info>

On your MoEngage Dashboard, go to the App Marketplace and search for Mixpanel.

1. Click on **+ Add Integration** to add a new integration.
2. Fill out the form.

   <img src="https://mintcdn.com/moengage/W4UIG2ZYu1ajYKNS/images/partner_13908623574932.png?fit=max&auto=format&n=W4UIG2ZYu1ajYKNS&q=85&s=4000fcfe4329cd50990ad948d8eee427" alt="Mixpanel integration in the MoEngage App Marketplace" width="2880" height="1416" data-path="images/partner_13908623574932.png" />
3. Mixpanel project token - This is available on your Mixpanel Dashboard > **Settings** > **Overview** > **Access Keys** > **Project Token** as shown below:

   <img src="https://mintcdn.com/moengage/11KR3mwxT6FlowrU/images/partner_4418364489364.png?fit=max&auto=format&n=11KR3mwxT6FlowrU&q=85&s=bf9b7911c899af057c3fee104098049d" alt="Mixpanel project settings showing Project Token" width="2880" height="632" data-path="images/partner_4418364489364.png" />
4. Select the events you want to forward. By default, MoEngage will be sending the data points mentioned in the next section to Mixpanel.
5. Click on **Connect** to save the integration.

All the events sent by MoEngage are displayed in Mixpanel by filtering basis `$source = MOENGAGE`. These events are sent to Mixpanel in near real-time and use the Mixpanel `distinct_id` for mapping user profiles between MoEngage and Mixpanel.

<Info>
  Ensure that you are setting the `mixpanel_distinct_id` as the unique user id in MoEngage.
</Info>

### Export Data

The following data points are by default sent to Mixpanel:

| Event Name                                      | Event Code                                       | Type (for reference only) | Channel             | Description                                                                                                                          |
| ----------------------------------------------- | ------------------------------------------------ | ------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| Card Sent                                       | `n_c_s`                                          | Delivery                  | Cards               | Tracked when a Card notification is sent to the user, doesn't indicate if the notification is delivered to the App Inbox             |
| Card Delivered                                  | `MOE_CARD_CAMPAIGN_DELIVERED`                    | Delivery                  | Cards               | Tracked when a Card is delivered to the App Inbox after the user has opened the Inbox                                                |
| Card Viewed                                     | `MOE_CARD_CAMPAIGN_VIEWED`                       | Delivery                  | Cards               | Tracked when the user views a Card or scrolls down to it in the App Inbox                                                            |
| Card Clicked                                    | `MOE_CARD_CAMPAIGN_CLICKED`                      | Interaction               | Cards               | Tracked when the user clicks the Card in the App Inbox                                                                               |
| Connector Sent                                  | `MOE_CONNECTOR_SENT`                             | Delivery                  | Connector           | Tracked when a connector was sent successfully.                                                                                      |
| Email Sent                                      | `MOE_EMAIL_SENT`                                 | Delivery                  | Email               | Tracked when our system sends an email to a user.                                                                                    |
| Email Deferred                                  | `MOE_EMAIL_DEFERRED`                             | Delivery                  | Email               | Tracked when the receiving server is unable to accept your request, email sending will be re-tried in this case                      |
| Email Delivered                                 | `MOE_EMAIL_DELIVERED`                            | Delivery                  | Email               | Tracked when an email is delivered in an inbox                                                                                       |
| Email Dropped                                   | `MOE_EMAIL_DROP`                                 | Delivery                  | Email               | Tracked when an email is dropped. Email is dropped when it's part of the bounce list, the unsubscribe list, or the spam report list. |
| Email Bounced                                   | `MOE_EMAIL_HARD_BOUNCE`                          | Delivery                  | Email               | Tracked when our system finds an email is hard bounced. Typically happens when the email address doesn't exist.                      |
| Email Soft Bounced                              | `MOE_EMAIL_SOFT_BOUNCE`                          | Delivery                  | Email               | Tracked when our system finds an email is soft bounced. Typically happens when there is a temporary delivery issue.                  |
| Email Opened                                    | `MOE_EMAIL_OPEN`                                 | Interaction               | Email               | Tracked when a user opens an email.                                                                                                  |
| Email Clicked                                   | `MOE_EMAIL_CLICK`                                | Interaction               | Email               | Tracked when a user clicks on any link in the email.                                                                                 |
| Email Unsubscribed                              | `MOE_EMAIL_UNSUBSCRIBE`                          | Interaction               | Email               | Tracked when a user unsubscribes from receiving emails.                                                                              |
| Email Spam Complained                           | `MOE_EMAIL_SPAM`                                 | Interaction               | Email               | Tracked when a user marks the email as spam.                                                                                         |
| In-App Shown Android                            | `IN_APP_SHOWN`                                   | Interaction               | In-App              | Tracked when an In-App message is shown to the user on Android device.                                                               |
| In-App Clicked Android                          | `IN_APP_CLICKED`                                 | Interaction               | In-App              | Tracked when a user clicks In-App message on Android device.                                                                         |
| In-App Closed Android                           | `IN_APP_CLOSE_CLICKED`                           | Interaction               | In-App              | Tracked when a user dismisses In-App message by clicking on close button on Android device.                                          |
| In-App Shown iOS                                | `iOS_IN_APP_SHOWN`                               | Interaction               | In-App              | Tracked when an In-App message is shown to the user on iOS device.                                                                   |
| In-App Clicked iOS                              | `iOS_IN_APP_CLICKED`                             | Interaction               | In-App              | Tracked when a user clicks In-App message on iOS device.                                                                             |
| In-App Closed iOS                               | `iOS_IN_APP_CLOSE_CLICKED`                       | Interaction               | In-App              | Tracked when a user dismisses In-App message by clicking on close button on iOS device.                                              |
| Mobile In-App Shown                             | `MOE_IN_APP_SHOWN`                               | Interaction               | In-App V3           | Tracked when a user is shown an in-app version 3 campaign                                                                            |
| Mobile In-App Clicked                           | `MOE_IN_APP_CLICKED`                             | Interaction               | In-App V3           | Tracked when a user clicks an in-app version 3 campaign                                                                              |
| Mobile In-App Dismissed                         | `MOE_IN_APP_DISMISSED`                           | Interaction               | In-App V3           | Tracked when a user closes an in-app version 3 campaign                                                                              |
| Notification Received Android                   | `NOTIFICATION_RECEIVED_MOE`                      | Delivery                  | Push                | Tracked when a user receives a notification on an Android device.                                                                    |
| Notification Clicked Android                    | `NOTIFICATION_CLICKED_MOE`                       | Interaction               | Push                | Tracked when a user clicks notification on an Android device.                                                                        |
| Notification Sent iOS                           | `n_i_s`                                          | Delivery                  | Push                | Tracked when a user receives a notification on an iOS device.                                                                        |
| Notification Received iOS                       | `NOTIFICATION_RECEIVED_IOS_MOE`                  | Delivery                  | Push                | Tracked when App in foreground and user receives the notification on iOS.                                                            |
| Notification Clicked iOS                        | `NOTIFICATION_CLICKED_IOS_MOE`                   | Interaction               | Push                | Tracked when a user clicks notification on an iOS device.                                                                            |
| Notification Received Web                       | `NOTIFICATION_RECEIVED_WEB_MOE`                  | Delivery                  | Push                | Tracked when a user receives a notification on a browser.                                                                            |
| Notification Clicked Web                        | `NOTIFICATION_CLICKED_WEB_MOE`                   | Interaction               | Push                | Tracked when a user clicks notification on the browser.                                                                              |
| On-site Message Shown                           | `MOE_ONSITE_MESSAGE_SHOWN`                       | Interaction               | On-site             | Tracked when an on-site messaging campaign is shown to a user                                                                        |
| On-site Message Clicked                         | `MOE_ONSITE_MESSAGE_CLICKED`                     | Interaction               | On-site             | Tracked when an on-site messaging campaign is clicked by a user                                                                      |
| On-site Message Closed                          | `MOE_ONSITE_MESSAGE_CLOSED`                      | Interaction               | On-site             | Tracked when an on-site messaging campaign is closed by a user                                                                       |
| Web Personalization Message Shown               | `MOE_WEBP_MESSAGE_SHOWN`                         | Interaction               | Web Personalization | Tracked when a web personalization campaign is shown to a user                                                                       |
| Web Personalization Message Clicked             | `MOE_WEBP_MESSAGE_CLICKED`                       | Interaction               | Web Personalization | Tracked when a web personalization campaign is clicked by a user                                                                     |
| Web Personalization Message Closed              | `MOE_WEBP_MESSAGE_CLOSED`                        | Interaction               | Web Personalization | Tracked when a web personalization campaign is closed by a user                                                                      |
| SMS Sent                                        | `SMS_SENT`                                       | Delivery                  | SMS                 | Tracked when our system sends SMS to a user.                                                                                         |
| SMS Delivered                                   | `SMS_DELIVERED`                                  | Delivery                  | SMS                 | Tracked when our system receives a delivery receipt for the SMS sent to a user.                                                      |
| User Entered Flow                               | `USER_ENTERED_FLOW`                              | Delivery                  | Flows               | Tracked when a user falls in the target audience and has qualified for entry in the Flow.                                            |
| User Exited Flow                                | `USER_EXITED_FLOW`                               | Delivery                  | Flows               | Tracked when a user exits from a Stop Cell of the Flow.                                                                              |
| User Added To Control Group                     | `MOE_CAMPAIGN_CONTROL_GROUP`                     | Delivery                  | All Campaigns       | Tracked when a user is added to a control group                                                                                      |
| User Removed From Control Group                 | `MOE_USER_REMOVED_FROM_CONTROL_GROUP`            | Delivery                  | All Campaigns       | Tracked when a user is removed from a control group                                                                                  |
| User Removed From Campaign Due to Control Group | `MOE_CAMPAIGN_USER_REMOVED_DUE_TO_CONTROL_GROUP` | Delivery                  | All Campaigns       | Tracked when a user is removed from a campaign due to the user being a part of the control group                                     |

<Warning>
  **Points to remember for events sent to Mixpanel**

  * All events sent to Mixpanel have UID by default. This captures the value of the ID which is present in a unique user profile in MoEngage. This is also used to match a user in Mixpanel basis the value of the `mixpanel_distinct_id`.
  * All campaign events have `campaign_id`, `campaign_name`, `campaign_type`, `campaign_channel` by default.
  * All email campaign events have email\_id as `moe_email_id` by default.
  * All push campaign events have push\_id as `moe_push_id` by default.
  * All SMS campaign events have a mobile number as `moe_mobile_number` by default.
  * All campaign events of the campaign are a part of MoEngage Flows have two additional attributes `parent_flow_id` and `parent_flow_name` are present.
  * All campaigns having multiple variations or locales have the following additional attributes:
    * `variation_id`
    * `locale_id`
    * `locale_name`
  * All events have `moengage_user_id` by default. This is a MoEngage internal user identifier and is populated with each event in MoEngage.
  * All events generated from the mobile app contain a `moengage_device_id`, which is a MoEngage internal identifier.
</Warning>

## Troubleshooting

### The user count for the segment is 0?

Please check if the custom segment name is "All users". All users is reserved for MoEngage and cannot be used as the custom segment name.

### The segment is not showing up on MoEngage dashboard?

Please check archived segments on MoEngage. You can check your [archived segments here](https://dashboard-01.moengage.com/v3/#/segmentation/archived-segments). Please unarchive your segment and then retry.

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="How soon will I start getting the data?">
    It typically takes up to 30 minutes for the automated data exports to be set up for your account and for you to start seeing data there.
  </Accordion>

  <Accordion title="Can I export additional events at a later time?">
    Yes, if you need to export new events at a later time, you can always edit your configuration on the App Marketplace and get the new events added to your exports.
  </Accordion>

  <Accordion title="Can I export historical data using Automated Data Exports?">
    As of now, you cannot export historical data using Automated Data Exports. Once configured, you will start seeing data for each event from the time you enabled your exports.
  </Accordion>

  <Accordion title="Is there any pricing involved for Automated Data Exports?">
    If your billing plan does not cover this already and you need to get this enabled at a later time, you would need to work with your Customer Success Manager to get this included in your billing plan. Based on the amount of data that MoEngage will place in your Data warehouse/Partner/API on a monthly basis, this could lead to additional charges.
  </Accordion>
</AccordionGroup>
