URL redirection (split URL experiments)

Written by Julie Trenque

Updated on 04/29/2024

2 min


Was this content useful?

In this article:

– An explanation of what URL redirection split testing is and why it’s useful

– A step-by-step guide to setting up URL redirection split tests with Kameleoon

– Examples of different use cases for URL redirection split testing

– How to QA this type of experiment

Unlike a classical A/B experiment, an A/B experiment with URL redirection implies that the different versions of the tested page are developed and hosted on your web server. The versions are made available to visitors directly via your website.

Let’s take the following example: you have two subscription pages you would like to test. Here are their URLs:


These two pages are accessible via your website. With Kameleoon, you can A/B test these two pages and analyze their performances and results.

Simple URL redirection

Launch the editor on your website, like for a traditional A/B experiment. Create one variation by page to test. Click on one of your variations to open the variation action menu. Then click on the “Redirect to a URL” button. A pop-in will open. Here, you will be able to configure your URL redirection for the selected variation. There are two kinds of redirection: “Global redirection” and “Redirection by parameter”.

Note: Kameleoon Web Experimentation performs redirections using JavaScript. If you prefer to perform URL redirection with the HTTP response status code 302, we recommend using our Feature Experimentation solution and one of our SDKs.

Global redirection

Global redirection is a simple URL redirection, without further parameters.

In the example above, to create the two versions of the subscription page, we should use this redirection.

You need to type a complete URL (and not just a fragment of the URL). For example, you can indicate a global redirection from:




Redirection by parameter

If you want to use the same URL but with extra parameters, use the “Redirection by parameter” option.

Indicate the parameters to add at the end of the URL. This can be useful if you want to change the default sorting of results, on a product page for instance.

Repeat this operation for every variation you want to test, indicating for each one which URL visitors have to be redirected to, instead of the original.

Warning: In the case of a split URL A/B experiment, it’s important to correctly target your experiment. Note that we highly recommend not using the “Presence of an element on the page” targeting option because it would significantly increase the flickering effect. Kameleoon would have to wait until the page loaded to check the presence or absence of the targeted element and then redirect visitors to one variation or another. For this kind of experiment, we recommend using the other targeting options (URL or advanced JavaScript condition). Likewise, if JavaScript code is used for complex redirection, we recommend keeping the box “Load this JavaScript code after page has finished loading (at DOMReady)” unchecked. Also, it’s not necessary to indicate in the targeting that both pages (A and B) are concerned: page A is sufficient.

URL redirection on several pages

When a split URL A/B experiment runs on several pages (for example, every product information page), you need more features than those available in the Redirection windows shown above. It’s often necessary to manage the redirection with a personalized JavaScript code.

Say, for instance, we wish to redirect every visitor accessing the following pages:


to these pages:


The technology, product and ID parameters change according to the product information page displayed. To run this test, it’s mandatory to write JavaScript code to ensure that every possible case is taken into account. Here is an example:

var url = window.location.href;
var redirect_url = url.replace("/product/", "/product_AB/");

Once the JavaScript code is written, you will have to carefully define the target. If you want to target via a URL, you need to restrict the test to URLs containing the following fragment:


Note: Running a split URL A/B experiment on several pages implies that elements of identification are not managed as parameters but straight in the URL. The page type will not be categorie.php?product= but /categorie/produit.html.

Don’t hesitate to consult our developer documentation on URL redirection

URL redirection and consent policy

When Kameleoon undertakes a redirection, data has to be stored on the visitor browser so that the visitor can be correctly identified when they land on URL B.

However, as no storage of data is allowed before consent has been provided, Kameleoon will not be able to store the variation ID and perform the tracking.

To overcome this problem, you can enable the redirect test only for visitors who have already provided consent. To do so, you can use this targeting JS condition:

return Kameleoon.API.Visitor.experimentLegalConsent || false;

More about consent policy

URL redirection and Sample Ratio Mismatch

Conducting experiments involving URL redirects increases the likelihood of encountering an SRM (Sample Ratio Mismatch). This occurs when some visitors redirected to variant B fail to see the page or when data collection only takes place after page B loads. Consequently, this results in a certain amount of data loss in variant B that would not be present on the original page. To address this, we recommend you follow our guidelines described here.

How to QA URL redirection experiments

To QA split URL experiments, open an incognito tab on your browser and follow these steps:

  1. Go to your page including the utm parameters: https://www.site.com?utm_param
  2. Open a new tab with the simulation.
  3. Refresh the tab: you will be targeted.
  4. Switch to your variation: the redirection will then be done.

When visitors are exposed once and targeted, Kameleoon collect their conversions during their visit, but also when they return (within the attribution window).The attribution window determines the period during which visitor conversions and transactions are attributed to a specific variation. Visitor conversions are only taken into account in an experiment if the visit has been targeted by the experiment, or if it falls within the attribution window.

For more information, you can refer to this article.

URL redirection and SEO impact

If you’re worried about the potential impact of redirect experiments on your website’s SEO or if you’ve noticed that your webpages have been deindexed since starting your experiments, we strongly recommend reading this article.

  • In this article :