Skip to main content
Gainsight Inc.

Mixpanel: Enabling the Integration

Gainsight NXT

 

IMPORTANT NOTE: Gainsight is upgrading Connectors 2.0 with Horizon Experience. This article applies to tenants which are yet to be upgraded to the Horizon Experience of Connectors 2.0. If you are using Connectors 2.0 with Horizon Experience, you can find the documentation here.

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 Gainsight 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 integrate Mixpanel with Gainsight. With this integration, all of your Mixpanel event data is accessible in Gainsight.

Integrating 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 project's tokens.

1 project's tokens.png

Tracking Usage Data

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

2 Tracking Usage Data.png

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

  1. To track page loads with Mixpanel, you should add a track API call, which is invoked 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.

    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.

3 Mixpanel code outlined.png

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 Gainsight objects. To collect the API secret key:

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

4 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 Gainsight objects.

5 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 the Integration of Mixpanel with your Application section in this article.
  2. Create or ensure that you have the Gainsight 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 Gainsight objects. For more information, refer the Get API Secret Key of the Mixpanel Project article.

Connectors

To access the Mixpanel connector:

  1. Navigate to Administration > Connectors 2.0 .
  2. Click the CONNECTORS tab.
  3. Click the mixpanel widget.

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

Create a Mixpanel Connection

Create a connection to integrate Mixpanel with Gainsight.

  1. Click the Create Connection icon. Create a Connection dialog box appears.

7  Create a Connection.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 a 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.

8 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.

9 Connection_Successful.png

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

Create a Mixpanel Data Job

  1. Click Create Job icon in the connection.

10 Create_a_Job.png

     Note: Under one connection, Admins can set up one data job to import usage data into the Gainsight 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.

11 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.
  2. 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 logged-in email address.

12 Get_Metadata.png

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

13 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.

14 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 Gainsight custom 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 Gainsight object Mixpanel Events for the Account, Event, and Time identifiers as shown below:

15 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.

16 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 Gainsight object.

17 Events_Additional_Fields.png

People Mapping
  1. Select a Gainsight custom 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 Gainsight object Mixpanel People for User Identifier, First Name, Last Name, and Email as shown below:

18 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 Gainsight 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 Gainsight objects. You can select a date range of maximum of 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.

20 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.

21 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:

22 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:

23 Notification_Events_Data_Import.png

Success notification for data import of People is shown below:

24 Notification_People_Data_Import.png

Review Data Imported and Reports

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

25 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.

26 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.

27 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 to the Aggregate Usage Data with Rules Engine article.

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


 

  • Was this article helpful?