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.
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.
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.
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:
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.
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 (email@example.com).
Once in the Integration tab, activate the Authorize MDA switch.Then authorize Gainsight MDA to use your Salesforce data by clicking on "AUTHORIZE".
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.
Ensure the authorized GA account has the required permissions (at least Read & Analyze) 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.
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.
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: Navigate to Google Analytics > Select Account > Property > View > Administration > View settings > Timezone.
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 dropdown list, select Date and one or seven of the following options:
Metrics: From the Metrics menu you can select any 10 metrics that you wish to monitor in Gainsight.
Then under Custom Definitions click + ADD NEW to indicate the Usage Data ID.
Universal Analytics (recommended) users 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".
Note: 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.
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 and metrics to their equivalents in the MDA.
Once you have filled out the correct mappings, click NEXT to continue.
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
On this screen, ensure that Salesforce is selected in the first dropdown menu. Then click NEXT.
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.
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.
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 analyzing Users data.