# The best A/B testing plugin or tool for WordPress

> There are two good ways to A/B test WordPress. A plugin such as [Nelio A/B Testing](https://wordpress.org/plugins/nelio-ab-testing/) tests WordPress content itself: pages, posts, WooCommerce products, menus, themes and CSS. A script-based tool such as Duelpilot goes first in wp\_head and changes the page in the browser, with your own AI agent designing and monitoring the tests. Either way, exclude it from WP Rocket, LiteSpeed Cache and other optimisers, or variants show late.

Last reviewed: 2026-10-29 · HTML version: https://duelpilot.com/guides/wordpress-ab-testing

## Plugin or script: which fits

A WordPress testing plugin works inside wp-admin. According to its [WordPress.org listing](https://wordpress.org/plugins/nelio-ab-testing/), Nelio A/B Testing tests pages, posts, headlines, WooCommerce products and pricing, menus, themes and CSS, adds heatmaps, and runs most experiment processing and reporting on Nelio's cloud services. That suits teams who want to build the alternative version in the WordPress editor they already use.

A script-based tool doesn't touch your WordPress content. It loads one tag in the head and changes the rendered page in the browser, so it works the same with a block theme, a classic theme, Elementor or any other builder, and with sites that aren't WordPress at all. That suits teams who want the tests run for them, or one tool across several sites. Script-based tools are compared on [the best A/B testing tools](https://duelpilot.com/best-ab-testing-tools).

A WordPress plugin and a script-based tool side by side. Nelio's column is taken from its WordPress.org listing.

|  | Plugin (Nelio A/B Testing) | Script (Duelpilot) |
|---|---|---|
| What a variant is | An alternative version of WordPress content: a page, post, product, menu, theme or CSS | Changes to the live page: copy, styles, layout, images, inserted or moved blocks, or a split URL |
| Who does the work | You build the versions in WordPress | Your own AI agent (Claude, ChatGPT, Cursor or another MCP client) proposes ideas, designs 2–4 variants and checks them on phone, tablet and desktop; you approve each launch, or autopilot launches within your guardrails |
| Caching and optimisation plugins | The listing advises testing your configuration if you cache full pages or combine and delay JavaScript | verify\_install detects WP Rocket, LiteSpeed Cache and Cloudflare Rocket Loader rewriting the tag and says how to exclude it |

## Install Duelpilot on WordPress

Duelpilot needs a synchronous tag printed first in the head, before analytics plugins, so a variant is in place before the page paints. Print it from wp\_head at priority 1. Don't enqueue it with wp\_enqueue\_script (themes, plugins and WordPress's loading strategies can add defer or async to enqueued scripts), and don't put it in a Custom HTML block or the Site Editor, which render in the body. The most robust place is a must-use plugin, which stays active when you switch themes:

```php
<?php
// wp-content/mu-plugins/duelpilot.php
/**
 * Plugin Name: Duelpilot
 * Description: Loads the Duelpilot A/B testing script first in <head> (sync, for no flicker).
 */
add_action( 'wp_head', function () {
	echo '<script data-cfasync="false" src="https://edge.duelpilot.com/s/YOUR_SITE_KEY.js"></script>' . "\n";
}, 1 );
```

The same add\_action works in a child theme's functions.php. Without code access, paste the snippet at the top of WPCode's Header box, or use Elementor Pro's Custom Code with location head and priority 1. Saving in wp-admin goes live at once, so try it on staging first if your host provides one, then purge the plugin, host and CDN caches. Your agent can do the code route as a pull request, or walk you through wp-admin and stop before every save.

## Exclude it from WP Rocket, LiteSpeed and other optimisers

Optimisation plugins rewrite script tags even when you print them yourself: they delay scripts until the visitor interacts, defer them, or combine them into one file. A delayed testing script shows the variant late, which is [flicker](https://duelpilot.com/guides/ab-testing-flicker), or never. Exclude the Duelpilot edge hostname (or /s/YOUR\_SITE\_KEY.js) wherever you see delay, defer, combine or minify:

- WP Rocket: Settings → WP Rocket → File Optimization → JavaScript Files: add it to the excluded JavaScript files of Load JavaScript deferred and of Delay JavaScript execution (and of minify or combine if you use them), or add the nowprocket attribute to the tag. Clear the cache.
- LiteSpeed Cache: Page Optimization → Tuning: JS Excludes, JS Deferred/Delayed Excludes and Guest Mode JS Excludes, or the attributes data-no-optimize="1" data-no-defer="1". Purge all.
- Autoptimize, Perfmatters, NitroPack, W3 Total Cache and SiteGround Speed Optimizer have similar exclusion lists; the install guide your agent reads (get\_playbook("install/wordpress")) names each setting.
- Cloudflare Rocket Loader: the snippet carries data-cfasync="false" so Rocket Loader leaves it alone; keep that attribute before src.
- Host and CDN page caches keep serving the old HTML until you purge them.

After every change, the agent runs verify\_install on the home page, a post or product and, on WooCommerce, the cart. It reads the page source and loads it in a real desktop and mobile browser. A tag rewritten to type="rocketlazyloadscript" or type="litespeed/javascript" fails with the exact exclusion to add; a tag printed in the body fails the head check; two copies (theme, plugin and tag manager) are flagged as a duplicate.

### Cookie banners

Consent plugins can hold the script back until the visitor consents. verify\_install warns when that happens. Whether Duelpilot may run before consent is the site owner's legal call; Duelpilot sets no cookies (it uses local and session storage) and has consent modes for Google Consent Mode, TCF and other consent managers. See [GDPR and A/B testing](https://duelpilot.com/guides/gdpr-ab-testing).

## WooCommerce

Duelpilot runs on WooCommerce product, cart and checkout pages. Payment fields are the payment provider's iframes and can't be changed. Goals can be clicks, page views, form submits or a dataLayer or gtag event with revenue, and results also come back from your [GA4](https://duelpilot.com/guides/ga4-ab-test-results) per variant, next to Duelpilot's own counter. If you want to test the product price itself inside WooCommerce, a plugin that changes the product, such as Nelio, is the more direct route.

## Try Duelpilot with your own agent

Give your agent one line: [set up Duelpilot for my site using /agents.md](https://duelpilot.com/agents.md). It opens a workspace, installs and verifies the script, and drafts the first test; you approve it, then switch on autopilot if you like. Or [see pricing](https://duelpilot.com/#pricing).

**[Start for €0](https://duelpilot.com/login) · [Give it to your agent](https://duelpilot.com/#start)** (€0 until you launch your first test)

## FAQ

### Do I need a plugin to A/B test WordPress?

No. A plugin such as Nelio A/B Testing is one route; a script-based tool such as Duelpilot only needs one tag printed first in wp\_head, from a must-use plugin, a child theme or WPCode's header box.

### Why does my A/B test flicker on WordPress?

Usually an optimisation plugin delays or defers the testing script, or it is printed in the body. Exclude it from WP Rocket's or LiteSpeed Cache's delay and defer settings, keep it first in the head, and purge every cache.

### Does Duelpilot work with WP Rocket?

Yes, once its script is excluded from Load JavaScript deferred and Delay JavaScript execution (or carries the nowprocket attribute). verify\_install detects a tag WP Rocket rewrote and says which exclusion to add.

### What does Duelpilot cost for a WordPress site?

Plans start at €9 per month per site; Pro, with autopilot, is €49. It's €0 until you launch your first test: installing, ideas, designs and previews cost nothing.

## Sources

- [Nelio A/B Testing | WordPress.org plugin directory](https://wordpress.org/plugins/nelio-ab-testing/) (checked 2026-10-29)

## Related

- [A/B testing without flicker](https://duelpilot.com/guides/ab-testing-flicker)
- [GDPR and A/B testing](https://duelpilot.com/guides/gdpr-ab-testing)
- [Best A/B testing tools](https://duelpilot.com/best-ab-testing-tools)
- [A/B testing with Claude](https://duelpilot.com/guides/ab-testing-with-claude)
