Segment Mixpanel (Classic): Set Up Guide

This article reflects the behavior of an older version of Mixpanel's Segment Integration known as Mixpanel (Classic).

Many Mixpanel customers successfully integrate using Segment. This integration collects your data within Segment and then passes that data along to Mixpanel, which means you'll primarily be using Segment's methods in your implementation rather than Mixpanel’s native libraries. Segment wraps Mixpanel’s libraries, so you can still access native Mixpanel functions if Segment methods don’t accomplish your goals.

The Segment-Mixpanel integration is handled primarily by Segment, but that being said, it’s a good idea to take a look at documentation on both sides to understand some of Mixpanel’s nuances and how to structure Segment data so that you have maximum flexibility when creating reports in Mixpanel.

What to Track

As with any Mixpanel integration, think carefully early on about what Events you'd like to track using Segment, and give those Events consistent and clear names.

Mixpanel allows you to send information along with Events, providing additional detail about the Event itself or the person performing that Event. These bits of information are called Properties. Mixpanel has three types of Properties: Event Properties, sent with a single Event; Super Properties, sent with every Event; and User Profile Properties, set on User Profiles. Learn more about Event Properties, Super Properties, and User Properties in Mixpanel.

If you’re using one of Segment’s client-side libraries, user specific details should be collected as Traits, which are the Segment equivalent of Mixpanel’s Super and User Properties combined. By default, each key-value pair in the Trait object will be registered as a Super Property in Mixpanel. And if you’ve enabled Mixpanel People in your Segment settings, these Traits will automatically be set as User properties as well.

Review the resources in Mixpanel's Getting Started Guide to get a sense of how Mixpanel structures its Event data so you can set up your Segment tracking with these concepts in mind.

Managing User Identity


During implementation, ensure Event tracking is functioning as expected with Segment by testing activity and monitoring the Events that come into the Live View tab in your Mixpanel project and Segment’s Live Debugger. The Mixpanel Live View report allows you to see Events arrive in your project in real time and examine the exact properties that are sent with them to ensure you implemented correctly.

Segment Integration Guide

For additional information on getting started, visit Segment’s Mixpanel documentation.

Segment FAQ

I can’t see my Segment data in Mixpanel

This could be due to several reasons:

  • Storing data in the EU: A common issue is that the data in Segment is enabled to be sent to an EU endpoint but the Mixpanel data is still being stored outside of the EU. Both endpoints for Segment and Mixpanel need to point to the EU as described here:
    If you have an existing Mixpanel project, you might need to have your data migrated to the EU. Please find further information here.
  • Cloud implementation vs. device implementation: Segment can be implemented via a cloud-based implementation or as an SDK on the device directly. Device implementation will send the data to Mixpanel directly while the cloud implementation will send it to Segment first. You can confirm your implementation by querying for the Mixpanel library property of the events in your project:
    • Cloud Mode will show as Mixpanel Library: Segment: analytics.js
    • Device Mode will show as Mixpanel Library: Segment: web
  • No user profile data in Mixpanel: Segment doesn’t track Mixpanel People by default; this is a setting you need to enable in your Segment settings. To enable Mixpanel People, change the “Use Mixpanel People” setting in your Segment Settings UI.

I see events counted multiple times in Mixpanel

Mixpanel SDKs assign an insert_id to each tracked event:

This allows Mixpanel to ensure no event is tracked more than once and events will be deduplicated based on the insert_id. Segment does not assign an insert_id to events. If the ingestion of an event is not confirmed by Mixpanel’s servers fast enough, Segment will retry to send the event.

This can lead to duplicate events in Mixpanel, they will likely have different insert_ids as Mixpanel assigns each event without an insert_id a unique new one. This behavior can be caused by sending huge batches of data at the same time and can be avoided by reducing the batch size and frequency of event sending from Segment to Mixpanel.

Identify/Alias with Segment

  • If users are in device mode, please note that this is like a regular Mixpanel implementation. Mixpanel will generate distinct_ids (it will not use Segment’s anonymous_id as a distinct_id).
  • If users are in cloud mode, think of it as a server-side implementation. Mixpanel does not play any part in generating distinct_ids. This is left up to Segment and the user’s implementation.
  • The Segment alias method analytics.alias() acts the same as the Mixpanel alias method.
  • The Segment identify method analytics.identify() does the same as the Mixpanel identify method plus more. It will update the distinct_id of the cookie (in device mode) and if you send an object as the second argument in the identify call, it will automatically trigger a people.set() as well and it will set those user properties as super properties.
  • Please find Segment's Alias docs here and Identify docs here.

Register super properties with Mixpanel

Super properties can only be set when you are running in device mode. The super properties are automatically set with every property you pass into the analytics.identify() method. To have more control over the super properties you set, you can explicitly set super properties in your Segment settings.

Page tracks from Segment to Mixpanel

Page calls are automatically tracked via Segment. These can be tracked from Segment to Mixpanel as Loaded a Page or Loaded a Screen. To turn them off, you need to configure this in your Segment settings.

Integrating Group Analytics via Segment

There are 4 parts to Implementing Group Analytics via Segment.

1. Define the Group Key in Mixpanel and Segment

Create the Group Key in Mixpanel Project Settings


Create the Group Identifier Trait in Segment’s Mixpanel Destination Settings


Make sure the value placed in Segment’s “Group Identifier Trait” row matches Mixpanel’s “Group Key”.

2. Create Group Profiles will create Group Profile/Group Profile Properties in Mixpanel. Mixpanel uses the key specified in the second argument of the group method.


Example Group Profile/Group Profile Properties created from the group method:


3. Add Group Key as a User Profile Property

In order to use Group Profile Properties when analyzing User Profiles, the user profile must have the Group Key/Group ID Value as a profile property.

Declare the Group Key in the identify method as a profile property (trait)


4. Add Group Key as an Event Property to Events

In order to connect events to a Group, the event must have the Group Key/Group ID Value as an event property.

If you are using Segment Device Mode:

If you are using Segment Cloud Mode:

  • The Group Key must be explicitly declared as an event property on every event track call in order for the event to be compatible with Group Analytics


Different MTU count

Resetting the Mixpanel cookie

Segments analytics.reset() method is not mapped to the Mixpanel reset method. You can clear the cookie manually with window.mixpanel.cookie.clear().

Validate requests Segment is sending to Mixpanel

For debugging purposes, it can be useful to see exactly what Segment is sending to Mixpanel. You can validate this data through the Segment debugger. In the Segment debugger, you can select the event you are looking to validate: 

Click the “Validate” button in the top right corner and choose “Mixpanel” as the destination. After the event has been sent, you can click to view the request from Segment to grab the data payload:

You can then copy the data payload and decode it in a base64 decoder to see the JSON event that was sent to Mixpanel.

Did this answer your question?



Article is closed for comments.