Skip to main content
Gainsight Inc.

Google Analytics: Enabling the Integration

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

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.

If Google Analytics is not installed on your website, please follow the instructions for Setting up Analytics Tracking to add the web tracking code directly to your site.

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.

Case Sensitivity

When bringing email addresses from Google Analytics, check whether it is in mixed case (upper and lower case or upper or lower case). Salesforce stores email addresses in lowercase. If there is any process joining based on email addresses with GA and SFDC data, due to the case sensitivity issue, records may not match. This will result in missing records.

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:

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.

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.

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

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

Configure Google Analytics Integration within Gainsight

Note: For Gainsight Integration of Google Analytics, we recommend  creating a dedicated user account, which is not linked to any individuals. This will ensure that integration is not affected when the GS Admin (whose OAuth token used) is changed due to organizational changes. Refer to Assign Gainsight Licenses to Salesforce Users for more information on how to do this.

Ensure the authorized GA account has the required permissions (at least Read & Analyse) for the configured Account + Property + View. Appropriate permissions (at least Read & Analyze permission) should be given to the OAuth user authorized for Google Analytics integration. Parent permissions are inherited by default (account > property > view). Sometimes, they can have child permissions can override those set for the parent. Be sure appropriate permissions exist at Account > Property > View level.

To check permissions, navigate to Google Analytics > Select Account > Property > View > Administration > User Management > Check for GA Account authorized View permissions.

GA.png

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. 

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.

Project Name: Google Analytics account integrated may have more than one property. It is recommended to have Gainsight’s GA project name be the same as the Google Analytics Account (in case there is only one property associated with the account). Otherwise choose the property name as the Gainsight project name.

project.png

Note: The Google Analytics Account, Property and View should have an exact match with the settings configured in Gainsight.

Reporting Time Zone: Reporting time zone at account > property > view level in google analytics should match with Reporting Time zone in GA setup page AND Gainsight (SFDC) org time zone. Any variation will affect the way the data will be pulled into Gainsight and results in data mismatch. To check the Timezone setting: Go to Google Analytics > Select Account > Property > View > Administration > View settings > Timezone

Timezone.png

time1.png

Map Google Analytics Dimensions & Metrics to MDA Equivalents

Map the complete list of contents (metrics/dimensions) that needs to be loaded to Gainsight during the initial project setup by selecting them from the drop down. This will ensure no changes to the object structure, underlying data and everything you have for further process in Gainsight.

Note: If there are any changes/additions required to the initial setup once the data is populated, there is a backend process that requires clean-up to move further. 

Dimensions: 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.

Metrics: 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 Google Analytics Cookie Usage on Websites.

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

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.

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.

Add Required Fields

7. Add Required Fields

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

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.

Note: It is recommended to schedule the aggregation job so that it pulls 2-3 days of historical data daily. This is to ensure that the aggregation numbers are accurate.

Data Validation

Validate each and every field that is being pulled into Gainsight with Google Analytics data once the project setup is done. This will ensure data is flowing correctly during the initial phase itself. Validation can be performed using google analytics query explorer to identify any incorrect mappings and data loss.

query1.png

query2.png

query3.png

Data Validation Dashboard

Building trust in data is the key priority for all integration projects. This can be achieved by showcasing data in a visual format.

Create reports on account mapping that show:

  • Account identifiers that are null
  • External ids doesn’t exist in Account object

Non Gainsight customers

In the Day Agg object, a google analytics account which does not find a match with salesforce account identifiers will get populated as -999. If a google analytics account exists in salesforce, but not as a Gainsight customer (customer info = null), this account will not be brought into the Day Agg object at all. It is recommended to validate this scenario in case of any count mismatch.

Considerations associated with selecting dimension & metrics           

Not every metric can be combined with every dimension. Each dimension and metric has a scope: user-level, product-level, session-level, or hit-level. In most cases, it only makes sense to combine dimensions and metrics that share the same scope. For example, “Users” is a metric with user-level scope, so it can be used with user-level dimensions like User-type. It would not be logical to combine “Users” with a session-level dimension like “Source”. For a list of the valid dimension-metric pairs, use the Dimensions and Metrics Reference

Users and New User Metrics calculation in Google Analytics

A person can be counted as new/returning user more than once in Google Analytics. The first time a device or browser loads your website content, Google Analytics tracking code creates a random, unique id called Client Id and sends it to GA server. This Unique ID is counted as a new unique user in GA. If the user switches to another device or Browser on a return visit to the website, then a new client ID is generated. If the user deletes the browser cookies, the ID is deleted or reset. Please be aware of these issues while analysing Users data.

  • Was this article helpful?