Skip to main content
Gainsight Inc.

Google Analytics: Enabling the Integration

This article will guide you through how to set up Google Analytics Integration.

Table of Contents

  1. Install web tracking code
  2. Identifying Accounts
  3. Activate Gainsight MDA Backend
  4. Configure Google Analytics Integration within Gainsight
  5. Map Google Analytics Dimensions & Metrics to MDA Equivalents
  6. Link Usage Data ID Field to Salesforce
  7. Add Required Fields
  8. Schedule Aggregations

1. Install web tracking code

If the Google Analytics web tracking code is already installed on your website you may skip this step. Gainsight will work with both Classic Google Analytics and the newer Universal Analytics. Gainsight recommends using Universal Analytics where possible. Please view the Universal Analytics Upgrade documentation from Google to learn how you can migrate to the latest version of Google Analytics: https://developers.google.com/analyt...ction/upgrade/

If Google Analytics is not installed on your website, please follow the instructions here https://support.google.com/analytics...upChecklist#GA to add the web tracking code directly to your site.

2. 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 Google Analytics 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 Google Analytics 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.

The Usage Data ID should be stored in Google Analytics as a Custom Dimension. To set up a new custom dimension you must not have exceeded the maximum number of dimensions allowed by Google (20 for free accounts, 200 for Premium accounts). Add a new dimension by following the instructions here: https://support.google.com/analytics...9827&ctx=topic. The dimension should have the name "dimensionX" where X is a number between 1 and 20 (Premium: 200). The scope of the dimension can be Hit, Session or User. You should then add the following line to the web tracking code used on every page:

2. Universal Analytics

2. Universal Analytics

The Usage Data ID should be stored in Google Analytics as a Custom Dimension. To set up a new custom dimension you must not have exceeded the maximum number of dimensions allowed by Google (20 for free accounts, 200 for Premium accounts). Add a new dimension by following the instructions here: https://support.google.com/analytics...9827&ctx=topic. The dimension should have the name "dimensionX" where X is a number between 1 and 20 (Premium: 200). The scope of the dimension can be Hit, Session or User. You should then add the above line to the web tracking code used on every page
 

Where 'dimensionX' is the dimension and number that you have just added, and <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. See below for an example tracking code with the Usage Data ID set as a Custom Dimension.

3. Classic Google Analytics

The Usage Data ID should be stored in Google Analytics as a Custom Variable. Google provides 5 slots for custom variables and one of these must be used to store the Usage Data ID. Depending on whether you use the Asynchronous or Traditional syntax the code will look different.

Gainsight recommends using Universal Analytics where possible. Please view the Universal Analytics Upgrade documentation from Google to learn how you can migrate to the latest version of Google Analytics: https://developers.google.com/analyt...ction/upgrade/

In the examples below slot 1 is used for the custom variable. Please ensure the slot number that you choose is not used elsewhere in your instrumentation.

Asynchronous

Asynchronous

Traditional

Traditional

3. Activate Gainsight MDA Backend

Gainsight pulls usage data in through the MDA backend. Before you can pull data from Google Analytics 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 the Administration tab in Gainsight.
 

If you are experiencing issues with this page loading, please contact Gainsight Support (support@gainsight.com).

Once in the Integration tab, activate the Authorize MDA switch.Then authorize Gainsight MDA to use your Salesforce data by clicking on "AUTHORIZE".

 

Click Allow

Click Close

4. Configure Google Analytics Integration within Gainsight

4. Configure Google Analytics Integration within Gainsight

Before the Google Analytics Integration can be configured you must first activate the Google Analytics Connector by activating the Google Analytics switch. Click +ADD NEW.

Click AUTHORIZE.

Click Allow.

Click Close.

This authorizes Gainsight MDA to access your Google Analytics instance. Note: In order to complete this step your Google account must have at least read permissions on the Google Analytics instance that you wish to connect to.

Once you have connected to Google Analytics, use the interface to select the profile where your usage data is stored. It should look similar to the image below.

Ensure that the Reporting Time Zone is the same as the time zone setting in Google Analytics for the view you are pulling data from. This can be found in the Admin section of Google Analytics under Accounts -> Property -> View -> View Settings. The setting to check is "Time zone country or territory".

From the Dimensions menu select Date and one of the following options:

  1. Page - This dimension tracks every page individually. Best suited for rich websites with a small number of distinct URLs.
  2. Page Path Level 1 - This dimension 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.
  3. Page Title - This dimension 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.

From the Metrics menu you can select any 3 metrics that you wish to monitor in Gainsight. We recommend the following metrics:

  1. Pageviews - A pageview is defined as a view of a page on your site. If a user navigates to a different page and then returns to the original page, a second pageview is recorded.
  2. Unique Pageviews - A unique pageview represents the number of sessions during which that page was viewed one or more times.
  3. Users - A user is defined in Google Analytics through use of cookies in the user's browser. For more details see here: https://developers.google.com/analyt...s/cookie-usage

Then under Custom Definitions click the "+ ADD NEW" button to indicate the Usage Data ID.

• If you are using Universal Analytics (recommended) you should select ga:dimension from the dropdown and input the dimension number in the centre field. The display name should be set to "Usage Data ID".

• If you are using Classic Google Analytics you should select ga:customVarValue from the dropdown and input the slot number in the centre field. The display name should be set to "Usage Data ID".

When this is all configured, click NEXT.

5. Map Google Analytics Dimensions & Metrics to MDA Equivalents

5. Map Google Analytics Dimensions & Metrics to MDA Equivalents

Click the drop-down list arrow to select options box to identify primary fields.

Once they are selected you will see a table to allow mapping of Google Analytics dimensions & metrics to their equivalents in the MDA. Once ou have filled out the correct mappings, click NEXT to continue.

6. Link Usage Data ID Field to Salesforce

6. Link Usage Data ID Field to Salesforce

On this screen you will be asked where the Usage Data ID resides within Salesforce. Open the "SFDC Field Name" menu and select the appropriate field. Then click NEXT.

7. Add Required Fields

7. Add Required Fields

On this screen, ensure that Salesforce is selected in the first dropdown menu. Then click NEXT.

8. Schedule Aggregations

8. Schedule Aggregations

In the final step of the configuration, enter appropriate email addresses in On Success and On Failure text boxes. Also, select the Fetch Data checkbox to select the appropriate time frame for aggragation. Click RUN to run the aggregation immediately. Otherwise, if you wish to schedule the aggregation, select the Set recurring schedule checkbox to schedule the aggregation Daily, Weekly, or Monthly. Click SAVE to save the created aggregation schedule.

  • Was this article helpful?