# Mixpanel (Message Metrics)

## How it works[](#how-it-works)

This integration sends audience engagement data—also available as [reporting webhooks](/integrations/api/webhooks/)—to Mixpanel, where you can use it alongside your other user and analytics data to gain insight into your audience’s behaviors.

The events we send are both based on things that happen in Customer.io and your customer activity. For example, an `email sent` event indicates that we’ve sent an email to a person, but an `email clicked` event lets you know that your audience clicked a link in your email.

## Enable the Mixpanel integration[](#setup-Mixpanel)

As a part of this process, you’ll need your Mixpanel project token.

1.  Go to **Data & Integrations** > **Integrations** and select the Mixpanel integration card.
    
    [![find and enable the Mixpanel integration](https://docs.customer.io/images/mixpanel-card.png)](#81a3fd368385a21bf24a327bd7f764a2-lightbox)
    
2.  Copy and paste your Mixpanel project token into the *Project Token* field. You’ll [find your key in Mixpanel](https://help.mixpanel.com/hc/en-us/articles/115004490503-Project-Settings#accessing-project-settings) **Settings** > **Project Settings**.
    
3.  (Optional) If your account is in Mixpanel’s EU data centre, enable the *Use EU Data Residency* setting.
    
4.  Select the events that you want to send to Mixpanel. We describe each event on the page. Check out our [reporting webhooks documentation](/integrations/api/webhooks/) for more information about the data available to each event.
    
5.  (Optional) Enable *Body Content* to capture the first 255 characters of messages in *Sent* events. This is a Mixpanel limitation. You can still lookup deliveries in Customer.io to see the full contents of sent messages.
    
6.  Click **Save**.
    
    [![select your events and click save](https://docs.customer.io/images/Mixpanel-setup.png)](#a786f1b6eaef9b2196ca9f6591749d2a-lightbox)
    

## Test your integration[](#test-your-integration)

When you add your project token and set up your integration, you can click **Test Connection** to make sure that your key is valid and connects to the correct project in Mixpanel.

The test sends an `email sent` event to Mixpanel to ensure that your API key is valid. You can check your Mixpanel project for this `email sent` event to make sure that you set up your integration for the Mixpanel project you want to send Customer.io data to.

## Payload reference[](#payload-reference)

In this integration, we map our [reporting webhook payloads](/integrations/api/webhooks/) to fit [Mixpanel’s `track` format](https://developer.mixpanel.com/reference/track-event). Below is a list of fields from our reporting webhooks and how we map them to Mixpanel. We’ve also provided examples of both kinds of events.

 Check *Message* to find the `campaign_id` in Mixpanel

In Mixpanel, `campaign_id` is a reserved property. If you look at an event for a message sent as a part of campaign in Mixpanel, the *Message* field under *All Properties* represents the `campaign_id`. If you switch to JSON mode, you’ll also see the `campaign_id`.

Mixpanel Field

Customer.io Field

Description

`event`

`object_type` + `metric`

Represents the channel and metric. We capitalize/camel-case these items, e.g. `Email Sent`

`properties.distinct_id`

`identifiers.id`

If a person doesn’t have an `id`, this property is blank.

`properties.profile_email`

`identifiers.email`

If a person doesn’t have an email, this property is blank

`properties.devices`

`"id": recipient.device_id`  
`"platform": recipient.device_platform`

An array of objects, where each object represents a device.

`properties.$insert_id`

`event_id`

The unique identifier for the event, used to deduplicate events in Mixpanel.

`properties.time`

`timestamp`

The date-time when the event occurred, *not* necessarily when the event is sent to Mixpanel.

`properties.account_id`

`[account_id]`

While your `account_id` isn’t in our standard reporting webhook payload, we send this to Mixpanel to support their [Group Analytics](https://help.mixpanel.com/hc/en-us/articles/360025333632-Group-Analytics) add on.

`properties.workspace_id`

`[workspace_id]`

While your `workspace_id` isn’t in our standard reporting webhook payload, we send this to Mixpanel to support their [Group Analytics](https://help.mixpanel.com/hc/en-us/articles/360025333632-Group-Analytics) add on.

`properties`

The remaining fields in the webhook payload

 Mixpanel payload

#### Mixpanel payload[](#Mixpanel payload)

```json
{
  "event": "Sms Sent",
  "properties": {
    "time": 1668976965,
    "distinct_id": "346300",
    "$insert_id": "01GJBCEYDJMH4VCDKXC98JNQ2D",
    "account_id": [1],
    "action_id": 1000495,
    "campaign_id": 1000024,
    "content": "Hey jenny! I got your number!",
    "customer_id": "346300",
    "delivery_id": "dgSiuAMAAK2_Fqu_FgGElsdx39aGHalAkXrIOwc=",
    "headers": {},
    "journey_id": "01GJ3N8GM0AK1FJB1WFNCN2N7C",
    "recipient": "+15558675309",
    "workspace_id": [56354]
  }
}
```

 Customer.io payload

#### Customer.io payload[](#Customer.io payload)

```json
{
  "event_id": "01GJBCEYDJMH4VCDKXC98JNQ2D",
  "object_type": "sms",
  "timestamp": 1668976965,
  "metric": "sent",
  "data": {
    "trigger_id": 1,
    "customer_id": "346300",
    "delivery_id": "dgSiuAMAAK2_Fqu_FgGElsdx39aGHalAkXrIOwc=",
    "action_id": 1000495,
    "campaign_id": 1000024,
    "journey_id": "01GJ3N8GM0AK1FJB1WFNCN2N7C",
    "identifiers": {
      "id": "346300",
      "email": "cool.person@example.com",
      "cio_id": "d9c106000001"
    },
    "content": "Hey Jenny! I got your number!",
    "recipient": "+15558675309"
  }
}
```