How To Configure Content Experiments on a WordPress Site

Recently, I decided to dive into the world of usability and testing. To wet my feet, I chose to run some basic A/B tests on a website I recently started managing.

The site that I manage is built on WordPress, which is excellent. However, it’s a site that supports a company that serves a very technical industry. Apparently that means the visitors want to read a TON of content. Right? Wrong.

If you or anyone you know decides to build and/or write for a website, consider how you, personally, use the internet. If I land on a page that is clean, features high-quality images, and tells me where to go, I’m going to convert. Take me to a page that has paragraph after paragraph of content, page blocks everywhere, images, links, conflicting CTAs — and I will increase your bounce rate before you can say…well, nothing. I’m going to leave immediately.

Given that my initial reaction upon visiting the site was confusion, I decided to take action. I decided to perform some tests, which gave me the opportunity to use Google Content Experiments. Within the Google Analytics tool is a “Content Experiment” tool — a handy and FREE tool you can use to execute A/B and multivariate tests on your site. This was my first time setting up a “Content Experiment” on a WordPress site. I had to rummage around a bit before I figured out exactly what I was doing.

Below are the steps I followed to set up the test using Google Content Experiments on a WordPress hosted website:

Step One: Determine the test type

As I mentioned, Google Content Experiments is capable of running A/B tests and multivariate tests. You will need to determine which of these tests is most appropriate depending on your goals.

Here are some characteristics of the two types of tests:

A/B Testing

  • Testing more than one version of a page
  • Measuring one outcome
  • Used for testing one or two different page elements

Multivariate Testing

  • Used to test the effectiveness of multiple combinations of elements on a page
  • Measures correlations between the different combinations and outcomes
  • Can test multiple page elements

I chose the A/B testing route since this is the first test I’ve run on this site.

Step Two: Determine your goals and the elements to test

My goal is to improve the bounce rate. The specific page I chose to start testing has a bounce rate of 75%. Whoa. Commonly, conversion related outcomes are the focus, but for a new website, I wanted to start at the ground-level — general site performance.

The original version of the page I’m testing contains A LOT of copy. It’s also relatively cluttered. To address these issues, I chose to test the following elements:

  • Three-column layout –> Two-column layout
  • 500 words –> 200 words
  • Larger Call-to-Action

There are almost unlimited elements to test — page header, CTA formatting, placement of images, form fields, media usage and placement, checkout process, etc. Keep it simple and only test a couple of elements at a time. Otherwise, you won’t be able to tell what changes contributed to the performance of the page.

Step Three: Build your alternate page(s) 

I am only testing two pages — the original page and a new format of that page. Using a WordPress site made it easy for me to build a new a page quickly. If you wanted, you could test more than one version of the page you are trying to improve.

Step Four: Configure Content Experiments

This is the crux of the post. Configuring content experiments is relatively technical. It’s not difficult — just a little tricky. Below, I lay out the steps for setting up content experiments on your WordPress site. For the purposes of this example, I’m using my own personal website.

1. Make sure Google Analytics Tracking Code is placed on your site.

Tracking code should already exist on your site. If it doesn’t, stop everything. Do whatever you have to do to start tracking your site performance. If you don’t have the standard analytics code installed on your site, none of this will work.

2. Visit the Experiments settings in your Google Analytics reporting dashboard.


google content experiments








3. Begin to build your experiment.


choose create experiment


create your experiment


4. Choose an experiment objective.


choosing an experiment objective


5. Configure your experiment.


configure experiment


6. Set up the experiment on your site.


setting up the experiment on your site

This is the technical part. For a standard site, all you need to do is place the tracking code on the original page, within the <head> tag. That’s what I tried to do and received an error message in the experiments configuration, stating that my experiment could not be validated.

After some research, I found the solution. Unfortunately, many WordPress templates make it difficult to add code to individual pages. Instead, you must edit the header.php file. It may sound challenging, but it’s not. To place your tracking code on your original page, there are two required actions.

Install the Google Content Experiments plugin. This plugin allows you to add content experiment code to individual pages within WordPress. Once installed, a field will appear on your admin pages. It looks like this:

google content experiments plugin

When viewing the editor of your original page, find the Google Content Experiments Settings section and select “Activate Content Experiments on this page” Once you check that box, you will see this:

google content experiments plugin

Enter your experiment tracking code into the field and update the page. Keep in mind, you only need to add this code to the original page, not the alternate pages.

The second part is editing the header.php file. Open your header.php file, either within the Editor section of your WordPress Admin dashboard (under Appearance) or access the file using an FTP tool. If you’re accessing the file using FTP, you can either download the header.php file and edit it, or open it straight from the tool and choose to edit it with your preferred application. I used Sublime Text 2.

Once you have the file open, look for the <head> tag and place the code below, under the tag.

<?php do_action( 'wp_gce_head' ); ?>

It should look like this:

adding google content experiments code to header.php

The PHP code you just added is telling the header file to look for the WordPress Content Experiments tracking code on the site pages. If the code is found, it will be delivered to the browser and voilá, testing begins!

It takes time to test your site. I recommend running the test for at least 30 days or until a clear winner is determined. You can find the results and edit your experiment at any time. Results can be found in the same area of Google Analytics where you originally set up the experiment.

For those of you looking to get into testing, here are some helpful articles to get you started:

Experimentation and Testing, A Primer

11 Obvious A/B Tests You Should Try

A Beginner’s Guide to A/B Testing: Exceptional Web Copy

11 Common A/B Testing Myths Busted

I will be reporting the results of my test in an upcoming post. In the meantime, tell me how yours went. What elements did you choose to focus on? What were the results?