THIS ARTICLE WILL HELP YOU:
Issue
In Convert Experiments you can create from Simple to complex Split URL Experiments (Javascript redirected).
However, creating experiments in which you have multiple URLs, which should redirect to corresponding URLs within the same experiment, might be too complex to code with regex or to configure within a Convert Split URL Experiment.
Solution
For this cases, we have created the following recipe. However, first we will provide a graphic example of what the experiment entails:
The configuration of the experiment will use the Convert convert.redirect() javascript explained in a simpler experiment article.
Follow the steps to configure this type of experiment.
- Create a normal Convert AB Experiment. Do not create a Convert Split URL Experiment. Use any of the initial URLs to start the configuration of the experiment. Let's say: https://domain.com/page1.html.
- While you configure this experiment, it will open the visual editor. Open the "Variation JS" editor:
- Add the following code to the Editor and configure it according to your experiment requirements and save your test and exit the editor.
if (document.location.href.includes("https://domain.com/page1.html")) {
convert.redirect("https://domain.com/page1b.html");
}
else if (document.location.href.includes("https://domain.com/page2.html")) {
convert.redirect("https://domain.com/page2b.html");
}
else if (document.location.href.includes("https://domain.com/page3.html")) {
convert.redirect("https://domain.com/page3b.html");
} - Configure your Site Area by adding the Visitor Requested URLs that will bucket them into the experiment:
Now test your experiment in a fresh incognito session or utilize Convert's well documented QA process.
Pass Parameters from Original to Variation URLs
If you want to pass parameters from original to variation URLs you can extend the above code with this:
var parameters = (new URL(document.location)).searchParams;
if (document.location.href.includes("convert")) {
convert.redirect("https://www.convert.com" + "?" + parameters);
}