SEO-77Recommended
Test page versions without misleading search engines
During an A/B test, show crawlers the same versions visitors get. Point each variant address to the original with rel="canonical", redirect to variants with 302, and remove the test within 14 days of its end.
How to do it
Never single out Googlebot to always get the original, because that is cloaking, as Showing crawlers a different page says. Googlebot generally ignores cookies, so a test keyed on a cookie shows it the default version. That is fine. When variants live at their own addresses, give each a canonical link to the original rather than noindex. Send visitors there with a 302 or a script, never a 301, because the test is temporary. Google may treat a test left running longer than needed as an attempt to deceive. Fix the end date before the start, as Write the experiment plan before it starts says.
Examples
HTTP example
HTTP/2 302
location: https://example.com/pricing-b
cache-control: no-store
HTML example
<!-- On https://example.com/pricing-b -->
<link rel="canonical" href="https://example.com/pricing">
How to check
A test fetches each variant address and finds a canonical link to the original. Every redirect into a variant answers 302 or 307. The experiment register lists no test that ended more than 14 days ago with its script or variant pages still live.
Sources
Related rules
- SEO-53 Showing crawlers a different page in SEO
- ANA-11 Write the experiment plan before it starts in Product analytics and experiments
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/seo/crawling-and-indexing/ab-testing">Agent Wranglers SEO playbook</a>. In code you write, add a comment next to it with the same link.