Migrating To Mixpanel From Amplitude
If you haven't already, we recommend starting with our Migration Guides Overview as it details the key components of migrating to Mixpanel from other analytics tools. Below we outline specific steps and considerations when migrating from Amplitude.
Differences in the data models
Both Mixpanel and Amplitude are product analytics tools which collect event-based behavioral data about your users. Events (opens in a new tab) are commonly expressed as JSON which represent the name of the user action, the ID of the user, the time at which the action took place, and all associated metadata. Events are immutable, and represent data at the time of which an action takes place.
{
"event": "Signup",
"properties":
{
"time": 1618716477000,
"distinct_id": "91304156-cafc-4673-a237-623d1129c801",
"$insert_id": "29fc2962-6d9c-455d-95ad-95b84f09b9e4",
"Referred by": "Friend",
"URL": "mixpanel.com/signup"
}
}
In addition to events, Mixpanel supports an additional type of data that Amplitude does not. This data is known as user profiles (opens in a new tab), which represents dimensional data that is always updated to the most recent value for a user. User data allows you to segment your reporting by both historical point-in-time data as well as real-time dimensional data about your users.
{
"$distinct_id": "13793",
"$set":
{
"name": "Robert"
}
}
We also support additional data for extending your use cases with Mixpanel:
- Group profiles (opens in a new tab): Used with our Group Analytics product add-on to allow you to pivot quickly between users and other entities in your analysis. A common use case is for a B2B company to pivot between analyzing users and analyzing accounts.
- Lookup tables (opens in a new tab): For event data which was already sent, you can use these to extend the data already sent into Mixpanel. A common use case is taking an identifier like a transaction ID, item ID, etc. and using lookup tables to enrich the data with additional information like the amount, category, etc. from your data warehouse.
Identifying your implementation method
Mixpanel accepts event data from a variety of different sources. Choose your implementation method first and then you can follow the below steps for sending data to Mixpanel.
We support the following data collection mechanisms:
- Client-side SDKs & Server-side SDKs: Simply replace Amplitude code calls to track events with Mixpanel calls instead
- Customer Data Platforms (CDPs) like Segment (opens in a new tab): Go into your CDP settings to add Mixpanel as a destination, and point your data stream to Mixpanel
- Import API: Point your event ingestion pipeline to Mixpanel’s robust API (opens in a new tab) for data ingestion
- Reverse ETL (RETL) tools like Census (opens in a new tab): Go into your RETL settings to add Mixpanel as a destination, and point your syncs to Mixpanel
Client-side SDKs & Server-side SDKs
Fortunately, Mixpanel and Amplitude’s client side SDKs have very similar developer facing APIs. This makes it fairly easy to “find and replace” embedded Amplitude calls and swap them for Mixpanel calls.
This section will detail the Javascript SDKs (for the sake of brevity), although both analytics platforms have fairly uniform tracking APIs for other SDKs (mobile, server-side).
Amplitude JS Docs: https://amplitude.github.io/Amplitude-JavaScript/ (opens in a new tab)
Mixpanel JS Docs: https://developer.mixpanel.com/docs/javascript-full-api-reference (opens in a new tab)
Note: Ensure that your projects have been defaulted or updated to Simplified ID Management before any data is sent to the project. This is the ID management compatible with Amplitude’s.
Installing the Mixpanel SDK
Before getting started, initialize the Mixpanel SDK according to the directions here (opens in a new tab)
Initialization
Amplitude’s init()
method:
var amplitudeClient = new AmplitudeClient();
amplitudeClient.init('API_KEY')
Mixpanel’s init()
method:
mixpanel.init('new token')
Docs Reference (opens in a new tab)
Initialization (init) options (opens in a new tab)
Events
Amplitude’s logEvent()
method:
amplitudeClient.logEvent('Clicked Button', {'finished_flow': false });
Mixpanel’s track()
method:
mixpanel.track('Clicked Button', {'finished_flow': false })
Docs Reference (opens in a new tab)
Identity Management
Amplitude’s setUserId()
method:
amplitudeClient.setUserId('joe@gmail.com');
Mixpanel’s identify()
method:
mixpanel.identify('joe@gmail.com')
Docs Reference (opens in a new tab)
User Properties
Amplitude’s setUserProperties()
method:
amplitudeClient.setUserProperties({'gender': 'female', 'sign_up_complete': true})
Mixpanel’s people.set()
method:
mixpanel.people.set({'gender': 'female', 'sign_up_complete': true})
Note: identify()
should be called at some point in each user’s session to propagate people methods
Docs Reference (opens in a new tab)
Group Analytics
Amplitude’s setGroup()
method:
amplitudeClient.setGroup('orgId', 15);
Mixpanel’s set_group()
method:
mixpanel.set_group('orgId', 15)
Docs Reference (opens in a new tab)
Customer Data Platforms (CDPs)
Since CDPs already collect all your data via 1 SDK and route to many downstream destinations, enabling Mixpanel is straightforward. Simply go to your CDP settings and add Mixpanel as a destination:
Once you set up the connection to Mixpanel, you can proceed with configuring key settings like:
- Which events and properties to send → only send what matters
- Edit any mappings/editing/filtering that has to be done on the data → ensure high data quality and governance
- Connection settings, or CDP specific settings for data syncs → control over how data is sent
We provide Mixpanel as a destination and setup guides for all of the most popular CDPs:
Note depending on your CDP provider, they may also be able to help with migrating historical data as well. Features like Segment Replay (opens in a new tab) enable you to quickly backfill historical data during your migration versus needing to do this work with your developer resources.
Import API
If you currently send data to Amplitude directly to their API, you can simply swap out the Amplitude API with the Mixpanel API.
Sending Events
Amplitude’s /track
API Endpoint is https://api2.amplitude.com/2/httpapi
(documented here (opens in a new tab)). A sample request from your server for this API would look like:
curl -X POST https://api2.amplitude.com/2/httpapi \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
--data '{
"api_key": "YOUR_API_KEY",
"events": [{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial"
}]
}'
Mixpanel’s /track
API endpoint is https://api.mixpanel.com/import
(documented here (opens in a new tab)). A sample request from your server for this API would look like:
curl --request POST \
--url 'https://api.mixpanel.com/import?strict=1&project_id=%3CYOUR_PROJECT_ID%3E' \
--header 'Content-Encoding: gzip' \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'authorization: Basic cnlhbjpyeWFu' \
--data '[
{
"event": "string",
"properties": {
"time": 0,
"distinct_id": "string",
"$insert_id": "string"
}
}
]'
The big difference between the APIs are:
- Authentication: Amplitude authenticates in the request payload, whereas Mixpanel uses your project token in the request URL alongside basic auth. Mixpanel authentication can be done via a service account as described here (opens in a new tab). Be sure to move the authentication outside the payload.
- Event JSON Structure: Amplitude and Mixpanel have slightly different structures (explained here). You will want to remap the Amplitude event format to the expected Mixpanel JSON payload as described here (opens in a new tab).
Reverse ETL (RETL)
If you already send data to Amplitude with your data warehouse as the source of truth using reverse ETL, sending data to Mixpanel requires adding a new destination and syncing the same models you have been syncing to Amplitude. This option is like a hybrid between the CDP and Import API options above - you can use the reverse ETL tool to set Mixpanel up simply as a destination and then the tool will handle all of the remapping at the API level for you.
Simply go to your RETL settings and add Mixpanel as a connection:
We provide Mixpanel as a destination and setup guides for all of the most popular RETL tools:
Not sure where to start or need help?
If you're unsure how you currently track data, or might want to consider tracking data differently as you migrate to Mixpanel, we recommend starting here (opens in a new tab).
Mixpanel Customer Success and Support have been helping thousands of customers migrate from other tools to Mixpanel over the past decade. You can see an overview of the process we run with our Enterprise plan customers migrating from Amplitude here (opens in a new tab).
We’re always happy to discuss your team’s individual needs, our migration process, the support you’ll receive, or any other question you have — drop us a line at success@mixpanel.com.