Mixpanel Destination
UpdatedAbout this integration
Mixpanel is an analytics platform that helps you track user interactions in your websites and apps, so you can convert, engage, and retain more users.
Getting started
Go to the Data Pipelines tab and click Connections.
Click Add New under Destinations.
Select the Mixpanel destination.
(Optional) Select the sources that you want to connect to this destination. You can always connect sources to your destination later. We’ll only show you eligible sources.
Configure your destination.
Project Token: Mixpanel project token.
Api Secret: Mixpanel project secret.
Api Region: Learn about EU data residency
Source Name: This value, if it's not blank, will be sent as source_name to Mixpanel for every event/page/screen call.
Strict Mode: This value, if it's 1 (recommended), Mixpanel will validate the events you are trying to send and return errors per event that failed. Learn more about the Mixpanel Import Events API
Click Enable Destination.
Actions
Before you get started with Mixpanel, you should implement the alias
method in your sources. This ensures that you attribute activity to the right users.
When you’re done setting up your destination, you can go to the Actions tab to see how we map source events to your destination.
Track Event
Default Trigger: type = “track”
Send an event to Mixpanel. Learn more about Events in Mixpanel
- anonymous_id string
Default:
A distinct ID randomly generated prior to calling identify.$.anonymousId
- app_build string
Default:
The current build of your application.$.context.app.build
- app_name string
Default:
The name of your application.$.context.app.name
- app_namespace string
Default:
The namespace of your application.$.context.app.namespace
- app_version string
Default:
The current version of your application.$.context.app.version
- bluetooth boolean
Default:
Whether bluetooth is enabled.$.context.network.bluetooth
- carrier string
Default:
The carrier that the user is using.$.context.network.carrier
- cellular boolean
Default:
Whether cellular is enabled.$.context.network.cellular
- country string
Default:
The current country of the user.$.context.location.country
- device_id string
Default:
A unique identifier for the device the user is using.$.context.device.id
- device_manufacturer string
Default:
The device manufacturer that the user is using.$.context.device.manufacturer
- device_model string
Default:
The device model that the user is using.$.context.device.model
- device_name string
Default:
The name of the user’s device.$.context.device.name
- device_type string
Default:
The type of the user’s device.$.context.device.type
- distinct_id string
Default:
The distinct ID for the user. If you’ve identified the user, this is typically thecoalesce($.userId, $.anonymousId)
userId
You can set this to any value using the identify method. - enable_batching boolean
Default:
Set as true to ensure CDP sends data to Mixpanel in batches.true
- event string
Default:
The name of the action being performed.$.event
- group_id string
Default:
The unique identifier of the group that performed this event.$.context.groupId
- idfa string
Default:
Identifier for Advertiser. (iOS)coalesce($.context.device.advertisingId, $.context.device.idfa)
- insert_id string
Default:
A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.$.messageId
- ip string
Default:
The IP address of the user. This is only used for geolocation and won’t be stored.$.context.ip
- language string
Default:
The language set by the user.$.context.locale
- library_name string
Default:
The name of the SDK used to send events.$.context.library.name
- library_version string
Default:
The version of the SDK used to send events.$.context.library.version
- os_name string
Default:
The name of the mobile operating system or browser that the user is using.$.context.os.name
- os_version string
Default:
The version of the mobile operating system or browser the user is using.$.context.os.version
- referrer string
Default:
Referrer url$.context.page.referrer
- region string
Default:
The current region of the user.$.context.location.region
- screen_density number
Default:
Pixel density of the device screen.$.context.screen.density
- screen_height number
Default:
Height, in pixels, of the device screen.$.context.screen.density
- screen_width number
Default:
Width, in pixels, of the device screen.$.context.screen.density
- time integer (datetime)
Default:
The timestamp of the event. Mixpanel expects epoch timestamp in millisecond or second. Please note, Mixpanel only accepts this field as the timestamp. If the field is empty, it will be set to the time Mixpanel servers receive it.$.timestamp
- url string
Default:
The full URL of the webpage on which the event is triggered.$.context.page.url
- userAgent string
Default:
User agent$.context.userAgent
-
- utm_campaign string
Default:
$.context.campaign.name
- utm_content string
Default:
$.context.campaign.content
- utm_medium string
Default:
$.context.campaign.medium
- utm_source string
Default:
$.context.campaign.source
- utm_term string
Default:
$.context.campaign.term
- wifi boolean
Default:
Set to true if user’s device has an active, available Wifi connection, false if not.$.context.network.wifi
Identify User
Default Trigger: type = “identify”
Set the user ID for a particular device ID or update user properties. Learn more about User Profiles and Identity Management.
- anonymous_id string
Default:
The generated anonymous ID for the user.$.anonymousId
- ip string
Default:
The IP address of the user. This is only used for geolocation and won’t be stored.$.context.ip
-
- User Properties* any typeA dictionary of key-value pairs you want to set on the identified person.
- user_id string
Default:
The unique user identifier set by you$.userId
Group Identify User
Default Trigger: type = “group”
Updates or adds properties to a group profile. The profile is created if it does not exist. Learn more about Group Analytics.
- group_id string
Default:
The unique identifier of the group. If there is a trait that matches the group key, it will override this value.$.groupId
- group_key stringThe group key you specified in Mixpanel under Project settings. If this is not specified, it will be defaulted to “$group_id”.
Alias
Create an alias to a distinct id. This action is primarily supported for the sake of customers using the legacy identity management in their Mixpanel project. For new customers or those who have migrated to the new identity management in Mixpanel should use identify
.
- alias stringRequired
Default:
The new, unique ID that you want to merge with thecoalesce($.userId, $.anonymousId)
distinct_id
. You can only map a single alias, so you’ll typically alias auserId
to ananonymousId
to unify the activities of a person before and after you identify them. - distinct_id stringRequired
Default:
The previous ID that you want to set an alias for.$.previousId
Track Purchase
Default Trigger: type = “track”
Send an ‘Order Completed’ Event to Mixpanel.
- anonymous_id string
Default:
A distinct ID randomly generated prior to calling identify.$.anonymousId
- app_build string
Default:
The current build of your application.$.context.app.build
- app_name string
Default:
The name of your application.$.context.app.name
- app_namespace string
Default:
The namespace of your application.$.context.app.namespace
- app_version string
Default:
The current version of your application.$.context.app.version
- bluetooth boolean
Default:
Whether bluetooth is enabled.$.context.network.bluetooth
- carrier string
Default:
The carrier that the user is using.$.context.network.carrier
- cellular boolean
Default:
Whether cellular is enabled.$.context.network.cellular
- country string
Default:
The current country of the user.$.context.location.country
- device_id string
Default:
A unique identifier for the device the user is using.$.context.device.id
- device_manufacturer string
Default:
The device manufacturer that the user is using.$.context.device.manufacturer
- device_model string
Default:
The device model that the user is using.$.context.device.model
- device_name string
Default:
The name of the user’s device.$.context.device.name
- device_type string
Default:
The type of the user’s device.$.context.device.type
- distinct_id string
Default:
The distinct ID for the user. If you’ve identified the user, this is typically thecoalesce($.userId, $.anonymousId)
userId
You can set this to any value using the identify method. - enable_batching boolean
Default:
Set as true to ensure CDP sends data to Mixpanel in batches.true
- event stringRequired
Default:
The name of the action being performed.$.event
- generatePurchaseEventPerProduct boolean
Default:
If true, we’ll send a separate “Product Purchased” event for each product in the event.true
- group_id string
Default:
The unique identifier of the group that performed this event.$.context.groupId
- idfa string
Default:
Identifier for Advertiser. (iOS)coalesce($.context.device.advertisingId, $.context.device.idfa)
- insert_id string
Default:
A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.$.messageId
- ip string
Default:
The IP address of the user. This is only used for geolocation and won’t be stored.$.context.ip
- language string
Default:
The language set by the user.$.context.locale
- library_name string
Default:
The name of the SDK used to send events.$.context.library.name
- library_version string
Default:
The version of the SDK used to send events.$.context.library.version
- os_name string
Default:
The name of the mobile operating system or browser that the user is using.$.context.os.name
- os_version string
Default:
The version of the mobile operating system or browser the user is using.$.context.os.version
-
- brand stringthe product brand.
- category stringthe product category.
- coupon stringThe coupon used for the product, if applicable.
- image_url stringThe URL of the product image, if applicable.
- name stringThe product name.
- position string
- price numberThe product price.
- product_id stringThe product ID.
- quantity integerThe number of the product purchased.
- sku stringThe individual product stock keeping unit (SKU).
- url string
- variant stringThe vairiant of the product, if applicable.
- referrer string
Default:
Referrer url$.context.page.referrer
- region string
Default:
The current region of the user.$.context.location.region
- screen_density number
Default:
Pixel density of the device screen.$.context.screen.density
- screen_height number
Default:
Height, in pixels, of the device screen.$.context.screen.density
- screen_width number
Default:
Width, in pixels, of the device screen.$.context.screen.density
- time integer (datetime)
Default:
The timestamp of the event. Mixpanel expects epoch timestamp in millisecond or second. Please note, Mixpanel only accepts this field as the timestamp. If the field is empty, it will be set to the time Mixpanel servers receive it.$.timestamp
- url string
Default:
The full URL of the webpage on which the event is triggered.$.context.page.url
- userAgent string
Default:
User agent$.context.userAgent
-
- utm_campaign string
Default:
$.context.campaign.name
- utm_content string
Default:
$.context.campaign.content
- utm_medium string
Default:
$.context.campaign.medium
- utm_source string
Default:
$.context.campaign.source
- utm_term string
Default:
$.context.campaign.term
- wifi boolean
Default:
Set to true if user’s device has an active, available Wifi connection, false if not.$.context.network.wifi
Use simplified identity merging in Mixpanel
Before March 2023, Mixpanel required you to use the alias
method to merge identities. Now Mixpanel has a Simplified API for identity merging. This API supports identity merging the way most platforms do—without needing to send alias
calls. Learn more about Mixpanel’s simplified ID merge feature.
If you created your account before April 2024, you need to enable Mixpanel’s Simplified API to support easy identity merges. Otherwise, you’ll have to use the alias
method to merge identities.
Using the alias
method (original API)
Mixpanel’s original API doesn’t gracefully handle identity changes. For example, when you identify a person who was previously anonymous, Mixpanel’s original API doesn’t automatically associate anonymous activity with the userId
in your identify call. Instead, Mixpanel’s original API treats the anonymousId
and userId
as two separate people.
If you don’t want to enable the Simplified API, you need to send an alias
call to associate anonymous activity with an identified person (a userId
).
You should send the alias
method before you send an identify
call for a person. For example, using our JavaScript snippet, your flow might look something like this:
// the anonymous user does actions under an anonymous ID
analytics.track('92734232-2342423423-973945', 'Anonymous Event')
// the anonymous user signs up and is aliased to their new user ID
analytics.alias('92734232-2342423423-973945', '1234')
// the user is identified
analytics.identify('1234', { 'plan': 'Free' })
// the identified user does actions
analytics.track('1234', 'Identified Action')
Attributing track
events to groups
You can attribute events to groups in Mixpanel. To do this, make sure that your track
calls either include a groupId
and that it’s mapped to a valid value in your action. By default, we map this field to your source data’s context.groupId
field.