Mixpanel Destination

About 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

  1. Go to the Data Pipelines tab and click Connections.

  2. Click Add New under Destinations.

  3. Select the Mixpanel destination.

  4. (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.

  5. Configure your destination.

    1. Project Token: Mixpanel project token.

    2. Api Secret: Mixpanel project secret.

    3. Api Region: Learn about EU data residency

    4. Source Name: This value, if it's not blank, will be sent as source_name to Mixpanel for every event/page/screen call.

    5. 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

    Setup your destination
    Setup your destination

  6. 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.

The actions for your destination
The actions for your destination

Track Event

Default Trigger: type = “track”

Send an event to Mixpanel. Learn more about Events in Mixpanel

  • anonymous_id string

    Default: $.anonymousId

    A distinct ID randomly generated prior to calling identify.
  • app_build string

    Default: $.context.app.build

    The current build of your application.
  • app_name string

    Default: $.context.app.name

    The name of your application.
  • app_namespace string

    Default: $.context.app.namespace

    The namespace of your application.
  • app_version string

    Default: $.context.app.version

    The current version of your application.
  • bluetooth boolean

    Default: $.context.network.bluetooth

    Whether bluetooth is enabled.
  • carrier string

    Default: $.context.network.carrier

    The carrier that the user is using.
  • cellular boolean

    Default: $.context.network.cellular

    Whether cellular is enabled.
  • country string

    Default: $.context.location.country

    The current country of the user.
  • device_id string

    Default: $.context.device.id

    A unique identifier for the device the user is using.
  • device_manufacturer string

    Default: $.context.device.manufacturer

    The device manufacturer that the user is using.
  • device_model string

    Default: $.context.device.model

    The device model that the user is using.
  • device_name string

    Default: $.context.device.name

    The name of the user’s device.
  • device_type string

    Default: $.context.device.type

    The type of the user’s device.
  • distinct_id string

    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.
  • enable_batching boolean

    Default: true

    Set as true to ensure CDP sends data to Mixpanel in batches.
  • event string

    Default: $.event

    The name of the action being performed.
  • group_id string

    Default: $.context.groupId

    The unique identifier of the group that performed this event.
  • idfa string

    Default: coalesce($.context.device.advertisingId, $.context.device.idfa)

    Identifier for Advertiser. (iOS)
  • insert_id string

    Default: $.messageId

    A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.
  • ip string

    Default: $.context.ip

    The IP address of the user. This is only used for geolocation and won’t be stored.
  • language string

    Default: $.context.locale

    The language set by the user.
  • library_name string

    Default: $.context.library.name

    The name of the SDK used to send events.
  • library_version string

    Default: $.context.library.version

    The version of the SDK used to send events.
  • os_name string

    Default: $.context.os.name

    The name of the mobile operating system or browser that the user is using.
  • os_version string

    Default: $.context.os.version

    The version of the mobile operating system or browser the user is using.
  • referrer string

    Default: $.context.page.referrer

    Referrer url
  • region string

    Default: $.context.location.region

    The current region of the user.
  • screen_density number

    Default: $.context.screen.density

    Pixel density of the device screen.
  • screen_height number

    Default: $.context.screen.density

    Height, in pixels, of the device screen.
  • screen_width number

    Default: $.context.screen.density

    Width, in pixels, of the device screen.
  • time integer  (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.
  • url string

    Default: $.context.page.url

    The full URL of the webpage on which the event is triggered.
  • userAgent string

    Default: $.context.userAgent

    User agent
    • 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: $.context.network.wifi

    Set to true if user’s device has an active, available Wifi connection, false if not.

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: $.anonymousId

    The generated anonymous ID for the user.
  • ip string

    Default: $.context.ip

    The IP address of the user. This is only used for geolocation and won’t be stored.
    • User Properties* any type
      A dictionary of key-value pairs you want to set on the identified person.
  • user_id string

    Default: $.userId

    The unique user identifier set by you

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: $.groupId

    The unique identifier of the group. If there is a trait that matches the group key, it will override this value.
  • group_key string
    The 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 string
    Required

    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.
  • distinct_id string
    Required

    Default: $.previousId

    The previous ID that you want to set an alias for.

Track Purchase

Default Trigger: type = “track”

Send an ‘Order Completed’ Event to Mixpanel.

  • anonymous_id string

    Default: $.anonymousId

    A distinct ID randomly generated prior to calling identify.
  • app_build string

    Default: $.context.app.build

    The current build of your application.
  • app_name string

    Default: $.context.app.name

    The name of your application.
  • app_namespace string

    Default: $.context.app.namespace

    The namespace of your application.
  • app_version string

    Default: $.context.app.version

    The current version of your application.
  • bluetooth boolean

    Default: $.context.network.bluetooth

    Whether bluetooth is enabled.
  • carrier string

    Default: $.context.network.carrier

    The carrier that the user is using.
  • cellular boolean

    Default: $.context.network.cellular

    Whether cellular is enabled.
  • country string

    Default: $.context.location.country

    The current country of the user.
  • device_id string

    Default: $.context.device.id

    A unique identifier for the device the user is using.
  • device_manufacturer string

    Default: $.context.device.manufacturer

    The device manufacturer that the user is using.
  • device_model string

    Default: $.context.device.model

    The device model that the user is using.
  • device_name string

    Default: $.context.device.name

    The name of the user’s device.
  • device_type string

    Default: $.context.device.type

    The type of the user’s device.
  • distinct_id string

    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.
  • enable_batching boolean

    Default: true

    Set as true to ensure CDP sends data to Mixpanel in batches.
  • event string
    Required

    Default: $.event

    The name of the action being performed.
  • generatePurchaseEventPerProduct boolean

    Default: true

    If true, we’ll send a separate “Product Purchased” event for each product in the event.
  • group_id string

    Default: $.context.groupId

    The unique identifier of the group that performed this event.
  • idfa string

    Default: coalesce($.context.device.advertisingId, $.context.device.idfa)

    Identifier for Advertiser. (iOS)
  • insert_id string

    Default: $.messageId

    A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.
  • ip string

    Default: $.context.ip

    The IP address of the user. This is only used for geolocation and won’t be stored.
  • language string

    Default: $.context.locale

    The language set by the user.
  • library_name string

    Default: $.context.library.name

    The name of the SDK used to send events.
  • library_version string

    Default: $.context.library.version

    The version of the SDK used to send events.
  • os_name string

    Default: $.context.os.name

    The name of the mobile operating system or browser that the user is using.
  • os_version string

    Default: $.context.os.version

    The version of the mobile operating system or browser the user is using.
    • brand string
      the product brand.
    • category string
      the product category.
    • coupon string
      The coupon used for the product, if applicable.
    • image_url string
      The URL of the product image, if applicable.
    • name string
      The product name.
    • position string
    • price number
      The product price.
    • product_id string
      The product ID.
    • quantity integer
      The number of the product purchased.
    • sku string
      The individual product stock keeping unit (SKU).
    • url string
    • variant string
      The vairiant of the product, if applicable.
  • referrer string

    Default: $.context.page.referrer

    Referrer url
  • region string

    Default: $.context.location.region

    The current region of the user.
  • screen_density number

    Default: $.context.screen.density

    Pixel density of the device screen.
  • screen_height number

    Default: $.context.screen.density

    Height, in pixels, of the device screen.
  • screen_width number

    Default: $.context.screen.density

    Width, in pixels, of the device screen.
  • time integer  (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.
  • url string

    Default: $.context.page.url

    The full URL of the webpage on which the event is triggered.
  • userAgent string

    Default: $.context.userAgent

    User agent
    • 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: $.context.network.wifi

    Set to true if user’s device has an active, available Wifi connection, false if not.

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
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 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.

Copied to clipboard!
  Contents
Is this page helpful?