Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run an A/B test on a WordPress site and measure it with Google Analytics 4 (GA4), use a separate experiment platform to create the variants and assign visitors. Connect that platform to the GA4 property, verify that both variant assignments and the outcome you care about are being recorded, then review results in the experiment platform and GA4. GA4 does not create or allocate test variants by itself; Google says an A/B test in Analytics requires integration with a third-party testing tool (Google Analytics Help: A/B test).

What you need before starting

  • A WordPress site and a GA4 property with the correct web data stream.
  • A testing platform that can create and assign variants on your site.
  • A way to send the variant identity and relevant outcome data to the same GA4 property.
  • A specific outcome to measure, such as a relevant key event, click-through, or conversion.

Google’s terms A/B test, A/B/n test, and A/B experiment refer to tests in which variants are shown to randomized samples during the same period. Decide what you want to learn before changing the page, and keep a record of which variant each visitor receives.

Connect WordPress to GA4

Site Kit by Google can connect WordPress to an existing Analytics account, property, and web data stream, or help set up a new one. It can also display selected Analytics information in the WordPress dashboard. During setup, Site Kit can add Analytics code if it does not find an existing snippet, so check whether your theme, another plugin, or Google Tag Manager is already adding tracking before proceeding. Avoid placing duplicate Analytics code on the site. See Site Kit’s Analytics documentation.

Choose an experiment platform

The testing platform, not GA4, must create the page experience, allocate visitors to variants, and retain the assignment. Google Optimize and Optimize 360 were retired and became unavailable on September 30, 2023; instructions that depend on Optimize are no longer usable. Google’s retirement notice names AB Tasty, Optimizely, and VWO among providers it worked with on GA4 integrations, but that is not a guarantee of current WordPress compatibility, pricing, or suitability for a particular site (Google’s Optimize retirement notice).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Evaluate a tool against the implementation you actually need: compatibility with your WordPress theme or page builder, how it assigns visitors and records variants, whether its GA4 connection is native or requires Google Tag Manager or custom setup, what outcomes and reports it supports, and the effort to maintain it. Confirm current pricing and product capabilities directly with the provider; the available documentation does not establish a single best platform or comparative performance results.

  • AB Tasty: Its documentation describes a GA4 push integration that sends an abtasty event with campaign and variation parameters. Reporting those parameters in GA4 requires creating custom dimensions (AB Tasty’s GA4 integration guide).
  • VWO: VWO documents a WordPress integration for adding VWO to a WordPress site and identifies A/B testing and optimization as use cases (VWO WordPress Integration).
  • Optimizely: Google listed Optimizely among its integration collaborators. Optimizely documents sending experiment and variation information to GA4 through Google Tag Manager (Optimizely’s GA4 and GTM guide).

Set up the test and GA4 measurement

  1. Choose one question and outcome. For example, decide whether a different call-to-action layout improves a relevant key event or click-through. Define what counts as the outcome before launching.
  2. Create the control and variant in the experiment platform. Change a clear element or experience, and use the platform’s assignment method so visitors are allocated to variants as intended.
  3. Configure variant identification in GA4. Follow the chosen platform’s integration instructions so events or parameters identify the campaign and the variant. Google’s provider-oriented integration guide describes one approach using an experience_impression event with an exp_variant_string parameter; it is primarily guidance for experiment providers, not a no-code WordPress setup (Google’s GA4 experiment integration guide).
  4. Configure outcome events. Site Kit does not configure event tracking on its own. Site Kit’s documentation describes configuring events alongside Google Tag Manager and/or GA4, and recommends Tag Assistant as a way to verify tracking (Site Kit event tracking documentation).
  5. Verify before interpreting results. Use Tag Assistant and the available GA4 and experiment-platform diagnostics to confirm that the correct property receives both the variant assignment and the chosen outcome. If either is missing or incorrectly attributed, fix the integration before relying on the comparison.

Read results and finish the experiment

Use the experiment platform to manage the test and its allocations, and GA4 to interpret the integrated variant and outcome data. Site Kit’s dashboard shows selected Analytics information and links to Analytics for more detail. Do not treat an apparent difference as useful if the variant identity or outcome data has not been verified.

Rank #2
Sale
The Google Workspace Bible: [14 in 1] The Ultimate All-in-One Guide from Beginner to Advanced | Including Gmail, Drive, Docs, Sheets, and Every Other App from the Suite
  • The Google Workspace Bible: [14 in 1] The Ultimate All in One Guide from Beginner to Advanced Including Gmail, Drive, Docs, Sheets, and Every Other App from the Suite
  • ABIS BOOK

When the test has answered its question, end it, publish the selected experience, and remove obsolete test scripts, alternate URLs, or other experiment elements. Google Search Central advises running an experiment only as long as necessary and removing test elements when it concludes (Google Search Central’s A/B testing guidance, updated December 10, 2025).

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Protect search visibility during URL-based tests

Do not show Googlebot different test content from what people see; Google’s guidance identifies that practice as cloaking. If variants use multiple URLs, use rel="canonical" to indicate the original URL as preferred. For temporary redirects used in an experiment, use a temporary 302 rather than a permanent 301. Apply the guidance that matches the testing tool and URL pattern, and remove temporary redirects and test pages when the experiment ends. Google’s guidance also warns that an unnecessarily long experiment can be interpreted as an attempt to deceive search engines.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.