This or That? Google Analytics Content Experiments in WordPress

September 18, 2014 | 3 min read
By Adam Smith

At Marketing Mojo, we love data and use it to make many of our decisions. We develop a lot of A/B tests using Google Experiments for a variety of reasons:

  • Try out a new theory on designing for conversions.
  • Testing our landing page designs vs.  a client’s to see which converts better.
  • It’s fun! This year, we ran an A/B test using different employees for the “hero” shot on our home page to see who converted the best.

  Adam Smith   Amanda Sides   Janet Driscoll Miller

Which one would you choose?

While Google Experiments isn’t without its problems, we’ve found it to be an inexpensive and fast option for testing. Our platform of choice for our site is WordPress. I’m going to focus solely on adding the experiment to WordPress, but we also have a great post on how to set one up.

To Plugin or Not to Plugin

Just like any other site functionality you can dream of, there are tons of  WordPress plugin options for A/B testing.

Some of the better plugins include:

Personally,  I try to avoid plugins wherever possible. Plugin conflicts are a problem along with the increased management time and site complexity. Even without much coding knowledge, you can easily add the Experiment Code to your site.

Adding Experiments by Hand

With Universal Analytics, Google has simplified the process of putting the code on your site. It only needs to be added to the original page (the “A” version). The “B” version is identified in Analytics itself.

The Content Experiment code is placed immediately after the opening head tag in the “A” page. Since all of my templates use the header.php theme file, I’ll need to add some conditional statements to make sure it only loads on the appropriate page.

Home Page Example

[php]
<head>
<?php
if(is_front_page)){ ?>
<!– PUT GOOGLE EXPERIMENT CODE HERE –>
<?php } ?>
[/php]

Page Example

Using the WordPress is_page() function, you can identify any page by title, id, or slug. Here is an example using the page slug:

[php]
<head>
<?php
if(is_page(‘about-us’)){ ?>
<!– PUT CONTENT EXPERIMENT CODE HERE –>
<?php } ?>
[/php]

Post Example

You can even A/B test your blog posts. The is_post() function has been replaced by is_single() function. It takes the same parameters as is_page(), title, id, or slug. Here is an example by post with the id of 212.

[php]
<head>
<?php
if(is_single(212)){ ?>
<!– PUT CONTENT EXPERIMENT CODE HERE –>
<?php } ?>
[/php]

Pretty simple and no plugins required! How do you run tests in WordPress? Feel free to comment below or find me on Twitter @schmack.

Share This Post

The 2 Hottest Landing Page Hero Shot Trends
The Evolution of Product Listing Ads
Subscribe to the Digital Marketing Tip!
Get the latest insights and time-tested wisdom from veterans of the digital marketing industry.

This or That? Google Analytics Content Experiments in WordPress

September 18, 2014 | 3 min read
By Adam Smith

At Marketing Mojo, we love data and use it to make many of our decisions. We develop a lot of A/B tests using Google Experiments for a variety of reasons:

  • Try out a new theory on designing for conversions.
  • Testing our landing page designs vs.  a client’s to see which converts better.
  • It’s fun! This year, we ran an A/B test using different employees for the “hero” shot on our home page to see who converted the best.

  Adam Smith   Amanda Sides   Janet Driscoll Miller

Which one would you choose?

While Google Experiments isn’t without its problems, we’ve found it to be an inexpensive and fast option for testing. Our platform of choice for our site is WordPress. I’m going to focus solely on adding the experiment to WordPress, but we also have a great post on how to set one up.

To Plugin or Not to Plugin

Just like any other site functionality you can dream of, there are tons of  WordPress plugin options for A/B testing.

Some of the better plugins include:

Personally,  I try to avoid plugins wherever possible. Plugin conflicts are a problem along with the increased management time and site complexity. Even without much coding knowledge, you can easily add the Experiment Code to your site.

Adding Experiments by Hand

With Universal Analytics, Google has simplified the process of putting the code on your site. It only needs to be added to the original page (the “A” version). The “B” version is identified in Analytics itself.

The Content Experiment code is placed immediately after the opening head tag in the “A” page. Since all of my templates use the header.php theme file, I’ll need to add some conditional statements to make sure it only loads on the appropriate page.

Home Page Example

[php]
<head>
<?php
if(is_front_page)){ ?>
<!– PUT GOOGLE EXPERIMENT CODE HERE –>
<?php } ?>
[/php]

Page Example

Using the WordPress is_page() function, you can identify any page by title, id, or slug. Here is an example using the page slug:

[php]
<head>
<?php
if(is_page(‘about-us’)){ ?>
<!– PUT CONTENT EXPERIMENT CODE HERE –>
<?php } ?>
[/php]

Post Example

You can even A/B test your blog posts. The is_post() function has been replaced by is_single() function. It takes the same parameters as is_page(), title, id, or slug. Here is an example by post with the id of 212.

[php]
<head>
<?php
if(is_single(212)){ ?>
<!– PUT CONTENT EXPERIMENT CODE HERE –>
<?php } ?>
[/php]

Pretty simple and no plugins required! How do you run tests in WordPress? Feel free to comment below or find me on Twitter @schmack.

Share This Post
PREVIOUS POST

The 2 Hottest Landing Page Hero Shot Trends
NEXT POST

The Evolution of Product Listing Ads
Subscribe to the Digital Marketing Tip!
Get the latest insights and time-tested wisdom from veterans of the digital marketing industry.