Category: AB Testing
This integration is only available for Web projects
What to expect
This integration will allow you to analyse client-side AB Test campaigns directly in CS Digital and easily discover and explore customer behavior across all digital channels and devices in order to build and test ever-better customer experiences. For instance, you can segment all sessions that experienced an AB test variation from the Analysis Context in Contentsquare and see corresponding metrics in the Zone-based Heatmaps and Session Replay modules in order to deeply understand UX behaviors and the corresponding performance.

What we collect
Dynamic Variables
Key |
Value |
Data Type |
AB_GO_{AB Test ID} |
1 |
Text |
AB_GO_{Personalization ID} |
true |
Text |
Implementation
Implementation Steps
There are 2 steps to enable this integration:
Step 1
Please go to the section How to request an integration to see the instructions to enable this integration. You can then return here once completed.
If you have already completed the step above then continue below.
Step 2
Before proceeding below, first check if perhaps you already have the required components set right already before using one of the methods below.
Open your browser console on a page that you have a GO test running live and type in gaData then press enter and expand the object.

If the object has an experiment in there then you do not need to pick a method below, you can wait for the code to be enabled and test it.
If not then pick one of the methods below.
Method 1: GA + GO launched outside of GTM
If you have the GTM dataLayer object available then simply requesting the integration to be enabled might allow it to work.

Method 2: GA + GO launched from GTM
This integration method requires that your Google Analytics and Google Optimize are both launched from your Google Tag Manager account using the built in GA and GO tag containers.
If you already have a GTM custom variable called Google Analytics Settings defined, even with a different name, and you also have a Page View trigger defined then skip the next few steps which explain how to create it and go straight to Configuring the Google Analytics Settings variable in Analytics below.
Creating a Google Analytics Settings variable
Create a Google Analytics Settings Variable if you don’t have one.
In GTM go to Variables and press New.
Click to create a new variable configuration.
Scroll down to Utilities and select the Google Analytics Settings option.
Insert your Google Analytics Tracking ID which looks similar to this below.

Press Save and name the variable Google Analytics Settings or whatever else you want to call it.

Creating a Page View trigger
Next make sure you have a Trigger called Page View.
If not go to Triggers and add a new one.
Click to create a new trigger configuration.

Choose Page View.

Press Save and name it Page View.

Configuring the Google Analytics Settings variable in Analytics
The next part assumes you already have the Google Analytics and Google Optimize code containers set up already but not configured properly for the Integration to work.

Open Google Analytics Universal Analytics and press the edit icon.
Then in Google Analytics Settings choose the variable you created (or already possibly had) called Google Analytics Settings.
It is quite possible that you have this checkbox enabled but you will need to disable it.

Then click on Advanced Settings and make sure the Tag Sequencing to Fire a tag before GA fires and set that tag to be Google Optimize.

You should have this then:

Configuring the Google Analytics Settings variable in Optimize
Next go to the Google Optimize tag container and edit it
Then in Google Analytics Settings choose the variable you created (or already possibly had) called Google Analytics Settings.
It is quite possible that you have this checkbox enabled but you will need to disable it.

You should have this then:

Note there must be no firing triggers for Optimize container.
After publishing the config changes you should now see the gaData object populating with the Experiment and Variation ID in the browser:
Google Optimize Server Side
Use the examples provided in this document to generate variables to add to the code below:
/*
*Name: Google Optimize Server Side Tests CS Integration Start
*Version: 1.1.0
*/
(function () {
var version = "1.1.0";
window._uxa = window._uxa || [];
var tvp = "AB_GO_SS_";
function callback() {
if (!disableCallback) {
disableCallback = true;
if (window.CS_CONF) {
CS_CONF.integrations = CS_CONF.integrations || [];
CS_CONF.integrations.push("Google Optimize - Server Side - v" + version);
}
}
}
var disableCallback = false;
_uxa.push(["afterPageView", callback]);
function sendToCS(csKey, csValue) {
csKey = tvp + csKey;
_uxa.push([
"trackDynamicVariable",
{
key: csKey,
value: csValue,
},
]);
}
var experimentID = GoogleVar["experiment_id"];
var variationID = GoogleVar["variation_id"];
sendToCS(experimentID, variationID.toString());
})();
//Google Optimize Server Side Tests CS Integration End
You simply need to add this code above to your server side SDK and make sure this code runs in the browser and replace the GoogleVar placeholders with whatever you are using on your side to get the experiment_id and variation_id.
Verifying it works
You can use the chrome extension to check the results are sent to CS

