A/B testing predictions with Google Optimize
This section describes how to create an A/B test on Google Optimize and compare results for calls to action or campaigns with and without predictions.
Prerequisites
Google Analytics or Google Analytics 360 data source
This experiment requires that your ML models use the Google Analytics or Google Analytics 360 data source.
Google Analytics or Google Analytics 360 integration
Please see the setup guide for integrating with Google Analytics or Google Analytics 360.
Defining calls to action
Start by creating different calls to action on your website. At least two variants are required:
- Call to action with general message;
-
Call to action (ex. pop-up) with specific message, to be displayed only to those users in a custom segment.
This call to action can be triggered using an HTML attribute on the <body> tag, for example:
<body data-morphl-assisted="1">
Configure A/B test on Google Optimize
Create and configure Google Optimize account
- Go to Google Optimize and create an account if you don't already have one.
-
Add a new container
Create Optimize experience
From your new container, add a new experience. Choose A/B test for the experience type.


Add Optimize variants
-
Add new variant. The Original will be added automatically.
-
Enter a new name for your variant
-
Edit your variant
-
Click the square button in the top left corner. Enter body as the Element Selector and choose Attribute from the drop down menu.
-
In the pop-up window, set the Attribute as data-morphl-assisted and the Value as 1.
- Click the Save button in the top right corner to save your settings. Click the Done button to exit the variant edit window.
Link Google Analytics and generate script
-
From your Optimize experience settings, click the Link to Analytics button.
- From the pop-up window, select your Google Analytics account and the view that you want to link with.
-
From the pop-up window that appears, copy your Optimize container ID.
Set objectives
From the Measurement and Objectives section, click Add Experiment Objective. Choose your primary objective for the A/B test, for example a goal from Google Analytics.

Add Optimize to Tag Manager
After you're done with the above settings, follow this guide to load Optimize from Tag Manager.
Verify installation
In the Optimize experience page, click the Run Diagnostics button from the Settings area to verify your setup.
Start experiment
Start the experiment by pressing the Start button.