How to do an A / B test in Google Analytics

How to boost a Facebook post: tutorial and good practices
How and why to write guest posts: tips and good practices for you to apply in your content strategy

To begin studying A / B tests , as they are one of the most efficient ways of validating hypotheses, especially when it comes to optimize conversions.

The principle is relatively simple, but to model and execute a good test requires some care. Especially because the test is completely based on statistics and probability of those fact change impactarem results.

The purpose of the post is to spend some of the good practices and teach how to set up an A / B test in Google Analytics in a few minutes. In addition, we enjoy and recommend another tool to do this test, super simple to move , and we currently use: Optimizely.

Good practice to make an A / B Testing

Before ever setting teach, it is important to go through at least 4 good practice to perform the tests. Do not follow them can fully compromise your results:

1 – Make one change at a time

When testing only one element at a time, you guarantee that the impacts generated by the change really have been that element. So, even though you know that several changes can generate improvements, break their hypothesis in several stages, and test one at a time to prevent some of them are actually harming you.

2 -Set an appropriate confidence interval

When we work with statistics, we always need to establish a level of reliability. In practice, if we say that the confidence index of a change be better it is 80%, we are saying that every 10 appearances for a user on average it is actually better in eight of them.

Our statement is to work with 95% or 99% confidence interval. This range is very important because it is a major factor that determines how many visits will be required to prove that a page actually is better than another.

3 – Set a goal for the success of the experiment

This is a good practice that is useful in two ways. The first is that when determining the gain expected with that improvement, you can do a better balance and compare the expected gain to the amount of effort required to make that change. If you need to allocate a lot of people for a small gain, perhaps not worth doing this experiment.

The second is that this expectation of improvement is also a parameter that helps determine the volume of visitors that page to prove she really brought a gain. The greater the expectation of improvement, lower the amount of visitors they need to prove that point.

4 – Test the two versions simultaneously

If you monitor your results often you must have noticed how external factors may influence your business. To prevent these factors influence its outcome, the ideal is always to make simultaneous tests. For example, many companies run the amended for a period of time and compares with the historical result of the page. And in practice we know that a week can bring very different results from others.

5 – Create a goal

This step is extremely important because it is what Google will consider how successful your page. For example, a Landing Page, the ultimate goal is to convert the visitor into Lead. So I want to measure how many people get on the page and how many completed the form, clicked the button and were directed to the thank you page. In that case, let us consider the objective of achieving the thank you page.



6 – Traffic Percent

Give a name for it, a goal and the percentage you want to divide traffic: 50% will cause half of the visitors will be directed to the page A, and the other half for page B.

This proportion will depend on the aim of the experiment and the quantity of visitors.

The 50/50 option is typically used on pages that do not have a very big traffic, so they need to use all the available volume of visits to the experiment.

Pages with large volume of visits do not need to separate all your traffic to the experiment and can therefore use options such as 10/90, 20/80, 30/70. This is important, because there is always the risk of the experiment show a result worse than the original version. By separating only 10 or 20% of traffic to experiment, you ensure that in the event of worst performance, most of the results will not be affected / impaired.

For this example, we will simulate an experiment where only change the button color of our Landing Page. To do this, create a new page with the new button and we’ll call it “Variation 1”. The left image is the original, while the left is the variation.

In this next step you should put the addresses of the pages you want to use as A / B testing.

The next step is to insert the javascript code on your site. Google itself already gives the instructions for this and checks whether the code is loaded properly. You can also enter this code through Google Tag Manager. See the post How to use Google Tag Manager .

You can also enter this code in the Landing Pages created in RD Station. See how .

At the end and run the experiment, always use the URL of the original page. Google will automatically direct your audience and randomly assigned to one of two versions.

The next step is to wait for the results. The Google Analytics takes a few days to show the first results. But by clicking the experiment name, you can see the winning page and the likelihood of change to be better than the original version.

Now just follow the statistics and evaluate the performance of the two versions.

Bonus: Making A / B testing in Optimizely

The Optimizely is a very good tool for testing A / B (and many others), and the free plan is more than sufficient for the needs of most companies. And she is that good for three simple reasons:

  • It is extremely easy to edit changes, most of which are possible in the model “drag and drop”.
  • She makes herself the statistical reference calculations for the confidence interval you choose
  • You can easily make simultaneous tests with the possibility to choose the proportion of traffic that will be directed to each page

For example, let’s use the Landing Page we use to offer free trials of marketing :

1. Go to “sign up” and create an account for your company

2. After logging in, you Entrata in a panel with all its experiments. To create a new click “New experiment”.

Optimizely Home


3. A pop up will appear asking you to provide a name and URL for the execution of the experiment.

4. Once this is done, you can view the chosen URL within the Optimizely edit panel. Hover your cursor over page elements to understand how the tool separates each “box” of your website.

(Our hypothesis for this Landing Page is the page title and caption are not transmitting properly the amount you want to spend, and so we will change it.)

5. Click the mouse on the “box” you want to change and will show the tool edicação options.Edit post (2)


6. There are several options to change texts, fonts and sizes, remove or change icons and images, reposition “boxes” and more. Remember to make a change by testing as we speak on best practices. In our case we change only the title of the Landing Page.

Edit post (3)

7. Edit the page according to the hypothesis set, and when you finish the remaining three things to do: set the goal, allocate traffic and define statistical significance.

8. Set goals, that is, let’s define what will be measured to make a comparison of results. To do this, click the icon of a flag in the upper right corner, called “Set up Goals.” If this is your first time in the program, you will need to create a new goal to “create new goal.”Edit post (4)

9. “what to track” you will choose the object to be measured is a page view (pageview), a click (click) or a custom custom event (event). In our case, as it is a Landing Page, our goal is to click the button. At this stage in Google Analytics we define the goal was to arrive at the thank you page as it is not as simple measure click the button.

10. On the next screen you will see your page and just click on the element that defines the target for which is to be set, and then press to save (save).

11. The initial configuration tool is already allocate fifty five traffic. However it is often risky to send half of their traffic to a page that you do not know the performance, so it is often interesting to start with a lower volume. To change click “option” and then “traffic allocation”.

Edit post (5)

12. Finally, click the “Start Experiment” button to start the experiment. You will be redirected to your experiment panel. Once there, click on “Settings”. Scroll down the page a bit and you’ll see the “statistical significance”, where you will determine its statistical significance.

13. Just above, you see the script that should be pasted on your page to give permission to Optimizely to change it.

Optimizely Home (1)


14. If you use the RD Station, just insert this script in your Landing Page. In Landing Page editor click Appearance, and in the “Javascript HEAD”, paste the entire script of the content provided by Optimizely.


15. Ready now your A / B test is set up, and to accompany you just go back to the panel of experiments, click the experiment in question and on the right side, goes into “results” to track results.

Optimizely Home (2)


Although long, the post has only the basics of theory and good practice. This theme can also be deepened in various ways, but this is the basic set up for free and simply a test A / B.

After reading this post, I suggest you take a look at post on how experiment help your business grow .