Site search

Search IndexLane

Type at least two characters to search.

    Technical note

    How to run A/B tests without confusing Google

    Choose the right URLs, redirects, and canonicals for an A/B test, then check assignment and caching before launch.

    By NikoPublished July 23, 2026Updated September 5, 2026Read 3 min

    An A/B test can stay accessible to search engines. Use the same assignment rules for users and crawlers, keep alternate URLs tied to the original page, and remove the test setup when it ends.

    Do not serve Googlebot a special control page while comparable visitors receive materially different content. Google's website-testing guidance applies its usual rules against cloaking during experiments.

    Decide whether the test needs a second URL

    A headline or button test can usually use the existing URL. Separate pages make sense when the experiment changes the document or navigation flow.

    TestURL setup
    A component changes on the same pageKeep the page's self-referencing canonical and primary purpose consistent
    Some visitors move from the original URL to a test pageUse a temporary 302 redirect
    Visitors can open the test URL directlyPoint its canonical to the original URL

    For a test page that should be consolidated with the original, use a canonical rather than noindex.

    Check visitors without cookies

    Googlebot generally does not retain cookies. A visitor without cookies should still receive a complete page under the normal assignment rules. Avoid user-agent or crawler-IP checks that exist only to force Google into one variant.

    Record the experiment and variant in server logs so you can reproduce what happened. An internal response header can also help during QA:

    X-Experiment: checkout-copy-2026-07
    X-Variant: b
    

    Keep personal or sensitive assignment data out of public headers. Check the cache key too: if assignment depends on a cookie but the shared cache ignores it, one visitor's variant may be served to everyone.

    Test every accessible variant

    Request the original page and each test URL without cookies, then repeat with each valid assignment. Check that:

    • the status, canonical, and robots directives match the intended setup;
    • primary content remains available to ordinary visitors and crawlers;
    • navigation renders as links with an href;
    • the cache respects the assignment;
    • analytics records each exposure once, rather than again on every render.

    For example, a temporary redirect can send an assigned visitor to a variant:

    HTTP/1.1 302 Found
    Location: https://example.com/landing-page?variant=b
    

    The variant points back to the original:

    <!-- on the directly accessible variant -->
    <link rel="canonical" href="https://example.com/landing-page">
    

    Remove the test setup when it ends

    Apply the winning content to the final page. Remove assignment code, temporary redirects, test-only parameters, and cache rules. Redirect retired test URLs that no longer need to exist to the final page, and update links and sitemap entries that still advertise them.

    Run the response checks again after cleanup. A finished experiment should leave one clear public destination, without old assignment code changing what visitors receive.

    Related notes

    How to verify Googlebot requests in your logs

    Check the source IP of a request claiming to be Googlebot. Use Google’s published ranges or reverse-and-forward DNS before trusting crawler totals.

    Read article →

    Index bloat: which archives and filters should stay indexed?

    Review empty archives, duplicate filters, and other generated URLs. Keep useful landing pages and choose the right control for the rest.

    Read article →