Create Your First A/B Test

Chưa được phân loại

Want to use Google Optimize with WordPress to run A/B tests on your website?

With Google Optimize, you can set up A/B tests to assess the impact of changes to your website. You’ll be able to collect invaluable data on your visitors’ behavior, which you can use to improve your site even further.

In this article, we’ll teach you how to set up A/B tests using Google Optimize for WordPress in three simple steps.

First, however, let’s talk about how Optimize works!

An introduction to Google Optimize

The Google Optimize homepage.

Optimize is a service that works in conjunction with Google Analytics. It enables you to set up simple or complex A/B or multivariate tests for your website and monitor their performance using data from Google Analytics.

If you’re not familiar, A/B testing is a process where you create two versions or ‘variants’ of a page or element on your site. You can then compare users’ experiences with them to determine which is easier to navigate or generally more appealing to visitors.

With Optimize, you gain access to a handy visual editor that enables you to tweak elements on your website to create variants for testing. Plus, it integrates with other native Google services, such as Ads and Firebase, as well as WordPress.

How to use Google Optimize with WordPress (in three steps)

As we mentioned before, Optimize works alongside Google Analytics. That means before you get started, you’ll need to have a Google Analytics account that’s connected to your WordPress site. Once that’s ready to go, move on to the first step.

Step 1: Set up and configure a Google Optimize account

First, head over to the Optimize homepage and click on the Get started button:

The Google Optimize homepage

Right off the bat, Google will ask if you want to share your data with some of its other services. Whether you decide to or not won’t affect the next steps, so feel free to tick any options you want:

Data collection settings

Once you accept the terms of service, you’ll gain access to your Optimize dashboard right away. From here, you can create your first A/B test:

The Optimize dashboard.

Before you step into the lab, however, you’ll want to connect Google Optimize with WordPress.

Step 2: Link Google Optimize with WordPress

There are two ways you can go about this step. Assuming you already have Google Analytics connected to WordPress, Optimize provides you with a snippet to add within your existing tracking code. In practice, it looks something like this:

ga('require', 'GTM-XXXXXXXX');

For this approach to work, your Google Analytics tracking code needs to be located in your website’s header. If it’s not, you may have problems connecting Google Optimize with your website manually.

💡 If you’re not sure how to edit your Google Analytics tracking script, we recommend using one of the plugins below to connect Google Optimize to WordPress.

The second approach is to use a plugin that takes care of integration for you. Several popular Google Analytics plugins already support Optimize as well. Some of them include:

  • Google Site Kit: With this official plugin from Google, you can connect a broad range of Google services (including Optimize) with your website in just a few clicks.
  • GA Google Analytics: This plugin will ask you for your Google Optimize tracking code to connect the service to your website.

When plugins ask you for your Google Optimize container ID, they’re referring to the code that appears under Container setup within your account dashboard:

Your Optimize container ID.

A while ago, we talked about how to use Google Site Kit to connect services to your WordPress website. In our experience, this is the easiest approach. Just go to the Site Kit → Settings → Connect More Services in WordPress:

Connect more services using Site Kit.

Click on Optimize and Site Kit will ask you for your container ID. Copy and paste it and save your settings.

Step 3: Create your first A/B test

To create your first A/B test, go to the Google Optimize dashboard and select the option to create a new ‘experience’.

Go ahead and name your test and indicate which URL you want to use for your experience. You should enter the URL of the existing page that you want to test.

You can select from multiple types of tests, but we’ll stick to the A/B option for now:

Create a new Optimize experience.

Once you create the test, Optimize will ask you to add a variant for the page you want to tweak. Click on the Add variant button to get started:

Create Google Optimize WordPress test variants

For this test, we set up a single variant to compare against the original version of the page.

When you click on the Edit button next to the variant, you’ll see a prompt to install the official Google Optimize Chrome extension which will let you create your test variant using a visual interface:

Install the Google Optimize extension

With the extension active, you can click on the Edit button and tweak elements on your target page without accessing WordPress:

Editing your Google Optimize WordPress test variant

In the example below, we modified the Welcome text, removed the background image, and replaced it with a solid color:

Creating your Google Optimize WordPress test variant

Once you’re done making changes, you can save your variant and return to your dashboard. Then, scroll down to the Page targeting and Audience targeting sections, where you can set rules for your test:

Configuring your testing rules.

Next, Optimize will ask you to link the test to one of your Google Analytics properties:

Linking the test to an analytics property.

Finally, you get to choose an objective for your A/B test. There are pre-configured options, as seen below, but you can also specify your own:

Choosing an objective for your test.

Once you’re ready, scroll up and click on the Start button at the top of the page:

Starting the test.

Now all that’s left is to wait while Google collects data. After enough visits, you’ll be able to see which of your variants users prefer.


If you want to steer your website in the right direction, you need access to data and analytics tools.

With A/B tests, you can go a step beyond and run experiments to see what works and what doesn’t resonate with your audience.

Here’s how to start running A/B tests using Google Optimize and WordPress:

  1. Set up and configure a Google Optimize account.
  2. Link Google Optimize with WordPress.
  3. Create your first A/B test using Google Optimize.

If you want to see some other options for running split tests, check out our complete guide to A/B testing on WordPress, which shows you how to use some native plugin solutions.

Do you have any questions about how to use Google Optimize with WordPress? Let’s go over them in the comments section below!

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even 50-80%
just by following simple tips.

Bài viết liên quan

Trả lời

Email của bạn sẽ không được hiển thị công khai.