A quick guide to setting up A/B Testing using Google Analytics.

A/B testing is a very useful tool in choosing the correct solution for your site. A simple A/B test could help increase the chances of a user completing the task they intended to do on your site and thereby increase the usefulness of the site or application and even the profitability of your business.

Setting up A/B testing in Google Analytics is relatively simple. Follow these guidelines and you’ll have it running in as little as 15 minutes. I’ll assume you have Analytics running on your site or application, if not there are many tutorials on getting started with Google Analytics on the web.

Set a goal

The first thing to do is decide on what it is you want to test (e.g. the wording on a button that leads to your contact form). It is best to only test one thing at a time so you know how effective every single change is.

To set a goal log into your Google Analytics website and select the Admin tab at the top, then you should find Goals under the View list (the third column of options usually). You can add a goal by clicking the create new goal button. Analytics has an education function that can help explain this within Analytics reached by clicking the mortarboard icon on the top right.

Set up your test options

This will involve setting up two or more versions of the page one with each option for what it is you are testing. So for our example of alternative wordings on the button that leads to our contact form we would have one page created for each option. Make a note of the distinct URLs for each page you have set up.

Create your A/B test

Go back into Google Analytics and to the Reporting tab for the site you are testing on. On the left hand menu there is an item labelled Behavior which has a sub item of Experiments. This is where you will create your A/B test by selecting Create Experiment. The way to do this is as follows:

  1. Click the Create Experiment button;
  2. Give the experiment a name and select the goal you are experimenting against;
  3. Add the URL of the page you are testing
  4. Add as many variation URLs as you require to test against;
  5. Add the experiment code to the head section of your original page on your site or application;
  6. Click save changes and Google will test everything is running well using its verifcation process;
  7. Click start the experiment and we are done.

What happens next

Google takes care of routing your users to the various pages set up within the experiment for the duration of the experiment. Google even takes care of the duration of the experiment depending on the volume of traffic your site gets. This will result in Google declaring a winning variation (which may be your original page rather than an actual variation). You can of course stop the experiment at any time.

The magic of Google’s experiments A/B testing is that it uses a multi-armed bandit approach that starts to favour the most effective pages within the experiment as time goes on so it will tune itself to becoming more effective over time. This will help maximise users achieving the goal you want them to.


Remove the Experiments code from the head section of your site when the experiment is over.