Migrating to Mixpanel from Google Analytics
Mixpanel’s data model is based on events and properties, rather than sessions. While this might be a shift if you come from the sessions-based model, we’ve found it to be both more flexible and easier to set up and use.
- An event (opens in a new tab) captures a granular user action, like a Pageview, Signup, or Purchase.
- Properties (opens in a new tab) capture attributes of those events, like which page was viewed, the UTM Campaign that led to a Signup, or the Item that was purchased.
Events let you get more granular than sessions (opens in a new tab), so that you can deeply understand user behavior. At the same time, Mixpanel automatically constructs sessions from events, so you can answer session-level questions too.
Read on to learn how to migrate to Mixpanel’s modern, event-based model.
Currently using Universal Analytics with Google?
Part 1: Track forward looking real-time data
Choose your current implementation method for Universal Analytics (UA) and you can follow the below steps for starting to send live data to Mixpanel.
-
Client-side SDKs & Server-side SDKs: You’ll have to setup Mixpanel fresh given Mixpanel leverages an event-based model that does not exist in Universal Analytics. The good news is you can get started within an hour, which is lesser or equivalent work to setting up GA4.
We recommend the following steps to get started quickly:
-
Configure the Mixpanel JavaScript SDK (opens in a new tab) to automatically track page views, where UTM params are tracked by default
mixpanel.init('YOUR_TOKEN', {track_pageview: true});
-
Track a few key conversion events of interest
// Send a "Played song" event to Mixpanel // with a property "genre" mixpanel.track( "Played song", { "genre": "hip-hop" } );
-
Use the Mixpanel Marketing KPI Template (opens in a new tab) to build your initial board
It’s equal effort to set up GA4 or set up Mixpanel from an SDK perspective, since both need a fresh implementation to be setup on an “events” model vs UA’s “sessions” model.
-
-
Google Tag Manager (GTM): Mixpanel has a Google Tag Manager (GTM) custom template (opens in a new tab) which can be leveraged to implement events within an hour. The template initializes the Mixpanel JavaScript SDK with similar calls as outlined in the above section.
We recommend setting up the following in the custom template to get started quickly: a) Choose to auto-track pages, b) Set your conversion events. Once done, Mixpanel will start receiving page views and key conversion events.
-
Customer Data Platforms (CDPs) like Segment (opens in a new tab): CDPs have always tracked event data and synthesized them into sessions for Universal Analytics. You can add Mixpanel as a destination to your CDP and immediately start receiving the same data as your other destinations.
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:
Part 2: Loading Historical Data
For most cases, we recommend starting fresh. In the cases where historical data is essential, we recommend loading a year’s worth (or less) of historical data during your migration. This will allow your team to review year-over-year trends easily and do historical analysis as needed. To backfill data, we recommend:
- If you have a CDP, this should be straightforward
- Utilize the CDPs backfilling feature, like Segment Replay (opens in a new tab), to re-send historical data to Mixpanel
- For any other implementation method
- First, export your data to the data warehouse so you have a record of Universal Analytics
- Once exported, your data warehouse tables can be transformed and modeled into the event format (opens in a new tab) Mixpanel expects
- Leverage our Import API (opens in a new tab) to send us the formatted events from your data warehouse It is also recommended you load the historical data into a test project with a limited subset (for ex, a single day of data or a sample of the entire dataset) to get started. This will help you identify any errors in the end to end process before you do a full historical data load. The process of importing old data with a different format has many potential issues - identity management, data discrepancies, etc. - as Mixpanel is fundamentally different than UA. It may be worth considering your use cases for importing old data before proceeding, as matching users and data across the systems can be time consuming. Mixpanel Support is here to help if you need advice how to go about importing the historical data.
Currently using GA4 and not seeing value?
Part 1: Track forward looking real-time data
Choose your current implementation method for Google Analytics (GA4) and you can follow the below steps for starting to send live data to Mixpanel.
-
Client-side SDKs & Server-side SDKs: Mixpanel and GA4’s client-side SDKs have very similar developer facing APIs. This makes it fairly easy to “find and replace” embedded GA4 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, etc.)
Events
GA4 method
gtag('event', 'event_name', { 'param1': 'value1', 'param2': 'value2' });
Mixpanel method
mixpanel.track('event_name', { 'param1': 'value1', 'param2': 'value2' });
Identity Management
GA4 method
gtag('config', 'GA_MEASUREMENT_ID', { 'user_id': 'USER_ID' });
Mixpanel method
mixpanel.identify('USER_ID');
User Properties
GA4 method
gtag('set', 'user_properties', { 'property1': 'value1', 'property2': 'value2' });
Mixpanel method
mixpanel.people.set({ 'property1': 'value1', 'property2': 'value2' });
Super Properties
GA4 method → GA4 doesn't have a direct equivalent, but you can set global properties on the SDK config we recommend moving to Mixpanel
gtag('config', 'GA_MEASUREMENT_ID', { 'custom_map': { 'dimension1': 'property1', 'dimension2': 'property2' }, 'property1': 'value1', 'property2': 'value2' });
Mixpanel method
mixpanel.register({ 'property1': 'value1', 'property2': 'value2' });
Keep in mind that you will need to initialize the Mixpanel SDK (opens in a new tab) by adding the Mixpanel snippet to your website before using these tracking calls. Replace the placeholders (e.g., 'event_name', 'USER_ID', 'value1', etc.) with the appropriate values from GA4 in your code as you migrate the code.
-
Google Tag Manager (GTM): Mixpanel has a Google Tag Manager (GTM) custom template (opens in a new tab) which can be leveraged to implement events within an hour. Simply load the template, and you can send Mixpanel the same events you’ve setup for your GA4 instance.
This method is straightforward since you’ve already setup your SDK to track “events” and are using Google Tag Manager. You can leverage this same setup to implement Mixpanel.
-
Customer Data Platforms (CDPs) like Segment (opens in a new tab): CDPs will already be tracking events to GA4 that you want to duplicate to Mixpanel. You can add Mixpanel as a destination to your CDP and immediately start receiving the same data as your other destinations.
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:
Part 2: Loading Historical Data
For most cases, we recommend starting fresh. In the cases where historical data is essential, we recommend loading a year’s worth (or less) of historical data during your migration. This will allow your team to review year-over-year trends easily and do historical analysis as needed. To backfill data, we recommend:
- If you have a CDP, this should be straightforward
- Utilize the CDPs backfilling feature, like Segment Replay (opens in a new tab), to re-send historical data to Mixpanel
- For any other implementation method
- First, export your data to BigQuery (provided for free with GA4) so you have a record of the data
- Since GA4 data is events (and not sessions), the data exported to BigQuery should already be formatted for Mixpanel (opens in a new tab)
- Then leverage the Import API (opens in a new tab) or a Reverse ETL (opens in a new tab) tool like Census (opens in a new tab) to import to Mixpanel It is also recommended you load the historical data into a test project with a limited subset (for ex, a single day of data or a sample of the entire dataset) to get started. This will help you identify any errors in the end to end process before you do a full historical data load. Mixpanel Support is here to help if you need advice how to go about importing the historical data.