Skip to main content
Gainsight Inc.

Mixpanel: Enabling the Integration

This article will guide you through how to set up the Mixpanel integration. With this integration, all of your Mixpanel event data is accessible in Gainsight. Out-of-the-box, 7 fields are available for aggregation, but you can also build additional aggregation using the Gainsight Rules Engine. 

Install Web Tracking Code

1. Install Web Tracking Code

If the Mixpanel web tracking code is already installed on your website you may skip this step.

If Mixpanel is not installed on your website, please follow the instructions here to add the Mixpanel Javascript library directly to your site. An example is given above (you must use your own project token).

Identifying Accounts

Metrics for a user on your site can only be viewed in Gainsight if there is a unique Account identifier present for that user in both Mixpanel and Salesforce. We will call this the "Usage Data ID". The Usage Data ID can be a string or number. Examples of valid Usage Data IDs are:

  • Salesforce Account ID
  • Fully Qualified Domain Name
  • Account Identifier used internally at your company

Examples of invalid Usage Data IDs are:

  • Email addresses (may be more than one per account)
  • Customer Name (prone to inconsistencies)
  • Contract Date (neither string nor number)

Once you have decided on a Usage Data ID you must ensure that it is present in both Mixpanel and Salesforce. The Usage Data ID must be kept updated in both locations.

1. Salesforce

You must store the Usage Data ID on the Salesforce Account object. Gainsight recommends that you add a new field to the Account object to store this value. For assistance with adding SFDC custom fields, please contact your Salesforce Administrator.

2. Mixpanel

The Usage Data ID should be stored in Mixpanel as a Super Property. This will ensure that all actions for the user that has been identified through Mixpanel will be associated with the Usage Data ID. Add the following line to the web tracking code used on every page:

Where <Usage Data ID> uniquely identifies the account from which the customer is associated with. This may require extra code elsewhere in your application to ensure the Usage Data ID is retrieved in time.

Tracking Page Loads

3. Tracking Page Loads

Mixpanel is a powerful event-based analytics solution. In this documentation we will only cover how to track page loads as part of the Gainsight integration.

To track page loads with Mixpanel you should add a track API call that is called when the page is loaded. Details related to the page should be passed as properties with the event. Above I have given an example code snippet with three properties that are recommended to use for Mixpanel integrations. Please note: this is the event and associated properties that we will use throughout this documentation.

We pass three properties along with the pageLoad event:


This property tracks the name assigned to the page, ignoring URL structure. Best suited for websites where almost every URL is unique or where the URLs do not follow a folder structure.


This property groups URLs into a folder hierarchy and aggregates metrics for all pages under the top level folder. Best suited for websites with a large number of URLs organized hierarchically.


This property tracks every page individually. Best suited for websites with a small number of distinct URLs.

Pulling all Mixpanel code outlined together you should have something that looks like the image above on all of your webpages.

Activate Gainsight MDA Backend

4. Activate Gainsight MDA Backend

Gainsight pulls usage data in through the MDA backend. Before you can pull data from Mixpanel you must activate the MDA. If you have already set this up for other MDA features you may skip this step.

In order to activate the MDA, your Salesforce user must have the Gainsight Admin permission set. For details on how to apply this permission set to your user, please view the following documentation: Gainsight Permission Sets

The first step in MDA activation is to go to navigate to Gainsight's Administration > Connectors page.

If you are experiencing issues with this page loading, please contact Gainsight Support (

Once in Connectors, activate the Authorize MDA switch:

Then, authorize Gainsight MDA to use your Salesforce data by clicking on "Authorize".

Click "Allow"

Click "Close"

Configure Mixpanel Integration within Gainsight

Before the Mixpanel Integration can be configured you must first activate the Mixpanel Connector by activating the Mixpanel switch.

Copy and paste the API key and API secret from your Mixpanel account into the fields provided then click Save.

Once you have connected to Mixpanel, select a date range for data to start using. Ensure that "Notify me when Data fetch completes" is checked and then click Fetch Data.

You will see a message confirming that data is being pulled from Mixpanel.

At this point you will have to wait for Gainsight to pull the data from Mixpanel and load the data into the MDA backend. Please note: you must wait at last 24 hours after sending your first datapoint to Mixpanel for the data load to take place. This is a constraint of the Mixpanel API.

Once the data is available to pull in return to the Connectors page. You should now see a Show Mappings button at the bottom of the page. Click it to continue.

Map Mixpanel Events and Properties to MDA Equivalents

You should now see four primary fields that you need to identify for the MDA backend. Select the fields shown in the image below, then click Next.

Link Usage Data ID Field to Salesforce

You will then be prompted to select an Account-Identifier and a User-Identifier.

For the Account-Identifier select the field from the drop down menu that contains the Usage Data ID on the Account object. Once the page appears as the image below, click Next.

Add Required and Optional Fields

In step 6 under the "Add Required Fields" section, ensure that Salesforce is selected in the first drop down menu and "Track distinct_id" is selected in the two following. In step 7 under "Add Optional Fields" select the properties shown in the image above, along with the corresponding labels. Then click Next.

Note: You can add up to six optional fields.

Gainsight Measure Selection

Select the "pageLoad" event from the drop down, then click Next.

Schedule Aggregations

In the final step of the configuration select the "Schedule" radio button. In the Schedule dialog, select "Daily" and "Every day" as the frequency. Set "Start Date" as today and "End Date" as Dec 31st 2019. Finally, set "Preferred Start Time" to 8:00PM.

Finally click "Save and Run".

  • Was this article helpful?