Skip to main content

Mixpanel

Send Snowplow events to Mixpanel to power product analytics, user behavior tracking, and funnel analysis using Mixpanel's Import API.

Prerequisites#

Before setting up the forwarder in Console, you'll need the following from your Mixpanel account:

  • Project ID: found in Mixpanel under Settings > Project Settings
  • Service Account Username: create a service account in Mixpanel under Settings > Organization Settings > Service Accounts. The service account must have either Admin or Owner permissions.
  • Service Account Password: generated when you create the service account
Test in a non-production project first

To avoid introducing test data in your production Mixpanel project, we recommend using a test or development Mixpanel project to test your transformations first. Then, create a new Connection in Console with your production credentials, and a new forwarder that imports the configuration from your development forwarder.

Getting started#

Configure the destination#

To create the connection and forwarder, follow the steps in Creating forwarders.

When configuring the connection, select Mixpanel for the connection type, enter your project ID, service account username, and service account password. You'll also need to select the Server Location where your Mixpanel project is hosted:

  • United States: https://api.mixpanel.com/
  • European Union: https://api-eu.mixpanel.com/
  • India: https://api-in.mixpanel.com/

Validate the integration#

You can confirm events are reaching Mixpanel by checking the Events page in your Mixpanel account:

  1. From the left navigation bar, click Events
  2. You should see your Snowplow events appearing in the live view
  3. You can also navigate to Settings > Project Settings > Data & Exports to view import statistics

Identity management#

Mixpanel uses a combination of distinct_id (user identifier) and $device_id (device identifier) to track users across sessions. The Snowplow integration defaults to using user_id for distinct_id and a coalesce of domain_userid and client_sesion.user_id for $device_id, which supports Mixpanel's Simplified ID Merge system.

When a user logs in and your event contains a user_id value, Mixpanel will automatically merge the user's anonymous activity (tracked via $device_id) with their identified profile (tracked via distinct_id).

Schema reference#

This section contains information on the fields you can send to Mixpanel, including field names, data types, required fields, and default Snowplow mapping expressions.

FieldDetails
event
string

Required. The name of the event

Default mapping: event.event_name
properties
object

Required.

Properties:
  • time (integer, required): The time at which the event occurred, in milliseconds since epoch.
    Default mapping: spTstampToEpochMillis(event.derived_tstamp)
  • distinct_id (string, required): Identifies the user who performed the event.
    Default mapping: event.user_id
  • $insert_id (string, required): A unique identifier for the event, used for deduplication.
    Default mapping: event.event_id
  • ip (string, optional): The IP address of the user.
    Default mapping: event.user_ipaddress
  • $city (string, optional): The city of the event sender.
    Default mapping: event.geo_city
  • $region (string, optional): The region (state or province) of the event sender.
    Default mapping: event.geo_region
  • mp_country_code (string, optional): The country of the event sender.
    Default mapping: event.geo_country
  • $browser (string, optional): Name of the browser.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.agentName
  • $browser_version (string, optional): Version of the browser.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.agentVersion
  • $current_url (string, optional): The full URL of the webpage on which the event is triggered.
    Default mapping: event.page_url
  • $referrer (string, optional): Referring URL including your own domain.
    Default mapping: event.page_referrer
  • $referring_domain (string, optional): Referring domain including your own domain.
    Default mapping: event.refr_urlhost
  • $device (string, optional): Name of the device.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.deviceName
  • $device_id (string, optional): A unique device identifier. Used in Mixpanel's Simplified ID Merge API.
    Default mapping: event.domain_userid ?? event.contexts_com_snowplowanalytics_snowplow_client_session_1?.[0]?.userId
  • $screen_height (integer, optional): The height of the device screen in pixels.
    Default mapping: event.dvce_screenheight
  • $screen_width (integer, optional): The width of the device screen in pixels.
    Default mapping: event.dvce_screenwidth
  • $os (string, optional): Operating system of the device.
    Default mapping: event.os_name
  • $os_version (string, optional): Operating system version.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.operatingSystemVersion
  • $manufacturer (string, optional): Manufacturer of the device.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.deviceBrand
  • $model (string, optional): Model of the device.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.deviceName
  • $app_version_string (string, optional): The app version.
    Default mapping: event.contexts_com_snowplowanalytics_mobile_application_1?.[0]?.version
  • $app_build_number (string, optional): Build number for the mobile app.
    Default mapping: event.contexts_com_snowplowanalytics_mobile_application_1?.[0]?.build
  • $carrier (string, optional): Wireless carrier of the device owner.
    Default mapping: event.contexts_nl_basjes_yauaa_context_1?.[0]?.carrier
  • $radio (string, optional): The current cellular network communication standard (3G, 4G, LTE, etc).
    Default mapping: event.contexts_com_snowplowanalytics_snowplow_mobile_context_1?.[0]?.networkTechnology
  • $wifi (boolean, optional): Set to true if the user's device is connected to wifi.
    Default mapping: event.contexts_com_snowplowanalytics_snowplow_mobile_context_1?.[0]?.networkType === 'wifi'
  • $user_id (string, optional): The identified ID of the user. Used in Mixpanel's Simplified ID Merge API.
    Default mapping: event.user_id
  • $lib_version (string, optional): Tracker library version.
    Default mapping: event.v_tracker
  • utm_source (string, optional): UTM source parameter from the URL.
    Default mapping: event.mkt_source
  • utm_medium (string, optional): UTM medium parameter from the URL.
    Default mapping: event.mkt_medium
  • utm_campaign (string, optional): UTM campaign parameter from the URL.
    Default mapping: event.mkt_campaign
  • utm_content (string, optional): UTM content parameter from the URL.
    Default mapping: event.mkt_content
  • utm_term (string, optional): UTM term parameter from the URL.
    Default mapping: event.mkt_term
  • mp_lib (string, optional): Tracker library that sent the event.
    Default mapping: 'Snowplow: ' + event.v_tracker
  • mp_sent_by_lib_version (string, optional): Mixpanel library version used to send data (not necessarily the same as the version which enqueued the data).
  • $screen_dpi (integer, optional): Pixel density of the device screen.
  • $initial_referrer (string, optional): Referring URL when the user first arrived on your site. Defaults to “$direct” if the user is not referred.
  • $initial_referring_domain (string, optional): Referring domain at first arrival. Defaults to “$direct” if the user is not referred.
  • $search_engine (string, optional): The search engine that the customer used when they arrived at your domain.
  • mp_keyword (string, optional): Search keywords detected on the referrer from a search engine to your domain. This property is only collected when search keywords are included in a URL.
  • $watch_model (string, optional): The model of the iOS watch.
  • $bluetooth_enabled (boolean, optional): Set to true if Bluetooth is enabled, false if not.
  • $bluetooth_version (string, optional): Set to “none”, “ble”, or “classic”.
  • $has_nfc (boolean, optional): The device supports Near Field Communication(NFC). Set to true if the device hardware supports NFC, false if not.
  • $has_telephone (boolean, optional): Set to true if this device has telephone functionality, false if not.