You can effortlessly integrate Google Analytics (GA) with Zoho PageSense using Google Tag Manager. GTM is a free tool that allows you to quickly add and update your code (tags) on your website without having to manually write a single line of code. By integrating GA via GTM, you can push all your A/B and Split URL experiment data, and view in-depth visitor metrics about the experiments running on your website within Google Analytics. This is a one-time integration process.
To perform the integration, you need to ensure that you have a GTM account, and have at least one A/B or Split URL test running on PageSense.
Before you start with the below procedures, log in to your Google Tag Manager account and select the Workspace you want to integrate with Zoho PageSense.
Create custom HTML tag in GTM
To setup the integration, you need to create a custom HTML tag that collects relevant data from the PageSense experiment. This tag helps push the PageSense's experiment data to GTM's data layer variables, which you create in the next step.
To create custom HTML tag in GTM:
1. Go to the left pane, click Tags, then click the New button.
2. In the Untitled Variable field, enter your tag name as 'PageSense Custom HTML'.
3. Click the Tag icon, then select Custom HTML from the list.
4. Copy-paste the below code inside the HTML window:
<script>
if(window.ZAB && window.ZAB.experimentsLoaded) {
window.ZAB.GAGTMIntegFunc();
}
if(document.addEventListener){
document.addEventListener("zpsExperimentsLoaded", function() {
window.ZAB.GAGTMIntegFunc();
}, false);
} else {
document.attachEvent("zpsExperimentsLoaded", function() {
window.ZAB.GAGTMIntegFunc();
});
}
</script>
5. Click the trigger icon and choose All Pages with the trigger type as Page View.
6. Click Save in the top-right corner.
Create data layer variables in GTM
Next, create two data layer variables in GTM to transfer every test and variation data to GA. These variables are defined by PageSense tracking code.
To create data layer variables in GTM:
1. Go to the left pane, click Variables, then click the New button.
2. In the Untitled Variable field, enter your variable name as 'PageSenseExperimentName'.
3. Click the Variable icon and select Data Layer Variable from the list.
4. Enter the following details in the Variable Configuration page, then click Save:
- Variable type as Data Layer Variable.
- Data Layer Variable Name as PageSenseExperimentName.
- Data Layer Version as Version 2.
5. Create your second Data Layer Variable. Again, on the left pane, click Variables then the New button.
6. In the Untitled Variable field, enter your variable name as 'PageSenseVariationName'.
7. Click the Variable icon and select Data Layer Variable from the list.
8. Enter the following details in the Variable Configuration page:
- Variable type as Data Layer Variable.
- Name as PageSenseVariationName.
- Data Layer Version field as Version 2.
9. Once you're done, click Save in the top-right corner.
Create a trigger for custom event in GTM
To transfer the PageSense data to Google Analytics, you need to create and define a trigger of type 'custom event' in GTM. In this case, the trigger is set to fire on all pages of your website, and sends the required data variable information to Google Analytics. It acts like a connecting bridge between GTM and GA.
To create a new trigger for custom event in GTM:
1. Go to the left pane, click Triggers, then click the New button.
2. In the Untitled Tag field, enter the trigger name as 'zohoPageSenseEvent'.
3. Click the trigger icon, choose trigger type as Custom Event from the list.
4. Enter the following details in the Trigger Configuration page:
- Event name as zohoPageSenseEvent.
- This trigger fires on as All Custom Events.
5. Click Save.
Create a tag for GA in GTM
To complete the process in the GTM dashboard, you need to create a tag. This GA tags are code snippets that finally push the data captured by the variables that is fired by the triggers, onto to your Google Analytics when 'zohoPageSenseEvent' triggers. Later, it sends all the information collected from the running A/B and Split URL test experiment from PageSense to Google Analytics.
To create a tag for GA in GTM:
1. Go to the left pane, click Tags, then click the New button.
2. In the Untitled Tag field, enter your tag name as 'GA PageSense'.
3. Click the Tag icon, then select Google Analytics: Universal Analytics from the list.
4. Enter the following details in the Tag Configuration page:
The tracking parameters you will set in this step depends on what data you want to integrate and view on Google Analytics. Here, we will use the standard parameters "category" and "action" from our Event.
In Track Type, select Event.
In Category, select Zoho PageSense.
In Action as {{PageSenseExperimentName}}:{{PageSenseVariationName}}
In Non-Interaction Hit as True.
In Google Analytics Settings, choose Select Settings Variable.
Select the Enable overriding settings in this tag option.
In Tracking ID, copy-paste the Tracking ID from Google Analytics, which you will find in the GA admin page, under Tracking Info.
Enable Google Analytics integration within PageSense
Now that you have configured GTM, you just need to enable GA integration from the PageSense tool.
To enable GA within PageSense:
1. On the left pane, click either the A/B Test or Split URL Test and choose the required experiment you want to view reports.
2. Now, click the CONFIGURATION tab on the top bar, scroll down to Add Integrations section and click on here to enable the Google Analytics button from the Integrations list.
View reports in Google Analytics
Once you have successfully integrated PageSense with GA via GTM, you can view website's report for the a/b and split URL test on your Google Analytics account.
To view reports in Google Analytics:
1. Login to your Google Analytics account, on the left pane, click Behavior, then Events.
2. Click the Overview button.
3. You can view a summary of your test results as shown in the image.
The report provides an overview of all your original and variations of a/b and split tests in GA. It includes experiment metrics such as a total number of visits and unique visits.