Get Started For FREE
Free forever 50,000 users
How to
Min read

How to create A/B Test for Dynamic URL? Step-by-step Tutorial

Donald Ng
December 3, 2023
5-star rating
Reviews on Capterra

You might be wondering, "Why can't I just use regular URLs?"

Well, you could, but here's the catch: When you're dealing with e-commerce websites or sites that have fluid content, dynamic URLs come into play. These URLs are generated on the fly with each session or user. For instance, when users filter or sort results, or shop with personalized preferences.

The challenge lies in effectively running A/B tests on these dynamically generated webpages which differ from user to user.

Let's dive in on how to create an A/B Test for a dynamic URL.

Dynamic URL Structure

If your goal is to redirect from to for every product and not only for the product 12345.

There is a very simple way to do it without creating thousands of experiment tests for each of the product IDs, all you need to do is to use wildcard matching.

Just follow these 3 steps to quickly setup dynamic URL redirection:

Prerequisite: You will need to register a account - it is totally free to get started for up to 50,000 monthly tested users.

1. Choosing test type

First, your test type should be Split URL / Redirect Test. Once you select that, make sure that you set up redirect rules for each of your variants - the versions of the element(s) that you’re testing.

2. Setup redirection URL and wildcards

Now setup the Base Variation URL as the original link but replace the dynamic part to asterisk (*). Then, setup variation 1 as /laptop-test/*.

For example, if your URL is and you wanted to test a new blog structure as You can just create the asterisked pattern as* and*.

3. Launching the test

That's it!

Your setup for an experiment between /laptop/(dynamic-ids) and /laptop-test/(dynamic-ids) is complete. You can now proceed to define the goal, allocate traffic and publish your test.

Supported Patterns and Examples

To extend your grasp of what's possible with dynamic split URL testing, here are a few examples of supported patterns:

Setup scenario 1

Control matching pattern:*

Variant 1 matching pattern:*/v1

Variant 2 matching pattern:*?v=2

Result #1

A user visited this URL,

When variant 1 matched:

When variant 2 matched:

Setup scenario 2

Control matching pattern:*/id/*

Variant 1 matching pattern:*/id/*-2

Result #2

A user visited this URL,

Variant1 (when matched):

A user visited this URL,

Variant1 (when matched):


This guide should give you a clear idea of how to create A/B tests for dynamic URL redirection.

These steps are all you need to improve the customer journey, track user preferences, and ultimately enhance your business strategy.

Download our free 100 point Ecommerce CRO Checklist

This comprehensive checklist covers all critical pages, from homepage to checkout, giving you actionable steps to boost sales and revenue.