Skip to main content
Gainsight Inc.

Mixpanel: Enabling the Integration

Overview

Mixpanel is a customer data platform that captures customer usage data from your website and transmits the data to any system that is integrated with Mixpanel. You can integrate Mixpanel with Gainsight to import customer usage data into the MDA objects. Example: Usage data includes the pageviews on a product in an ecommerce site or tracking of the customer activities in your website over a period of time. Usage data stored in Gainsight can be analysed and is helpful to design a better product, provide amazing customer service, grow your audience, etc.

This article guides you through how to set up the Mixpanel integration with Gainsight. With this integration, all of your Mixpanel event data is accessible in Gainsight.

Integration of Mixpanel with your Application

You can integrate Mixpanel with your application by installing the Mixpanel web tracking code into your website.

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

If Mixpanel is not installed on your website, follow the instructions in this link https://mixpanel.com/help/reference/tracking-an-event to add the Mixpanel Javascript library directly to your site. The following image displays an example of the web tracking code.

Note: You must use your own project's token.

1. Install Web Tracking Code

Tracking Usage Data

3. Tracking Page Loads

The above code snippet contains three properties that are recommended to use for the Mixpanel integrations.

Mixpanel is a powerful event-based analytics solution. In this documentation, how to track page loads are covered as part of the Gainsight integration.

  1. To track page loads with Mixpanel, you should add a track API call that is called when the page is loaded. 
  2. Details related to the page are passed as properties with the event. 
  3. Mixpanel allows you to tie a user to his actions on the UI and record traits about them. It includes a unique User ID and any optional traits like their email, name, etc.
  4. In the above code snippet, there are three properties that are recommended to use for the Mixpanel integrations.

Note:  Events and the associated properties are used throughout this documentation.

  1. For example, pass the following three properties along with the pageLoad event:
  • pageTitle: 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.
  • pagePathLevelOne: 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.
  • pageURL: This property tracks every page individually. Best suited for websites with a small number of distinct URLs.

If you pull all the Mixpanel code outlined together, your code on all the webpages looks similar to the following example.

Get API Secret Key of the Mixpanel Project

You can obtain the API Secret Key of the Project in the Mixpanel website from which you want to import data into the MDA objects. To collect the API secret key:

  1. Login to the Mixpanel website with your credentials. Navigate to Profile > Account as shown below:

Mixpanel_Website.png

  1. Navigate to the Projects tab. Copy the API Secret Key in the project from which you want to import data into the MDA objects.

MP Projects.png

Configure Mixpanel Integration within Gainsight

Recommendations

Gainsight supports Events, People, and the associated properties from Mixpanel to track the page loads on your website. For more information, refer Tracking Usage Data.

Prerequisites

  1. Integrate Mixpanel with your application by installing web tracking code. For detailed information, refer Integration of Mixpanel with your Application.
  2. Create or make sure to have the MDA custom objects as required for storing Event and People data. For more information on how to create custom objects, refer Gainsight Data Management.
  3. While creating an object, ensure that the following fields are included, at a minimum:
  • Account Identifier
  • Event Identifier
  • Time Identifier
  • User Identifier
  • User First Name
  • User Last Name
  • User Email

In addition, you can add any field that you feel is necessary for mapping the Mixpanel project.

  1. Copy API Secret Key from the Mixpanel Project from which you want to import data into the MDA objects. For more information, refer Get API Secret Key of the Mixpanel Project.

Connectors

To access the Mixpanel connector, navigate to Administration > Connectors 2.0 > Connectors.

In the Connectors section, you can see the Mixpanel connector where you can configure its integration with Gainsight.

Admin > Connectors 2.0.png

Create a Mixpanel Connection

Create a connection to integrate Mixpanel with Gainsight.

  1. Click the Mixpanel widget and click Create Connection icon.

Mixpanel widget.png

  1. Enter the following details in the Create a Connection dialog box:
    1. Name: Enter Connection Name, for example: Web Usage Data.
    2. API Secret Key: Enter the API secret key copied from your project in the Mixpanel website.
    3. Timezone: Select the timezone from the list. Always select a timezone in which your project is configured in the Mixpanel website.

Note: If you select a timezone different than the one configured in your Mixpanel project, the data is likely to contain errors.

Create a Connection dialog.png

  1. Click TEST CONNECTION. This validates the Mixpanel connection with the help of the API secret key. If the API secret key is valid, it displays as Connection Successful message as shown below.

Connection Successful.png

  1. Click CREATE. A Connection is successfully created. You can now create a data job to import usage data into the MDA object.

Create a Mixpanel Data Job

  1. Click Create Job icon in the connection.

Create a Job.png

Note: Under one connection, Admins can set up one data job to import usage data into the MDA object.

  1. Five sections, Job Details, Get MetaData, Map MetaData, Import Data and Review Data Imported & Reports appear. In this data job, Mixpanel is integrated with Gainsight to import customer usage data of a company’s website.

Job Details

  1. In the Job Details section:
    1. Job Name: Enter a unique Job Name. For example, Web Usage Data as shown below.
    2. Engagement type: Click the + icon. Gainsight supports two engagement types: Event and People to track the customer usage data.
    3. Select the engagement type Event and/or People.
    4. Click Save.

Job Details.png

Get Metadata

  1. Select the date range from which you want to fetch usage metadata. This will pull all events in the date range selected. You can select a date range of maximum 7 days.

Note:  By default, date range is pre-populated for last 5 days.

  1. In the Notification recipients, enter:
  • Success recipients: If metadata import is successful, a success notification email is sent to the email addresses entered here.
  • Failure recipients: If metadata import is failed, a failure notification email is sent to the email addresses entered here.

Note: By Default, 'Success' and 'Failure' fields are populated with the current user email address.

Get Metadata.png

  1. Click FETCH METADATA. You can see a message in the UI as shown below:

Message.png

  1. You will receive a success notification of the meta data generation via email as shown below. If the meta data generation fails, you will see a failure notification accordingly.

Email Notification_Metadata Generation.png

  1. Click SHOW MAPPINGS to navigate to the Map Metadata section. A message Mappings Fetched Successfully appears.

Map Metadata

Events Mapping
  1. Select a custom MDA object to load events data from Mixpanel. For example, Mixpanel Events as shown below.
  2. Under the Required tab, map Mixpanel metadata to the fields in the MDA object Mixpanel Events for the Account, Event, and Time identifiers as shown below:

Events Mapping.png

  1. Transformation:
    1. If you want to transform the event records, click Transformation icon in the Account and Event Identifiers. Dialog-box for transformation appears.

Transformation_Events.png

  1. In the Transformation dialog-box, you can: 
  • Assign a default value for the null records
  • Change the letter case of the records to lower or upper
  • Replace the source record with a given value when it matches.
  1. Click Apply.

Notes:

  • Transformation on the Event and Account identifier records is optional.
  • You cannot perform transformation on the Time Identifier records.
  1. Under the Additional tab, click ADD to map additional Mixpanel metadata to the fields in the MDA object.

Events_Additional Fields.png

People Mapping
  1. Select a custom MDA object to load People data from Mixpanel. For example, Mixpanel People as shown below.
  2. Under the Required tab, map Mixpanel metadata to the fields in the MDA object Mixpanel People for User Identifier, First Name, Last Name, and Email as shown below:

People Mapping.png

  1. If required, apply transformation on the Identifier, First Name, Last Name, and Email records of the users. For more information on transformation, refer to Events Mapping.
  2. Under the Additional tab, click ADD to map additional Mixpanel metadata to the fields in the MDA object.

Import Data

  1. You can import data from Mixpanel using either of the options:
  • Import Now: Use this option to import data now from Mixpanel into the MDA objects. You can select a date range of maximum two weeks and import data available in that period. 

Note: If you want to import data for more than two weeks, you can use the import option multiple times with the corresponding date ranges.

Import Now.png

  • Scheduled Import: Use this option to import data from Mixpanel on a scheduled basis daily. The scheduler runs everyday at the Time specified by the user, and fetches the data of N days prior to the scheduled run date. Example: To import Yesterday's data, N days should be set to 1. Similarly to import data of the last two days, N days should be set to 2. You can see timezone of the Mixpanel Connection here.

Schedule Import.png

  1. In the Notification recipients, enter:
  • Success recipients: If data import is successful, a success notification email is sent to the email addresses entered here.
  • Failure recipients: If data import is failed, a failure notification email is sent to the email addresses entered here.

Note: By Default, 'Success' and 'Failure' fields are populated with the current user email address.

  1. Click START DATA IMPORT. You can see a message in the UI as shown below:

Data Import Success Message.png

  1. You will receive success notifications for data import of Events and/or People via emails separately. If the data import is failed for Events and/or People, you will receive a failure notification accordingly. Success notification for data import of Events is shown below:

Notification_Events Data Import.png

Success notification for data import of People is shown below:

Notification_People Data Import.png

Review Data Imported & Reports

In this section, you can review Mixpanel data of the Engagement types, Event and People in the separate sub-sections as shown below:

Review Import Data.png

Data Jobs

In the Data Jobs section, you can see the list of data jobs performed through Mixpanel. You can edit or delete the existing data jobs from here.

Data Jobs.png

Logs

In the Logs tab, you can see the execution and audit logs of the Mixpanel Data Jobs. You can sort the logs with a specific data job.

Logs.png

Usage Data Aggregation

You can perform aggregations of the customer usage data with Bionic Rules. To perform the usage data aggregations and to schedule them, refer Tutorial - Aggregate Usage Data with Bionic Rules.

If you have questions or feedback about the feature explained in this article, please share them on community.gainsight.com.

  • Was this article helpful?