How to Use Google Optimize to Run Experiments On Your Site in a Few Minutes

How to Use Google Optimize to Run Experiments On Your Site in a Few Minutes

As WordPress developers, you’re always on the lookout for new ways to improve your workflow as well as your project’s outcomes. We already know that A/B testing is something that can help with this.

The problem with many A/B testing tools, though, is that they tend to cost a lot of money to use and they don’t always integrate as seamlessly with our WordPress sites or backend analytics as we’d like. But guess what? Here comes Google with a new solution to change all that. (Surprise, surprise!)

Google’s answer to A/B testing is called Google Optimize. If you haven’t heard much about it yet, it’s probably because the tool just left beta last year. That’s not to say it’s too early to adopt; in fact, some of my colleagues have already started to use this A/B testing tool on their websites and they can’t stop raving about it.

Google Optimize is free to use and offers a great introduction to the wonderful world of A/B testing. Google Optimize 360 is the premium version of this A tool and will help take your site’s testing and personalization capabilities to new heights—when you’re ready.

Shall we explore all that this new Google tool has to offer? I think so.

What is Google Optimize?

Google Optimize is an A/B testing tool that integrates directly into your Google Analytics account. Really, it was only a matter of time before Google made the leap into this space—and it’s a fantastically convenient and powerful A/B testing tool, to boot.

Here are some of the reasons why I think WordPress developers need to get on board with Optimize right now:

  1. It’s free. (At least until you’re ready to scale to 360.)
  2. It integrates with Analytics so you can create A/B tests based on factual evidence from your site’s performance and not just guesses.
  3. It’s quick to set up since it only requires that you add a single line of code to your Google Analytics. The Motley Fool website has been using Optimize for some time and found that it saved them days in deploying their A/B tests (from two or three days to only ten minutes!)
  4. Results are quick to notice. In that same case study about The Motley Fool’s experience with Optimize, they noted an increased conversion rate of 26% on their newsletter order page.
  5. A/B tests can be as simple as changing a button color or something more advanced that’s related to geographic or behavioral differences.
  6. Set up of A/B tests can be completely personalized. If you prefer working with a visual editing interface, you can use Optimize’s WYSIWYG. Or, if you prefer to create you’re A/B testing variations with code, there’s an option to do so with HTML, CSS, and JavaScript editing.
  7. Optimize comes with real-time diagnostics within the visual editor so you can see potential problems with your tests before you run them.
  8. Mobile A/B testing capabilities are included.
  9. Optimize 360 comes with deeper data dives and personalization based on customer personas and other advanced segmentation.

You already know you’d be lost without Google Analytics. The insights about visitor behavior alone are enough to give you an idea of what’s working well on your WordPress site and what’s not. But now there’s an A/B testing tool that works hand-in-hand with Analytics? It’d be silly not to at least give it a try.

How to Set Up and Use Google Optimize on Your WordPress Site

Getting started with Google Optimize is easy if you already have a Google Analytics account. Getting your first A/B test set up in Optimize? Just as easy! Let’s walk through the steps.

Step #1: Set Up Your Account

Signing up for Google Optimize.

First, make sure you’re logged into the Google account associated with your Analytics.

Then go to the Google Optimize website and choose the option you want. If this is your first time using Optimize, go with the free one until you’re comfortable with the tool and ready to scale up to the premium 360.

Getting started with Google Optimize.

Click on Get Started on the next page. You’ll then be shown two more setup pages—one for email notification preferences and one for account data settings. Fill in your responses and then proceed.

Step #2: Link Your Analytics

Link your Analytics properties to Google Optimize.

Although the next page gives you the option to kick off a new experiment (or test), you’ll first want to link your “property” so that you can take advantage of the Analytics-to-Optimize connection.

To do this, click Link Property.

Selecting your Analytics properties.

If you’re logged in with the correct Google account, you should see your website listed under Google Analytics Property. If not, open the drop-down and select the correct one (or go back and log yourself into Google with the correct email address). Check the box for All Web Site Data and then hit the Link button.

Step #3: Link Your Website

Before you go back to the main Optimize screen, you’re going to see a popup asking you to add the Optimize snippet to your website. You can choose to skip this step for now, but you won’t be able to run any tests until Optimize has direct access to run experiments. So, go ahead and click on Get Snippet.

You’ll receive two pieces of code: the Optimize “plugin” snippet and the updated Analytics tracking code. It’ll look like this:

You’ll only need to use one or the other. If you want to hunt down your Analytics tracking code, you can replace it entirely with the new one or you can swap out the single plugin code. Once you’ve decided how you want to handle it, go into WordPress and update the tracking code on all the pages you want to run your tests on (if not all of them).

You can read more about this here.

Step #4: Add the Page Hiding Snippet

On the next page, Google suggests that users add a page hiding snippet to your code, directly before the Analytics tracking code. It’ll look like this:

This is to ensure there are no issues with page flicker or slow-loading content when test variations are served to your visitors.

Step #5: Get the Chrome Extension


If you want to use Google Optimize’s visual editing interface, you’ll need to install the Chrome extension.

Step #6: Set Up an Experiment

Once you have everything set up in Analytics, Optimize, and WordPress, it’s time to set up your first A/B test.

Click on Create Experiment.

Creating an experiment

Next, enter the details for your experiment. Click on Create when you’re done.

Name your experiment

Within this next screen, you’ll need to set up all the details for your test.

Setting up variants.

Google requires that all details be captured before you can launch the test. This includes:

  • The names of the variants. There should be one original (which you can’t alter) and then as many variants of the same element as you want. Note: this may differ based on the type of A/B test you selected in the previous screen.
  • Within each variant, you’ll need to select the percentage of visitors you want to show the alternative design to. This will automatically default to an equal share among all variants.
  • Enter a primary objective for your experiment. If you already have Goals created in Analytics, you can choose one of those or you can select from Pageviews, Session Duration, or Bounces.
  • Enter your description and hypothesis under Objectives.
  • Under Targeting, you can change the amount and percentage of visitors you want to serve the test to.
  • If you want a specific action to trigger the A/B test to occur, you can set this up under the “When” and define a new rule. Even if there are no special actions, you will need to at least define the URL match under Additional conditions. But, really, before resolving to keep it that simple, do take time to check all the different condition parameters you can play around with. Geo, technology, cookies, JavaScript variables, and more are all ripe for the taking.

Once you’ve captured all your test’s details, click on the Save button.

Step #7: Customize the Variants

Once you’ve saved your test, you can go in and customize your variants. Simply click on whichever variant you want to define and you’ll be taken to the front-end visual editor on your site.

There is a top bar that runs along your site in this visual mode that tells you which test you’re in, which variant you’re working on, and which device you’re viewing these changes from.

The smaller bar beneath will let you know which element you are about to edit in this variant—and you can do so directly in the visual editor or in the CSS (click the < > icon on the right).

Editing a variant

In the visual editor, click on the element you plan on changing. You’ll see an Edit Element box pop up on the right side of the screen. Set the changes for that element within the box. Once you’re done, click on the Save button in the top-right corner.

To define other variants in your test, you don’t need to return to the Optimize dashboard, simply click on the variant box in the top-middle of the bar at the top.

When you are finally ready to launch your test, hit the back arrow button in the top bar and return to Google Optimize.

Step #8: Preview the Variant


Before launching your experiment, preview each variant one more time to verify that everything looks the way you want it to. Under Variants, click on the desktop icon and then select the device you want to preview the changes on: web, tablet, or mobile.

Step #9: Launch the experiment

Once you’re satisfied with your A/B test, you can take the experiment out of Draft mode and launch it. Go to the grey Draft bar at the top of your experiment’s page and click Start Experiment. When the test launches, you’ll then be able to enter your test’s End Date in the Schedule sidebar so that it doesn’t run indefinitely.

Wrapping Up

As with any A/B test you run on your site, you’ll want to monitor reporting for the first few days to ensure that the test runs properly; in other words, that all variants are actually being served to your visitors. Once you’re assured that it’s moving along, you can refer to the Reporting tab in Google Optimize after some time has passed to assess the results and make a decision on which variation of your site you want to keep.

And if you’re feeling like this is way too easy, it’s because it is! Gotta love how simple Google makes the process of testing, analyzing, and optimizing your website.

Brenda Barron
Over to you: If you’ve already had some time to experiment with Google Optimize 360, we’d love to hear your thoughts and experiences on this premium service.