
## How the Mixpanel integration works

The [Mixpanel](https://mixpanel.com/) integration has two functions.

* Incoming: Statsig can sync your Mixpanel user cohorts with a Statsig ID list segment.
* Outgoing: Statsig can forward Statsig events to Mixpanel.

## Cohort syncing

{% callout type="note" %}
Ingestion with this integration is available only for Statsig Cloud. For Warehouse Native, create a metrics source that references this data in your warehouse.
{% /callout %}

Statsig can ingest user information through [Mixpanel Cohort Syncing](https://developer.mixpanel.com/docs/cohort-webhooks)

1. On Statsig, navigate to [Segments](https://console.statsig.com/segments) on the left navigation menu and create a segment.

* **Name**: Must match the name of your Mixpanel cohort.
* **Type of segment**: Should be ID List.

{% figure %}
![statsig-segment-config](/images/integrations/data-connectors/mixpanel/id_list_segments.png)
{% /figure %}

2. On Mixpanel, click on the Data Management navbar item and choose Integrations from
   the dropdown.

{% figure %}
![mixpanel-integration-menu](/images/integrations/data-connectors/mixpanel/195173611-170f02df-543f-4198-8589-7db313f4dd9f.png)
{% /figure %}

3. In the list of integrations, scroll until you find Custom Webhook and then
   select it.

{% figure %}
![mixpanel-custom-webhook](/images/integrations/data-connectors/mixpanel/195173845-73ac1d5b-94b4-4daf-bf36-102eabd5d1fe.png)
{% /figure %}

4. In the dialog that appears, paste the url below, substituting the
   SERVER\_SECRET\_KEY with a "Server Secret Key" found in [Project Settings](https://console.statsig.com/api_keys), then click Continue.

```
https://api.statsig.com/v1/webhooks/mixpanel?statsig-api-key=SERVER_SECRET_KEY
```

{% figure %}
![custom-webhook-dialog](/images/integrations/data-connectors/mixpanel/195174446-d3e8078c-ebaf-4ed4-bb5b-f8195694bade.png)
{% /figure %}

5. Click "Enable" (or "Confirm" if you are updating the integration).

6. You can now start a cohort sync job on Mixpanel from the Cohorts page.

## Configuring outbound events

To export your Statsig events to Mixpanel:

1. Get a copy of your "Project Token" from Mixpanel by following this [guide](https://help.mixpanel.com/hc/en-us/articles/115004502806-Find-Project-Token-).

2. Paste your project token into the Outgoing configuration on the Statsig integration panel.

3. Select your **Data Residency Region** based on your Mixpanel project's data residency configuration:
   * **US** (default): Events are sent to the global `api.mixpanel.com` endpoint
   * **EU**: For projects using [EU data residency](https://docs.mixpanel.com/docs/privacy/eu-residency)
   * **India**: For projects using [India data residency](https://docs.mixpanel.com/docs/privacy/in-residency)

4. Click "Enable" (or "Confirm" if you are updating the integration).

   {% figure %}
   ![mixpanel-outgoing-configuration](/images/integrations/data-connectors/mixpanel/mixpanel-outgoing-data-residency.png)
   {% /figure %}

5. Verify Statsig is forwarding your events by visiting the Events tab on Mixpanel.

   {% figure %}
   ![mixpanel-event-tab](/images/integrations/data-connectors/mixpanel/195172678-8ff14bfe-6400-4660-b1dd-fef1780ddcd5.png)
   {% /figure %}

### Filtering events

You can customize which events are sent to Mixpanel using [Event Filtering](/integrations/event_filtering#outgoing-event-filtering).
