# Mixpanel

Mixpanel is a real-time analytics platform that helps companies measure and optimize user engagement.

For more information about the API, see the [Mixpanel Query API](https://developer.mixpanel.com/reference/query-api) and [Event Export API](https://developer.mixpanel.com/reference/raw-data-export-api).

See the [Schema](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#Schema) section for a list of objects available for replication.

## Mixpanel integration summary

## Preparing for authentication

To access your data, you need to authenticate the connection with your account credentials.

Information noteMake sure that the account you use has read access to the tables you want to fetch.

To obtain the project timezone and API secret:

1. Make sure you have the Admin privileges in Mixpanel. You need them to access the API secret.
2. Log into your Mixpanel account.
3. In the dropdown menu in the upper left corner of the page, select the project you want to replicate data from.
4. Hover over the Settings icon in the upper right corner. In the Project Settings section, click the name of your project.
5. Copy the Project Timezone and API Secret.

## Creating the connection

For more information, see [Connecting to SaaS applications](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/Landing/connecting-web-applications.htm).

1. Fill in the required connection properties.

2. Provide a name for the connection in Connection name.

3. Select Open connection metadata to define metadata for the connection when it has been created.

4. Click Create.

Connection settings

| Setting | Description |
| --- | --- |
| Data gateway | Select a Data Movement gateway if required by your use case.<br><br>Information note<br><br>This field is not available with the Qlik Talend Cloud Starter subscription, as it does not support Data Movement gateway. If you have another subscription tier and do not want to use Data Movement gateway, select None.<br><br>For information on the benefits of Data Movement gateway and use cases that require it, see [Qlik Data Gateway - Data Movement](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Gateways/replication-gateway.htm). |
| Start Date | Enter the date, in the format `MM/DD/YYYY`, from which the data must be replicated from your source to your target. |
| API Secret | API secret. |
| Attribution Window (days) | Enter the number of days you want your tables’ attribution window to be. |
| Project Timezone | Project timezone. |
| Export Events (optional) | Enter the events separated by a comma. Example: `Page Viewed, Signed Up`. |
| Select Properties By Default | To capture new properties automatically in the `events` and `engage` tables, select the check box. Otherwise, new properties will be ignored. |
| EU Residency | To process and store your customers’ personal data in Europe, select the check box. |

## Schema

Information note

**Mixpanel free plan**

The `engage` and `export` tables are not available if you are using the free Mixpanel plan.

Information note

Schemas and naming conventions can change from version to version. It is recommended to verify your version before continuing.

Depending on your destination, table and column names may not appear as they are outlined below.

### annotations

The `annotations` table contains info about annotations.

| **Replication Method** | Full Table |
| --- | --- |
| **Primary Key** | date |
| **Useful links** | [Mixpanel documentation](https://developer.mixpanel.com/reference/overview-1) |

annotations table foreign keys

| Join annotations with | on |
| --- | --- |
| [cohorts](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#cohorts) | ```<br>annotations.project_id = cohorts.project_id<br>``` |

annotations table schema

| **date**<br><br><br>DATE-TIME |
| --- |
| **description**<br><br><br>STRING |
| **id**<br><br><br>INTEGER |
| **project\_id**<br><br><br>INTEGER |

### cohort\_members

The `cohort_members` table contains info about the cohorts user profiles belong to.

| **Replication Method** | Full Table |
| --- | --- |
| **Primary Keys** | cohort\_id<br><br>distinct\_id |
| **Useful links** | [Mixpanel documentation](https://developer.mixpanel.com/reference/engage-query)<br><br>[Mixpanel API method](https://developer.mixpanel.com/reference/cohorts-list "Opens in new tab: Mixpanel API method") |

cohort\_members table foreign keys

| Join cohort\_members with | on |
| --- | --- |
| [cohorts](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#cohorts) | ```<br>cohort_members.cohort_id = cohorts.id<br>``` |

cohort\_members table schema

| **cohort\_id**<br><br><br>INTEGER |
| --- |
| **distinct\_id**<br><br><br>STRING |

### cohorts

The `cohorts` table contains info about the cohorts in a Mixpanel project.

| **Replication Method** | Full Table |
| --- | --- |
| **Primary Key** | id |
| **Useful links** | [Mixpanel API method](https://developer.mixpanel.com/reference/cohorts-list "Opens in new tab: Mixpanel API method") |

cohorts table foreign keys

| Join cohorts with | on |
| --- | --- |
| [cohort_members](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#cohort-members) | ```<br>cohorts.id = cohort_members.cohort_id<br>``` |
| [annotations](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#annotations) | ```<br>cohorts.project_id = annotations.project_id<br>``` |

cohorts table schema

| **count**<br><br><br>INTEGER |
| --- |
| **created**<br><br><br>DATE-TIME |
| **description**<br><br><br>STRING |
| **id**<br><br><br>INTEGER |
| **is\_visible**<br><br><br>INTEGER |
| **name**<br><br><br>STRING |
| **project\_id**<br><br><br>INTEGER |

### engage

The `engage` table contains info about user profiles.

The schema for this table is dynamic, meaning that the detected columns are dependent upon the properties provided upon upload in Mixpanel. For every property available in Mixpanel for `engage` records, a column will be displayed in the integration’s **Tables to Replicate** tab.

| **Replication Method** | Full Table |
| --- | --- |
| **Primary Key** | distinct\_id |
| **Useful links** | [Mixpanel API method](https://developer.mixpanel.com/Content/data-export-api#section-engage "Opens in new tab: Mixpanel API method") |

engage table schema

| **distinct\_id**<br><br><br>STRING |
| --- |

### export

The `export` table contains “raw data dumps” of tracked events. The API endpoint for EU region servers will return a `200 terminated early` error code.

#### Table schema

The schema for this table is dynamic, meaning that the detected columns are dependent upon the properties provided upon upload in Mixpanel. For every property available in Mixpanel for `export` records, a column will be displayed in the integration’s **Tables to Replicate** tab.

#### Replication with attribution window

This table is replicated using the **Attribution Window** value defined in the integration’s settings page. Refer to the [Replication section](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#attribution-windows-extraction) for more info.

#### Distinct events and loading behavior

As a Primary Key is not used for this table, data will be loaded using Append-Only loading. This means you may see duplicate records in your destination, which requires a querying strategy that selects the latest version of each record.

This approach allows to track events without a `distinct_id`. In Mixpanel, `distinct_id` [is used to identify a unique user](https://help.mixpanel.com/hc/en-us/articles/115004509406-Distinct-IDs-):

> Mixpanel’s client-side tracking libraries automatically assign a distinct\_id to a user when they first visit a website or an application that has Mixpanel installed. Distinct\_id should not contain any special characters such as forward slashes, as it will break the URL. Distinct\_ids can and often should be sent in server-side implementations as well.

In order to replicate records’ `distinct_id` attributes, your server-side Mixpanel implementation must send them with tracked events. If the server-side implementation doesn’t do this, this attribute will be `null`.

Previous versions of Mixpanel integration used `distinct_id` as part of a composite Primary Key for this table. However, due to the possibility of this attribute being `null`, a Primary Key is not used for this table, as `null` values in Primary Key columns will prevent successful Extraction.

When working with `exports` data in your destination, you’ll need to use a querying strategy that accounts for the Append-Only loading used by this table. We recommend using the following columns to de-duplicate records, along with the approach outlined in the Querying Append-Only tables guide:

* `distinct_id`
* `event`
* `time`

| **Replication Method** | CDC |
| --- | --- |
| **Loading Behavior** | Append-Only |
| **Replication Key** | time |
| **Useful links** | [Mixpanel API method](https://developer.mixpanel.com/reference/raw-event-export "Opens in new tab: Mixpanel API method") |

export table schema

| **dataset**<br><br><br>STRING |
| --- |
| **distinct\_id**<br><br><br>STRING |
| **event**<br><br><br>STRING |
| **labels**<br><br>ARRAY |
| **sampling\_factor**<br><br><br>INTEGER |
| **time**<br><br><br>DATE-TIME |

### funnels

The `funnels` table contains data about your Mixpanel funnels, segmented by funnel and day.

**Note**: This table is replicated using the **Attribution Window** value defined in the integration’s settings page. Refer to the [Replication section](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#attribution-windows-extraction) for more info.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Keys** | funnel\_id<br><br>date |
| **Replication Key** | date |
| **Useful links** | [Mixpanel API method](https://developer.mixpanel.com/Content/data-export-api#section-funnels "Opens in new tab: Mixpanel API method") |

funnels table schema

| **analysis**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li><b>completion</b>: INTEGER</li><li><b>starting_amount</b>: INTEGER</li><li><b>steps</b>: INTEGER</li><li><b>worst</b>: INTEGER</li></ul> |
| --- |
| **date**<br><br><br>DATE |
| **datetime**<br><br><br>DATE-TIME |
| **funnel\_id**<br><br><br>INTEGER |
| **name**<br><br><br>STRING |
| **steps**<br><br>ARRAY<br><br>This is a nested data structure:<br><br><ul><li><b>avg_time</b>: NUMBER</li><li><b>count</b>: INTEGER</li><li><b>event</b>: STRING</li><li><b>goal</b>: STRING</li><li><b>overall_conv_ratio</b>: NUMBER</li><li><b>step_conv_ratio</b>: NUMBER</li><li><b>step_label</b>: NUMBER</li><li><b>time_buckets_from_prev</b>: OBJECT, which is also a nested data structure.                                        <p><b>buckets</b>, ARRAY</p><ul><li><b>higher</b>: INTEGER</li><li><b>lower</b>: INTEGER</li></ul></li><li><b>time_buckets_from_start</b>: OBJECT, which is also a nested data structure.                                        <p><b>buckets</b>, ARRAY</p><ul><li><b>higher</b>: INTEGER</li><li><b>lower</b>: INTEGER</li></ul></li></ul> |

### revenue

The `revenue` table contains info about revenue, segmented by day. The API endpoint for EU region servers will return a `400 bad requests (Timeout Error)` code.

**Note**: This table is replicated using the **Attribution Window** value defined in the integration’s settings page. Refer to the [Replication section](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Mixpanel.htm#attribution-windows-extraction) for more info.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | date |
| **Replication Key** | date |

revenue table schema

| **amount**<br><br><br>NUMBER |
| --- |
| **count**<br><br><br>INTEGER |
| **date**<br><br><br>DATE |
| **datetime**<br><br><br>DATE-TIME |
| **paid\_count**<br><br><br>INTEGER |