Hosting Tutorial & Guide

How to Conduct an A/B Split Testing with Google Analytics to Improve Your Site

updated on Nov 09, 2015
How to Conduct an A/B Split Testing with Google Analytics to Improve Your Site A/B testing, which is also called split testing, is a method that compares two versions of a webpage or an element to allow you to find out which version works better. In such a test, you display the two versions on your site for randomly distributed visitors, and then see which converts better by gaining insights into visitors' behaviors.

Once you get the stats like bounce rate, conversion rate and sales, you can make a comparison and then apply the better version to your site design or content plan. By knowing what the audience prefers, you can rest assured that the conversion is better guaranteed.

The elements that need to be tested vary, depending on what you want to achieve. For example, if you want an increased number of subscribers, you should test the sign-up form's length, the types of fields, the social integration, etc. And for increasing sales, you might need to test the placement of the call-to-action button, the button's color, the promotional offers, etc.

As long as you have decided what to test, you can follow the tutorial below to create an A/B split test with Google Analytics. Some useful tips are also introduced thereafter.

Conduct an A/B Split Testing with Google Analytics

Google Analytics offers a free A/B split testing tool which helps you make confident and wise decisions about the site design, content, layout, and many other aspects. But before starting to create a test, there are some preparations that you must make.
  • Make sure that Google Analytics has been installed properly on your site. If you have not done this yet, follow this Google Analytics tutorial to get things ready.
  • Make sure that all the variations of the original page that you will test have been published on your site with their unique URLs. As Google Analytics allows testing multiple variations at the same time, you can create several copies of the original page with different styles and layouts.
In Google Analytics, an A/B split test is called a content experiment. In below, we will offer a step-by-step guide for creating an experiment and integrating it with a website.

Step 1: Create a content experiment

First of all, sign into your Google Analytics account. Among the menu in the left sidebar, expand Behavior, and then click on Experiments. On the experiments page, click on the button saying "Create experiment".

Create Experiment

Now you are taken to the creation wizard of content experiments. In the first step, you have to give a name to the new experiment, and select an objective. You can choose an existing objective or create a new one by clicking on the creation link.

With the objective, you can define the metrics that will be used for evaluating the test results. If you do not have any idea about which to use, then you can refer to the suggestions below.
  • If you are looking to get insights into the bounces, page views or time spent on a page, then select "Site Usage".
  • If you have clear goals like clicks on a link or number of transactions, create a new objective as you like.
  • If you have a registration page or signup form that leads to a confirmation page, you can define the confirmation page as the destination, so that each time the page is visited, a completion of the objective is recorded.
Choose an Objective

After selecting the objective, you are faced with another decision – the percentage of traffic, which allows you to decide how many visitors to your site will see the test pages. In most cases, you can choose a higher portion like 100% or 75%, but if you think the experiment is a little bit risky, you may select a lower portion of traffic. It is also good to turn on the email notifications to get alerted for significant changes.

Step 2: Add the original page and variations

In the step for configuring the new experiment, you need to:
  • Add the URL and name of the original webpage that you would like to test.
  • Add the URLs and names of all the variations.
Multiple variations can be added to the experiment through clicking on the "+Add Variation" link. When these are done, click on the "Next Step" button.
Configure the Experiment

Step 3: Insert the experiment code into your site

In the third step, you are provided with two options for setting up the experiment code. Here you can choose to manually insert the code to your website. After copying the code, you have to paste it after the opening head tag of the original page.

Google Analytics Experiment Code

Taking WordPress as an example, you need to complete the following steps to get the code placed right.
  • Log into the WordPress dashboard.
  • Go to Appearance > Editor, and open the header file (header.php).
  • Add the code below to the header file. Remember to replace "123" with the ID of the original page, and the "Google Analytics experiment code" with the code copied before.

<?php if (is_page(123)) :
//Google Analytics Split Testing
Google Analytics experiment code
<?php endif; ?>

Once you have saved the file, go back to Google Analytics experiment creation wizard and proceed to the last step.

Step 4: Review the configurations

In the last step, Google Analytics will check the validation of the experiment code automatically. If there is something wrong, you will see some alerts so that you can make corrections accordingly.

Experiment Code Alerts

After making sure everything is right, you can click on the blue button to get the experiment started. A pop-up confirmation page will appear. Just click on "Yes", and that's all.

As soon as the experiment is started successfully, your site visitors will be randomly distributed to the variations and the original page, and Google Analytics starts to collect data for the experiment. For the same visitor, he/she will see the same variation every time when visiting your site during the entire experiment.

Depending on your goals, Google Analytics will show you the winner which outperforms other variations. But this will take some time – usually 3-4 weeks. After viewing the results, you can replace the content or template of the original page with the better variation's, and then stop the experiment and remove the experiment code.

Useful A/B Split Testing Tips

Although A/B split testing sounds simple in the concept, it is easy to make some common mistakes in daily uses. Below are the practical suggestions that can make your life easier and help you achieve better results.
  • Control the test time carefully. The length of the time for a test is important. If you give up too early, you may not get the results that are really accurate and meaningful. However, if the test takes too long, the badly performing variations could harm your conversions and user experience. For most tests, 3-6 weeks are considerable.
  • Show the same variation for repeat visitors. Those who use Google Analytics to make A/B split tests would not worry about this because the tool can remember who has visited which variation. But if you are using another software, you have to make sure it also comes with this feature. Otherwise, your visitors may be confused by collided information, for example, different prices of a product.
  • Don't include regular visitors into significant tests. When testing some significant changes of your site, you'd better only bring new visitors to the test. This ensures the accuracy of the results, and prevents surprising regular visitors with some variations which may be abandoned later.
  • Keep testing. It is possible that a single test may not turn out positive results. So if you are looking for effective ways to increase conversions, try more A/B split tests to gather more and better data.