A/B/N Testing for Free using WordPress and Google Analytics Site Experiments
In the process of validating a business idea, I wanted to do some simple testing of what headline would capture the most signups (or conversions) on a landing page. After doing the usual Google search for software, tools, and plugins, I wasn’t satisfied with the results. Simply put – I wanted something that was quick to implement, as minimal learning curve as possible, and free. Basically, it wasn’t there. Then, I discovered I already had the tools to do this. Let me show you how I set this up.
Time: 15 minutes
*Note – If you don’t know what A/B testing is, don’t fret for this being over your head – here’s a Google head start….
Before We Begin…Let’s Setup our Scenario
Let’s say I’m writing a children’s book geared towards 3 to 7 year olds. I have some ideas for the title of the book, but I want to make sure and pick the best title that will be successful for the final print. So, the goal of this A/B/N Test is to try different book titles on my landing pages and quantify the number of conversions. A successful conversion will be considered having a visitor give me their email address to be notified when the book launches. On submitting their email address, we will send them to a thank you page.
WordPress Side of A/B/N Testing
First, you need to create what we’ll call your origin page. This page will be first in however many alternate pages you choose to create for your A/B test.
In our scenario, Here’s our origin page:
And let’s setup 2 alternative pages to use:
Now that we have our WordPress pages setup, we need to switch gears a moment and setup our Google Analytics Experiment.
Setting Up a Google Analytics Experiment
Before we begin, let’s get a understand of what a Content Experiment is – Google Analytics Support Site:
Content Experiments is a somewhat different approach from either standard A/B or multivariate testing. Content Experiments is more A/B/N. You’re not testing just two versions of a page as in A/B testing, and you’re not testing various combinations of components on a single page as in multivariate testing. Instead, you are testing up to five full versions of a single page, each delivered to visitors from a separate URL.
This is exactly what we need! Basically, when a user visits your Origins page, Experiments will randomly pick one of the other pages (or our origin page) in the experiment and send the user off to that page.
The problem with just putting this in the head is that in WordPress, the header.php file is used on every page and we need to only have it on our experiments page.Thankfully, there’s an easy solution. Back to WordPress!
Only outputting the Experiments code on our Origin Page
Let’s go back to your origin page in the WordPress admin. Once on the edit page, look in your browser’s URL bar to get the origin page ID from the URL.
<?php if (is_page( -- YOUR PAGE ID -- ) ): ?> -- GOOGLE EXPERIMENTS CODE -- <?php endif; ?>
The code above works on if you are testing out different pages, but what if you are using posts? Just a simple function change is all that’s needed:
<?php if (is_single( -- YOUR PAGE ID -- ) ): ?> -- GOOGLE EXPERIMENTS CODE -- <?php endif; ?>
Once installed on your site, Google will randomize your experiment pages your users see and measure their success of each, and depending on the length and configuration of the experiment will eventually declare a ‘winner’.
This is how I test various methods of copy on my websites – I’m curious, what do you use? Do you have a better method or have a suggestion on the tip above? Let me know in the comments section!