How to Use Google Website Optimizer with WordPress

Google Website Optimizer is a fantastic tool. For those of you who are not familiar with GWO, it is a free tool provided by Google to use to test elements of your website in order to increase traffic and conversions, or even to A/B test completely different layouts. Many people say that A/B or multivariate testing WordPress sites is a pain.

I found some resources that might be helpful to people who want to A/B or multivariate test their site.

Steps to A/B or Multivariate Testing Your WP Site

Step 1: Decide what you want to test

This, I think, is the hardest part of multivariate testing. What do you want to test? You need to decide what the goal of your website is. Is it to increase leads? Up your conversion rate? Get RSS subscribers? Figure this out, then move to Step 2.

Step 2: Build your site so that you have a final conversion point

Google Website Optimizer requires that you have a final place for your visitor to land in order to consider an action a “conversion.” If you want to increase signups for your service, you should have a final page where the person arrives after completing the action. For example, if your goal is to have someone complete a form to send you a lead, send them to a “Thank You” page after they submit the form.

Step 3: Create a copy of your page that you want to test

Continuing on our example of a contact form to gather leads, now you should create an alternate version of your Contact page. In WordPress, what I would recommend is creating a new page, with its own unique URL, that contains the changes you want to test. Save this page, but don’t link to it from anywhere. Also, make the URL something that you would not be ashamed using as your Contact page URL, or be prepared to implement the same changes on your existing page and redirect the better performing page to that URL.

Step 4: Set up your GWO account

Before you can start testing, you have to set up your GWO account. Go here to sign up using your Google account. You are allowed up to 10 tests at a time.

Follow the steps to setting up your experiment. They’re pretty straight-forward.

Step 5: Install the Google Website Optimizer for WordPress plugin

Now you are ready to install the Google Website Optimizer for WordPress plugin (which I use on this site also). What this plugin does is install a box on each post and page in the admin section of your site. It will look like this:



Step 6: Enter the scripts provided to you by GWO into the correct box

The Google Website Optimizer website will provide you with the scripts for your Control (the original page, most likely) page, the Tracking Script for both the Control AND Variation pages, and the script for your conversion page. Follow the instructions for each section in the plugin.

Step 7: Monitor through GWO

GWO offers tracking for you. Once you validate that the scripts are correctly involved, sit back and allow data to collect. You need to get at least 100 conversions to have valid numbers off of which to base decisions. The more traffic you can get, the quicker and better your data will be.


I’ve only really talked here about A/B testing, which is good for testing while new layouts, and forms. You can also multivariate test, which means that you can test individual elements on your page, such as the color of buttons. This is more involved, and I will not explain it in this post. Unfortunately I have not yet found any good resources for multivariate testing WordPress. I plan to write about it in the future.

If you know of any good resources for WordPress multivariate testing, please leave them in the Comments. I’d also love your feedback.

18 thoughts on “How to Use Google Website Optimizer with WordPress

  1. Hi John– here’s a challenge: what I want to do is test to find the best sidebar banner design to maximize click-thru to a landing page. The code for these banners is contained in a widget (on my WordPress site). This means that I don’t have a different URL for my page variations, as it is just a part of each of the 3,100 posts on my site. I’ve been scratching my head and Googling for solutions, to no avail. Any suggestions?

    1. What if you just run one widget style for one week, change it the following week, and then compare the conversion rate for each week? It’s not a true split-test, but if you have enough traffic and enough conversions to produce a valid sample size in each of the weeks, it should give you a pretty good idea.
      Week 1, Widget A: 4000 hits, 400 conversions, 10% conversion rate
      Week 2, Widget B: 4500 hits, 600 conversions, 13.33% conversion rate

      I’m not going to calculate the p-value, but I would be reasonably confident that Widget B produces more conversions.

  2. Hi John –

    Have you had luck getting this plugin to work in WP 3.2.1? It’s giving me an error every time I upload it.

    “Warning: call_user_func(Array) []: First argument is expected to be a valid callback in /home/welldone/public_html/intheshed/wp-admin/includes/template.php on line 970”

    Please let me know if you have any advice. Thanks!

    1. Hey Stephanie!

      Thanks for the comment. It was working for me in 3.1, honestly have not used it recently. I’ve recently been inspired to do more testing on this site though, so I’ll let you know!


  3. I am willing to use GWO with WP on a contact form 7 form.

    Contact Form 7 does not really redirect to a “thank you” page but I am using a method to simulate it for Google Analytics, similar to the one described here:
    It basically pushes a fake page:
    _gaq.push([‘_trackPageview’, ‘/mysite/thank-you.html’]);

    Now, I want to use a GWO a/b test (my first time) and am looking at the different plusgins, however I wonder if it will be possible using this method, or if I need a “real” thank you page.
    Any clue?

  4. You need to make a few changes to the plugin for new versions of WP.

    Edit class as follows:

    Replace line 49: add_action(‘plugins_loaded’, array(&$this, ‘action_plugins_loaded’));

    With: add_action( ‘add_meta_boxes’, array( &$this, ‘action_plugins_loaded’ ) );

    Then remove the require_once line from action_plugins_loaded method.

    This should bring back the plugins meta boxes. Works for me so give it a try.


      You also need to move the add_action calls from action_plugins_loaded() method into the class constructor, below the newly added add_action for “add_meta_boxes”.

      Missed this out, sorry!

  5. Great information. I am still a little curious about the plugin. In the second box are we supposed to just put the variation page script on the variation page? It says install the tracking script if it is the original or the variation page. Any advice is appreciated. Thanks

    1. Hi Ryan –
      There should be three fields, one of which is for the control and one of which is for the variation. Put the given GWO code on the correct page. So if it’s the control page, ONLY put the control script on there. If it’s the variation page, do NOT put the control script on but rather put the variation script.

      Hope this helps.

  6. “Create a copy of your page that you want to test.”

    Huh? That’s it?

    That plug-in does nothing other than insert the JavaScript into the page.

    How do you create a copy of a WordPress page? The comments on the page are a key part of the sales appeal of the page. How do I make sure that there are there on both pages, including new comments during the test?

    Any plug-in needs to automate the duplication of the page and make sure the comments are the same. The date and title in the URL slug need to be the same (with the addition of perhaps a “-b” or something.

    Otherwise, this sort of thing is (1) an incredible hassle, and (2) methodologically invalid.

Comments are closed.