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

# Salesforce Marketing Cloud

## Overview

This integration lets you export cohorts from Mixpanel to Salesforce Marketing Cloud (SFMC).

Once the one-time setup process is done, it's easy to sync cohorts on a recurring basis entirely from the Mixpanel UI.

## Permissions

You must be a Mixpanel project admin to enable the SFMC integration.

## Enable the Integration

This process will require setup on both SFMC and Mixpanel.

### SFMC Setup

1. Navigate to **Setup → Apps → Installed packages**. Then create a package with with a Scope that provides **read/write access to DataExtensions**. Keep track of the following information (highlighted above) -- it will be useful to connect Mixpanel to SFMC:

* **Client Id**
* **Client Secret**
* **Subdomain**

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc1.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=a39578fcf2a6a83f0c25e675914023f5" alt="SFMC 1 Image" width="1600" height="797" data-path="images/sfmc1.png" />
</Frame>

2. Navigate to **Audience Builder → Contact Builder → Data Extensions** to Create a New Data Extension.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc2.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=a830fff969bd499cd6b74a998856c3ee" alt="SFMC 2 Image" width="1697" height="759" data-path="images/sfmc2.png" />
</Frame>

3. Create a new **Data Extension** with a primary key of the name **SubscriberKey**. The key type for most use-cases will stay as **Text** and size of 250 characters unless you are selecting email or phone number as the id in which you can find corresponding data types. This field will contain ids that map to the unique user property in Mixpanel.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc3.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=ec8eb503cd3b8e1eacf216d1d3b7125f" alt="SFMC 3 Image" width="910" height="682" data-path="images/sfmc3.png" />
</Frame>

4. Note the **External Key** (underlined below) for setup on Mixpanel.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc4.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=73133197e079f0dbbdf1a184292c47e5" alt="SFMC 4 Image" width="1600" height="714" data-path="images/sfmc4.png" />
</Frame>

### Mixpanel Setup

1. Navigate to **Settings** in the bottom left, then select **Integrations**.

2. Look for Salesforce Marketing Cloud in the Integrations list and click **Connect**. The following details are needed:

* **Data Extension External Key**
* An optional user property (distinct\_id will be used by default). This will sync to the SubscriberKey field
* **client\_id**, **client\_secret**, **subdomain**

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc6.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=dc5608bf902e62cf7979cd9b1f5b2898" alt="SFMC 6 Image" width="397" height="538" data-path="images/sfmc6.png" />
</Frame>

3. The SFMC integration will show a **Connected** tag in the UI once the connection succeeds.

## Matching Users between SFMC and Mixpanel

You can select any user property to sync to SFMC as the subscriber key. Once the user ID is set you cannot change it later as this can cause corruption in the Data Extension. If you absolutely need to change this field, you should recreate the Data Extension.

User profiles without the above selected user property will **not** export to SFMC - it is a requirement for user matching.

## Export a Cohort

To export a cohort from Mixpanel to SFMC:

1. Navigate to **Lexicon**, then select the **Cohorts** tab to view all of your cohorts.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc7.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=33e86a71804b75f7eb601e0d57b4b8c5" alt="SFMC 7 Image" width="449" height="571" data-path="images/sfmc7.png" />
</Frame>

2. Select the cohort that you want to export. Click on the three-dot icon on the right side of the cohort.

3. Click Export to > SFMC. Select either one-time sync or dynamic sync. Click **Start Sync**.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc8.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=69936a52f051306b17f00b48eee39864" alt="SFMC 8 Image" width="1736" height="723" data-path="images/sfmc8.png" />
</Frame>

## Sync Types

This integration supports two types of exports: one-time export and dynamic sync.

### One-Time Export

In a one-time export, Mixpanel sends SFMC a static export of users who currently qualify for the cohort. The cohort data will not be updated in SFMC after a one-time export.

### Dynamic Sync

In dynamic sync, Mixpanel initiates sync between a cohort and SFMC every 15 minutes. The exported cohort will be updated every 15 minutes to reflect the most recent list of users in a cohort.

## Data Extension in SFMC

The cohort data will be exported to the SFMC Data Extension that was set up above. New cohorts are added as property fields to the data extension.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc9.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=3ecb285e1679fb953ed4d00c6ca8bf55" alt="SFMC 9 Image" width="1600" height="714" data-path="images/sfmc9.png" />
</Frame>

Each record in the Data Extension is a user and its properties show the membership of this user in different cohorts.

<Frame>
  <img src="https://mintcdn.com/mixpanel-edb78807/DIkgC-SC6Iuq2x0l/images/sfmc10.png?fit=max&auto=format&n=DIkgC-SC6Iuq2x0l&q=85&s=1d4b90c7f0004f906b78c44829e2ad26" alt="SFMC 10 Image" width="1680" height="670" data-path="images/sfmc10.png" />
</Frame>
