Rich-text Reply

Redirect experiment on a dynamic URL

hdeulkar 10-05-16

Redirect experiment on a dynamic URL

How can I setup a redirect experiment on a dynamic URL? We have an optimizely redirect experiment setup currently with the targeted URL something like and variations as and Is it possible to setup a similar redirect experiment with a dynamic URL? Targeted URL Regex:[A-Z0-9]{12}/ Variation 1:[A-Z0-9]{12}/?vs=1 Variation 2:[A-Z0-9]{12}/?vs=2
Level 1

inigam 10-06-16

Re: Redirect experiment on a dynamic URL

[ Edited ]


Interesting test, something you can try is below

Once you have added any URL to a redirect URL of a variation.
Open the Edit Code box for the Variation code.
you will find something like this below

(you can potentially use regex here or ask your developer: refer the article)


_optly.redir.href="YOUR REDIRECT URL";

try to change it to
_optly.redir.href="YOUR URL WITH REGEX"+"?vs=1";        // or anything else you want to add

and Apply and Save it !

Hope this works for you. let me know if it does.



Level 6
CouchPsycho 10-06-16

Re: Redirect experiment on a dynamic URL

Yes, you can. Assuming that your url-targeting works right, you can refer to the current url like this:


var currentUrl = window.location.href;

In your variations just add the additional parameters to currentUrl and redirect.


But always be sure to have a correct tagreting in order to prevent any kind of loop.

"the essence of the creative act is to see the familiar as strange." (anonymous)