Mixpanel data out

Getting started

  1. Go to Data & Integrations > Integrations and select the Mixpanel entry in the Directory tab.
  2. (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.
  3. Configure your integration.
    1. Project Token: Mixpanel project token.
    2. 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).
    3. Service Account Username: Mixpanel service account username. Use this instead of Secret Key for service account authentication.
    4. Service Account Secret: Mixpanel service account secret. Use this instead of Secret Key for service account authentication.
    5. Project ID: Mixpanel project ID. Required when using service account authentication for import endpoints.
    6. 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)
    7. Source Name: This value, if it's not blank, will be sent as source_name to Mixpanel for every event/page/screen call.
    8. 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)
  4. 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_idstring
    Default: coalesce($.userId, $.anonymousId)
    The distinct ID for the user. If you've identified the user, this is typically the userId You can set this to any value using the identify method.
  • anonymous_idstring
    Default: $.anonymousId
    A distinct ID randomly generated prior to calling identify.
  • user_idobject
    Default: $.userId
    The distinct ID after calling identify.
  • group_idstring
    Default: $.context.groupId
    The unique identifier of the group that performed this event.
  • insert_idstring
    Default: $.messageId
    A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.
  • timeinteger(datetime)
    Default: $.timestamp
    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.
  • app_namestring
    Default: $.context.app.name
    The name of your application.
  • app_namespacestring
    Default: $.context.app.namespace
    The namespace of your application.
  • app_buildstring
    Default: $.context.app.build
    The current build of your application.
  • app_versionstring
    Default: $.context.app.version
    The current version of your application.
  • os_namestring
    Default: $.context.os.name
    The name of the mobile operating system or browser that the user is using.
  • os_versionstring
    Default: $.context.os.version
    The version of the mobile operating system or browser the user is using.
  • device_idstring
    Default: $.context.device.id
    A unique identifier for the device the user is using.
  • device_typestring
    Default: $.context.device.type
    The type of the user's device.
  • device_namestring
    Default: $.context.device.name
    The name of the user's device.
  • device_manufacturerstring
    Default: $.context.device.manufacturer
    The device manufacturer that the user is using.
  • device_modelstring
    Default: $.context.device.model
    The device model that the user is using.
  • bluetoothboolean
    Default: $.context.network.bluetooth
    Whether bluetooth is enabled.
  • carrierstring
    Default: $.context.network.carrier
    The carrier that the user is using.
  • cellularboolean
    Default: $.context.network.cellular
    Whether cellular is enabled.
  • wifiboolean
    Default: $.context.network.wifi
    Set to true if user’s device has an active, available Wifi connection, false if not.
  • countrystring
    Default: $.context.location.country
    The current country of the user.
  • regionstring
    Default: $.context.location.region
    The current region of the user.
  • languagestring
    Default: $.context.locale
    The language set by the user.
  • library_namestring
    Default: $.context.library.name
    The name of the SDK used to send events.
  • library_versionstring
    Default: $.context.library.version
    The version of the SDK used to send events.
  • ipstring
    Default: $.context.ip
    The IP address of the user. This is only used for geolocation and won't be stored.
  • idfastring
    Default: coalesce($.context.device.advertisingId, $.context.device.idfa)
    Identifier for Advertiser. _(iOS)_
  • urlstring
    Default: $.context.page.url
    The full URL of the webpage on which the event is triggered.
  • screen_widthnumber
    Default: $.context.screen.density
    Width, in pixels, of the device screen.
  • screen_heightnumber
    Default: $.context.screen.density
    Height, in pixels, of the device screen.
  • screen_densitynumber
    Default: $.context.screen.density
    Pixel density of the device screen.
  • referrerstring
    Default: $.context.page.referrer
    Referrer url
  • userAgentstring
    Default: $.context.userAgent
    User agent
  • event_propertiesobject
    Default: $.properties
    An object of key-value pairs that represent additional data to be sent along with the event.
  • contextobject
    Default: $.context
    An object of key-value pairs that provides useful context about the event. See the context object for more information.
  • UTM Tracking Properties
  • enable_batchingboolean
    Default: true
    Set as true to ensure CDP sends data to Mixpanel in batches.
  • eventstring
    Default: $.event
    The 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.

  • ipstring
    Default: $.context.ip
    The IP address of the user. This is only used for geolocation and won't be stored.
  • user_idstring
    Default: $.userId
    The unique user identifier set by you
  • anonymous_idstring
    Default: $.anonymousId
    The generated anonymous ID for the user.
  • Default: $.traits
    Properties 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_keystring
    The group key you specified in Mixpanel under Project settings. If this is not specified, it will be defaulted to "$group_id".
  • group_idstring
    Default: $.groupId
    The unique identifier of the group. If there is a trait that matches the group key, it will override this value.
  • traitsobject
    Default: $.traits
    The 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_idstringrequired
    Default: $.previousId
    The previous ID that you want to set an alias for.
  • aliasstringrequired
    Default: coalesce($.userId, $.anonymousId)
    The new, unique ID that you want to merge with the distinct_id. You can only map a single alias, so you'll typically alias a userId to an anonymousId to 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.

  • generatePurchaseEventPerProductboolean
    Default: true
    If true, we'll send a separate "Product Purchased" event for each product in the event.
  • distinct_idstring
    Default: coalesce($.userId, $.anonymousId)
    The distinct ID for the user. If you've identified the user, this is typically the userId You can set this to any value using the identify method.
  • anonymous_idstring
    Default: $.anonymousId
    A distinct ID randomly generated prior to calling identify.
  • user_idobject
    Default: $.userId
    The distinct ID after calling identify.
  • group_idstring
    Default: $.context.groupId
    The unique identifier of the group that performed this event.
  • insert_idstring
    Default: $.messageId
    A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.
  • timeinteger(datetime)
    Default: $.timestamp
    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.
  • app_namestring
    Default: $.context.app.name
    The name of your application.
  • app_namespacestring
    Default: $.context.app.namespace
    The namespace of your application.
  • app_buildstring
    Default: $.context.app.build
    The current build of your application.
  • app_versionstring
    Default: $.context.app.version
    The current version of your application.
  • os_namestring
    Default: $.context.os.name
    The name of the mobile operating system or browser that the user is using.
  • os_versionstring
    Default: $.context.os.version
    The version of the mobile operating system or browser the user is using.
  • device_idstring
    Default: $.context.device.id
    A unique identifier for the device the user is using.
  • device_typestring
    Default: $.context.device.type
    The type of the user's device.
  • device_namestring
    Default: $.context.device.name
    The name of the user's device.
  • device_manufacturerstring
    Default: $.context.device.manufacturer
    The device manufacturer that the user is using.
  • device_modelstring
    Default: $.context.device.model
    The device model that the user is using.
  • bluetoothboolean
    Default: $.context.network.bluetooth
    Whether bluetooth is enabled.
  • carrierstring
    Default: $.context.network.carrier
    The carrier that the user is using.
  • cellularboolean
    Default: $.context.network.cellular
    Whether cellular is enabled.
  • wifiboolean
    Default: $.context.network.wifi
    Set to true if user’s device has an active, available Wifi connection, false if not.
  • countrystring
    Default: $.context.location.country
    The current country of the user.
  • regionstring
    Default: $.context.location.region
    The current region of the user.
  • languagestring
    Default: $.context.locale
    The language set by the user.
  • library_namestring
    Default: $.context.library.name
    The name of the SDK used to send events.
  • library_versionstring
    Default: $.context.library.version
    The version of the SDK used to send events.
  • ipstring
    Default: $.context.ip
    The IP address of the user. This is only used for geolocation and won't be stored.
  • idfastring
    Default: coalesce($.context.device.advertisingId, $.context.device.idfa)
    Identifier for Advertiser. _(iOS)_
  • urlstring
    Default: $.context.page.url
    The full URL of the webpage on which the event is triggered.
  • screen_widthnumber
    Default: $.context.screen.density
    Width, in pixels, of the device screen.
  • screen_heightnumber
    Default: $.context.screen.density
    Height, in pixels, of the device screen.
  • screen_densitynumber
    Default: $.context.screen.density
    Pixel density of the device screen.
  • referrerstring
    Default: $.context.page.referrer
    Referrer url
  • userAgentstring
    Default: $.context.userAgent
    User agent
  • event_propertiesobject
    Default: $.properties
    An object of key-value pairs that represent additional data to be sent along with the event.
  • contextobject
    Default: $.context
    An object of key-value pairs that provides useful context about the event. See the context object for more information.
  • UTM Tracking Properties
  • enable_batchingboolean
    Default: true
    Set as true to ensure CDP sends data to Mixpanel in batches.
  • eventstringrequired
    Default: $.event
    The name of the action being performed.
  • Default: $.properties.products
    Products 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.

mixpanel's interface has an identity merge setting that supports a simple API

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.