A/B Testing WordPress Posts with Google Optimize

Google Optimize offers a free, yet a very robust solution for A/B tests and tracking results. The winning results are based on certain metrics or objectives you choose.

It works seamlessly with WordPress sites (and many others), and as long as you have Edit permissions or higher in Google Analytics you can set up a Google Optimize experiment.

Let’s start with an example:

We hypothesize removing featured images from posts will result in better engagement.

Improving Bounce Rates will be the Objective of the experiment.

Testing this one post at a time is not possible in most cases because each experiment will run one or more weeks. But, we can test our hypothesis on ALL single posts of a content type in one experiment.

Two requirements for this to work:

The element we’re changing (e.g. featured images) can be identified across every page we’re targeting (e.g. articles).

Our permalinks are structured so post types can be targeted via URLs.

Let’s Get to the Experiment

Log into https://optimize.google.com and click the big blue button to Create Experiment

Use an example single article page. For example that could be: https://northward.io/articles/title-separator-symbols

Click Create Variant and give it a name. E.g Featured Images and save your experiment.

Then click the Variant you just made to open the Optimize editor and implement your change(s). *You’ll be prompted to install the Chrome extension for Optimize if you don’t already have it. It is necessary to preview/edit Variants in your browser.

Click to highlight the featured image, and then Click the blue Edit Element > Remove.

Save your changes and go to the experiment details page and then click the targeting tab.

Edit the default rule, which will be set to:URL Matches https://northward.io/articles/title-separator-symbols

Change that to something like:Path starts with /articles/ or for trickier targeting, you can use regex. Something like:URL matches regex https://northward.io/articles/.*

Check your rule by entering a few full URLs into the checkerIn this case, the green checkmarks tell us it will work on single article pages, and the red slash means it does not meet the conditions. This is good because we only want our experiment to run on single articles. Not on the /articles archive page.

If there are no visible error messages, and your previews look good, it’s time to start your experiment.

Gathering Data

Now, we sit back and let Google Optimize gather data for us. At any time while your test is running, you can click the Reporting tab and check how things are going. This will show us how our objective is doing over time. Make sure to collect enough data to have a clear winner. This will take anywhere from 1 week to a month depending on your experiment traffic.

This solution will work for custom post types including product pages, portfolios, or testimonials. Or even for your taxonomy archives (categories/tags) and author pages. As long as the two requirements above are met, you should be good to go.

You can also apply this same type of URL or Path targeting to multivariate tests in Google Optimize as well.

Have any success or questions? Let us know in the comments. Happy experimenting!