Skip to content

A/B Testing with Google Optimize and Tag Manager

Now that Google Optimize is available to the masses, I was keen to try it for my A/B experiments. Perhaps the best thing about A/B testing Optimize is that variant pages can be created with a visual editor, rather than having to create a second page.

Be aware that what is described herein isn’t the recommended way to set up and deploy A/B testing, but it’s quick and easy and it works. In a nutshell, here’s how we can easily A/b test (and what is required).

  1. You will need GA via GTM, and an Optimize account.
  2. Make sure you have your Goals set up in Analytics – these are your experiment Objectives
  3. Optimize is deployed by means of a Tag in GTM. Tag type is of course Google Optimize, and add the GA tracking code of the View in question, and the Container ID of the Optimise account to the tag.
    a-b-testing-gtm
  4. When you’re ready to go live, change the trigger for this tag to fire on ALL pages (not just the one you want to test)
  5. Over in Optimize, create your experiment. The key part of the classic A/B experiment is the variant page. In old school Analytics experiments these would be copies of pages, edited with the variations you were testing. But that’s old school – Optimize has a visual editor, and delivers this variant automatically as part of the experiment.
  6. Finally, Start your experiment, and wait for the data to come in.

You’ll notice we aren’t using the recommended anti-flicker code which usually goes above the GTM code. This is usually required to stop the page flicker effect as Optimize swaps one experiment variant page for another. It would definitely be required for A/B/N testing of multiple variants, or for image-heavy pages, but for a simple page and an basic A/B test we can omit it. Naughty but nice. Here’s the official party line: https://support.google.com/360suite/optimize/answer/6314801

One your experiment is live, allow at least 4 hours for your first data to come in, and I found it refreshes the results at about the same interval.

An important proviso is that you can’t fully edit an experiment once it’s running – which makes sense. You can tweak the Targeting aspects of the experiment, but you can’t add a secondary objective (unless you are running Optimize 360, the pro versions).

Leave a Reply