Mixpanel data out
Getting started
- Go to Data & Integrations > Integrations and select the Mixpanel entry in the Directory tab.
- (Optional) Select the data sources that you want to connect to your outbound integration. You can always connect data sources later. We'll only show you data sources that work with your integration.
-
Configure your integration.
- Project Token: Mixpanel project token.
- Secret Key: Mixpanel project secret. This authentication method is deprecated and will be removed in the future. Use Service Account credentials instead. Learn about [EU data residency](https://developer.mixpanel.com/reference/project-secret).
- Service Account Username: Mixpanel service account username. Use this instead of Secret Key for service account authentication.
- Service Account Secret: Mixpanel service account secret. Use this instead of Secret Key for service account authentication.
- Project ID: Mixpanel project ID. Required when using service account authentication for import endpoints.
- Data Residency: Learn about [EU data residency](https://docs.mixpanel.com/docs/privacy/eu-residency) and [India data residency](https://docs.mixpanel.com/docs/privacy/in-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](https://developer.mixpanel.com/reference/import-events)
- 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 things up, you can go to the Actions tab to see how we map incoming data to your integration.
You may need to add actions for this integration
While we often have default triggers for actions, we don't always add those actions as defaults. You may need to add actions to make sure that you're sending all the data that you want to send to your integration. See our actions page for help setting up actions.
Track Event
Default Trigger:type = "track"Send an event to Mixpanel. Learn more about Events in Mixpanel
- distinct_idstringDefault:
coalesce($.userId, $.anonymousId)The distinct ID for the user. If you've identified the user, this is typically theuserIdYou can set this to any value using the identify method. - anonymous_idstringDefault:
$.anonymousIdA distinct ID randomly generated prior to calling identify. - user_idobjectDefault:
$.userIdThe distinct ID after calling identify. - group_idstringDefault:
$.context.groupIdThe unique identifier of the group that performed this event. - insert_idstringDefault:
$.messageIdA random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events. - timeinteger(datetime)Default:
$.timestampThe 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. - app_namestringDefault:
$.context.app.nameThe name of your application. - app_namespacestringDefault:
$.context.app.namespaceThe namespace of your application. - app_buildstringDefault:
$.context.app.buildThe current build of your application. - app_versionstringDefault:
$.context.app.versionThe current version of your application. - os_namestringDefault:
$.context.os.nameThe name of the mobile operating system or browser that the user is using. - os_versionstringDefault:
$.context.os.versionThe version of the mobile operating system or browser the user is using. - device_idstringDefault:
$.context.device.idA unique identifier for the device the user is using. - device_typestringDefault:
$.context.device.typeThe type of the user's device. - device_namestringDefault:
$.context.device.nameThe name of the user's device. - device_manufacturerstringDefault:
$.context.device.manufacturerThe device manufacturer that the user is using. - device_modelstringDefault:
$.context.device.modelThe device model that the user is using. - bluetoothbooleanDefault:
$.context.network.bluetoothWhether bluetooth is enabled. - carrierstringDefault:
$.context.network.carrierThe carrier that the user is using. - cellularbooleanDefault:
$.context.network.cellularWhether cellular is enabled. - wifibooleanDefault:
$.context.network.wifiSet to true if user’s device has an active, available Wifi connection, false if not. - countrystringDefault:
$.context.location.countryThe current country of the user. - regionstringDefault:
$.context.location.regionThe current region of the user. - languagestringDefault:
$.context.localeThe language set by the user. - library_namestringDefault:
$.context.library.nameThe name of the SDK used to send events. - library_versionstringDefault:
$.context.library.versionThe version of the SDK used to send events. - ipstringDefault:
$.context.ipThe IP address of the user. This is only used for geolocation and won't be stored. - idfastringDefault:
coalesce($.context.device.advertisingId, $.context.device.idfa)Identifier for Advertiser. _(iOS)_ - urlstringDefault:
$.context.page.urlThe full URL of the webpage on which the event is triggered. - screen_widthnumberDefault:
$.context.screen.densityWidth, in pixels, of the device screen. - screen_heightnumberDefault:
$.context.screen.densityHeight, in pixels, of the device screen. - screen_densitynumberDefault:
$.context.screen.densityPixel density of the device screen. - referrerstringDefault:
$.context.page.referrerReferrer url - userAgentstringDefault:
$.context.userAgentUser agent - event_propertiesobjectDefault:
$.propertiesAn object of key-value pairs that represent additional data to be sent along with the event. - contextobjectDefault:
$.contextAn object of key-value pairs that provides useful context about the event. See the context object for more information. - UTM Tracking Properties
- enable_batchingbooleanDefault:
trueSet as true to ensure CDP sends data to Mixpanel in batches. - eventstringDefault:
$.eventThe name of the action being performed.
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.
- ipstringDefault:
$.context.ipThe IP address of the user. This is only used for geolocation and won't be stored. - user_idstringDefault:
$.userIdThe unique user identifier set by you - anonymous_idstringDefault:
$.anonymousIdThe generated anonymous ID for the user. - Default:
$.traitsProperties to set on the user profile.
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_keystringThe group key you specified in Mixpanel under Project settings. If this is not specified, it will be defaulted to "$group_id".
- group_idstringDefault:
$.groupIdThe unique identifier of the group. If there is a trait that matches the group key, it will override this value. - traitsobjectDefault:
$.traitsThe properties to set on the group profile.
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.
- distinct_idstringrequiredDefault:
$.previousIdThe previous ID that you want to set an alias for. - aliasstringrequiredDefault:
coalesce($.userId, $.anonymousId)The new, unique ID that you want to merge with thedistinct_id. You can only map a single alias, so you'll typically alias auserIdto ananonymousIdto unify the activities of a person before and after you identify them.
Track Purchase
Default Trigger:type = "track"Send an 'Order Completed' Event to Mixpanel.
- generatePurchaseEventPerProductbooleanDefault:
trueIf true, we'll send a separate "Product Purchased" event for each product in the event. - distinct_idstringDefault:
coalesce($.userId, $.anonymousId)The distinct ID for the user. If you've identified the user, this is typically theuserIdYou can set this to any value using the identify method. - anonymous_idstringDefault:
$.anonymousIdA distinct ID randomly generated prior to calling identify. - user_idobjectDefault:
$.userIdThe distinct ID after calling identify. - group_idstringDefault:
$.context.groupIdThe unique identifier of the group that performed this event. - insert_idstringDefault:
$.messageIdA random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events. - timeinteger(datetime)Default:
$.timestampThe 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. - app_namestringDefault:
$.context.app.nameThe name of your application. - app_namespacestringDefault:
$.context.app.namespaceThe namespace of your application. - app_buildstringDefault:
$.context.app.buildThe current build of your application. - app_versionstringDefault:
$.context.app.versionThe current version of your application. - os_namestringDefault:
$.context.os.nameThe name of the mobile operating system or browser that the user is using. - os_versionstringDefault:
$.context.os.versionThe version of the mobile operating system or browser the user is using. - device_idstringDefault:
$.context.device.idA unique identifier for the device the user is using. - device_typestringDefault:
$.context.device.typeThe type of the user's device. - device_namestringDefault:
$.context.device.nameThe name of the user's device. - device_manufacturerstringDefault:
$.context.device.manufacturerThe device manufacturer that the user is using. - device_modelstringDefault:
$.context.device.modelThe device model that the user is using. - bluetoothbooleanDefault:
$.context.network.bluetoothWhether bluetooth is enabled. - carrierstringDefault:
$.context.network.carrierThe carrier that the user is using. - cellularbooleanDefault:
$.context.network.cellularWhether cellular is enabled. - wifibooleanDefault:
$.context.network.wifiSet to true if user’s device has an active, available Wifi connection, false if not. - countrystringDefault:
$.context.location.countryThe current country of the user. - regionstringDefault:
$.context.location.regionThe current region of the user. - languagestringDefault:
$.context.localeThe language set by the user. - library_namestringDefault:
$.context.library.nameThe name of the SDK used to send events. - library_versionstringDefault:
$.context.library.versionThe version of the SDK used to send events. - ipstringDefault:
$.context.ipThe IP address of the user. This is only used for geolocation and won't be stored. - idfastringDefault:
coalesce($.context.device.advertisingId, $.context.device.idfa)Identifier for Advertiser. _(iOS)_ - urlstringDefault:
$.context.page.urlThe full URL of the webpage on which the event is triggered. - screen_widthnumberDefault:
$.context.screen.densityWidth, in pixels, of the device screen. - screen_heightnumberDefault:
$.context.screen.densityHeight, in pixels, of the device screen. - screen_densitynumberDefault:
$.context.screen.densityPixel density of the device screen. - referrerstringDefault:
$.context.page.referrerReferrer url - userAgentstringDefault:
$.context.userAgentUser agent - event_propertiesobjectDefault:
$.propertiesAn object of key-value pairs that represent additional data to be sent along with the event. - contextobjectDefault:
$.contextAn object of key-value pairs that provides useful context about the event. See the context object for more information. - UTM Tracking Properties
- enable_batchingbooleanDefault:
trueSet as true to ensure CDP sends data to Mixpanel in batches. - eventstringrequiredDefault:
$.eventThe name of the action being performed. - Default:
$.properties.productsProducts in the order.
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 profile that 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 profiles.
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 profile. For example, using our JavaScript snippet, your flow might look something like this:
// the anonymous user does actions under an anonymous ID
cioanalytics.track('92734232-2342423423-973945', 'Anonymous Event')
// the anonymous user signs up and is aliased to their new user ID
cioanalytics.alias('92734232-2342423423-973945', '1234')
// the user is identified
cioanalytics.identify('1234', { 'plan': 'Free' })
// the identified user does actions
cioanalytics.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.