In content marketing you often are leading a reader down the funnel to a page that aims to incite a specific action: a whitepaper download, a purchase, etc. Because those pages directly translate to real revenue, it’s important they are as fine tuned as possible. Enter the A/B test.

A/B tests randomly distribute visitors to two different versions of the same webpage. Then depending on your established metric for success (time on site, conversion, etc) A/B testing can tell you which page is more effective. Its a powerful tool for tweaking sales pages, testing headlines, rewriting copy, and more.

Most high-end A/B testing services cost a monthly fee, but you can get started with Google Anayltics, Google’s free web analytics software. Of course, the tutorial below assumes you’ve already installed Google Analytics. Here’s how to set up your first A/B test:

Determine your end goal.

Is it purchases? Newsletter signups? Clicks? It’s best to only test one “event” in an A/B test, otherwise it can become unclear which variables affected the final outcome. For the purposes of our test, we’ll be testing a sales page with a single purchase button.

Measure.

Google Anayltics doesn’t default to measuring user clicks. To do this, we’ll need to create an “onClick” event by adding a little bit of Javascript to our button code. The code structure is:

onClick=”_gaq.push([‘_trackEvent’, ‘category’, ‘action’, ‘opt_label’);”

For our purposes, we’ll rename the variables for easier reading in our reports:

onClick=”_gaq.push([‘_trackEvent’, ‘Buy Button’, ‘Solo Button_main’, ‘‘Whitepaper_download’]);”

You can read more details about the structure of the code here.

Create two versions of your page.

Let’s say that we’re wrestling with the headline on our hypothetical sales page.

We’ll create two .html files on our server: each with a different headline. It is important to keep the button code above the same. Also, it’s typically a good idea to only test one variable at a time. So don’t rewrite the headline AND lower your price. If you were to see a spike in sales, it would be impossible to know whether it was the headline or the price that lead to success.

Set up the A/B test.

Google refers to A/B tests as “experiments.” To set them up log on to your dashboard and select Content > Experiment. Enter in the original webpage you want to improve. In this case, I’ll be improving the index.html page.

Then select what page you’ll use as the alternate or “B” version. In this example, I’m using landing.html. As you can see from the preview this is testing two different headlines.

Select your metric.

Remember that click event we created in step 2? Google can only register it for this A/B test as part of a “Goal.” Click “create new goal” then “+goal.” Select “event” and under “goal details” use the dropdown to select “that is equal to.” Then fill in the value you created in step 2. In my example I used the value “Buy Button” to mark this event. Now, Google knows that whenever the “Buy Button” even occurs to count that as a “Whitepaper Purchase.” Click Save.

On the following screen you can select the percentage of audience to include in the experiment. Click “Save and Next” when finished.

Add the A/B testing code to your original webpage.

On the next screen, click the “I’ll add the experiment code myself” button. Select the code and paste it on BOTH versions of your page.

Google will “validate” the code in the next step, so make sure both URLs have a green check mark.

Be patient.

Congratulations, your A/B test is set up! Results can take between 24-48 hours to appear so be patient!