URL redirection (split URL tests)

3

min

quiz

Unlike a classical A/B test, an A/B test with URL redirection implies that the different versions of the tested page to test 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:

http://mywebsite.com/SubscriptionA.html
http://mywebsite.com/SubscriptionB.html

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 classical A/B test. 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 opens. Here, you will be able to configure your URL redirection for the selected variation. There are two kind of redirections: “Global redirection” and “Redirection by parameter”.

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.

Redirection by parameter

If you want to use to 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 test, it is important to correctly target your test. Note that we highly recommend not to use 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 is loaded to check the presence or not of the targeted element and then redirect visitors to one variation or another. For this kind of test, we recommend to use the other targeting options (URL or advanced JavaScript condition). Likewise, if JavaScript code is used for complex redirection, we recommend to keep the box “Load this JavaScript code after page has finished loading (at DOMReady)” unchecked.

Advanced URL redirection

URL redirection on several pages

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

For instance, we wish to redirect every visitor accessing the pages:

http://mywebsite.com/product/sheet/technology,product,id.aspx

to the  pages:

http://mywebsite.com/product_AB/sheet/technology,product,id.aspx

The technology, product and id parameters change according to the product sheet displayed. To make this test, it is mandatory to write JavaScript code to make sure every possible case is taken into account. Here is an example:

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

Once the JavaScript code 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:

http://mywebsite.com/product/sheet/

Note: running a split URL A/B test 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.

URL redirection to another domain

To launch a split URL test with redirection to another domain, click on the arrow located on the right of the variation’s name to open the action menu. Then click on “Add JavaScript code” button.

Add the following line and write the URL between quotes:

Kameleoon.API.processRedirect(URL, true);

For a split URL test redirecting to another domain, it is necessary to fill the true,parameter, to let Kameleoon know that the redirection will be to another domain. When this parameter is equal to true, Kameleoon Kameleoon will add this parameter at the end of the URL:

kameleoonAVTE-XXX=YYY

before redirecting the visitor to the new page  (AVTE means AssignVariationToExperiment). XXX is the identification of the A/B experience the visitor is having and YYY is the variation chosen by Kameleoon. This parameter will be used to inform your web analytics solution which variation is seen by the visitor.

The visitor is redirected at a very early stage, when the page is not loaded yet and often before the call to your web analytics solution. When Kameleoon detects this parameter, it gives to your web analytics solution the missing information ofwhich variation was visited, which is needed i to analyze  A/B test results.