If you are interested in using the Segment.io integration using the connector, contact firstname.lastname@example.org for approval.
This article will guide you through how to setup the Segment integration.
To integrate segment with Gainsight, follow these steps:
- Install web tracking code
- Identifying Accounts
- Tracking page loads
- Activate Gainsight MDA Backend
- Configure Segment Integration within Gainsight
- Map Segment Events and Properties to MDA Equivalents
- Link Usage Data ID Field to Salesforce
- Add Required and Optional Fields
- Gainsight Measure selection
- Schedule Aggregations
- (optional) Selectively transmit events to Gainsight app
If the Segment web tracking code is already installed on your website, you can skip this step.
Note: You must use your own project's write key.
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 Segment and Salesforce. Lets 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 Segment and Salesforce. The Usage Data ID must be kept updated in both locations.
- 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 customer fields, contact your Salesforce Administrator.
- Segment - The Usage Data ID should be stored in Segment using the identify method. This will ensure that all actions for the user that are tracked through Segment will be associated with the Usage Data ID.
- Add the following line to the web tracking code used on every page:
Where <Usage Data ID> uniquely identifies the account from which the customer is associated. This may require extra code elsewhere in your application to ensure the Usage Data ID is retrieved in time.
The above code snippet contains three properties that are recommended to use for Segment integrations.
Segment is a powerful event-based data syndication service. In this documentation, how to track page loads are only covered as part of the Gainsight integration.
- To track page loads with Segment, you should add a track API call that is called when the page is loaded.
- Details related to the page should be passed as properties with the event.
- Pass thefollowing 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 Segment code together, your code on the webpage should look similar to the following example.
Gainsight pulls usage data in through the MDA backend. Before you can pull data from Segment, 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 MDA, your Salesforce user must have the Gainsight Administrator permission set.
For details on how to apply this permission set to your user, please view the following documentation: Gainsight Permission Sets
- In Gainsight, navigate to Administration > Connectors page. If you have any trouble while accessing this page, contact Gainsight Support (email@example.com).
- Activate the Authorize MDA switch.
- Click Authorize. A window appears asking for permissions.
- Click Allow. This action authorizes Gainsight MDA to use your Salesforce data.
- After clicking on Allow, close the window. A new brower window appears and displays the message Authorization Successful.
Before the Segment Integration can be configured, you must first activate the Segment Connector by activating the Segment switch. Additionally, you cannot continue the integration setup until you have received data once, which may require waiting a few hours.
- In Gainsight, navigate to Administration > Connectors.
- Type a project name for the Segment integration.
- Select a time zone that you use in Segment.
- Click Generate Access Key.
- An access key will be generated. Click the eye icon to see the code.
- Once the Key is revealed, copy it to your clipboard.
- In a separate browser tab or window, go to Segment.com and view the integrations for your project.
- Set the Gainsight integration switch to ON.
- Click the Gainsight logo to view segment settings for the Gainsight integration.
- Paste the access key from the clipboard in the text box.
- Click Save and Close.
- Navigate to Gainsight Integration page and click Next button.
Note: If you see an error at the bottom of the page, consider it as a normal event. It may take a few hours for Gainsight to receive data from Segment and load it into the MDA backend.
You should now see four primary fields that you need to identify for the MDA backend. Select the fields shown in the image above and then click Next.
- In the step 4, you are prompted to select an Account-Identifier and an User-Identifier.
- As part of onboarding, User-Identifier is not configured, clear the checkbox at step 5.
- For the Account-Identifier, select the field from the drop-down list that contains the Usage Data ID on Account object.
- After the page appears completely, click Next.
- In step 6, under the Add Required Fields section, ensure that Salesforce is selected in the first drop-down list and track distinct_id is selected as shown in the above image.
- In step 7, under Add Optional Fields, select the properties shown in the image above, along with the corresponding labels.
- Click Next.
Note: You can add up to six optional fields.
Select pageLoad event from the drop-down list, and then click Next.
- In the final step of the configuration, select the Schedule button.
- In the Schedule dialog, select daily and Every day as the frequency.
- Set Start Date as today and End Date as Dec. 31, 2020.
- Set Preferred Start Time to occur shortly before midnight in your time zone.
- Click Save and Run.
While using the Segment connector, if you know that a particular event's data in Segment will not be used in Gainsight, you have the option to not transmit particular events to the Gainsight app. It is recommended to use Whitelabeling to control the number of events that are sent to Gainsight. Sending an abundance of unnecessary events can slowdown the Segment infrastructure for all users. For more information on how to set up Whitelabeling within Segment, see the Segment Gainsight Integration document.
- Go to Segment.com website and open your source data.
- Click Schema tab.
- In Tracks section, select an event.
- Click FIlters section.
- Set the Gainsight filter to ON/OFF as per your requirement. If you set this filter to OFF, the event's statistics will not be transmitted to the Gainsight app. Similarly, if you set it to ON, the event's statistics are sent.