Easy access to forced urls

Status: Maybe One Day
by gbesen ‎04-29-2014 April 29, 2014
When we setup an experiment we check the variations with forced urls instead of preview thing because most of the time we find that the variation does not work even if it works in preview. While this means preview sucks, the best way we found is to check the variation from the forced urls.

As a result it would be very useful for us to be able to click and go to forced url's instead of finding out the experiment id, the oprimizely_x syntax and variation id and append it to the test url.
Status: Maybe One Day
Level 2

by keith_lovgren Level 2
‎05-01-2014 May 1, 2014

Hi Gbesen,


I know this is not quite what you're looking for but I thought you might find it helpful


On occasions when I need  a direct url for preview and testing I grab the URL for the live preview and do a quick edit because all of the pertinent info is contained in it. Please see attached.


Anyway, I hope it saves you some time/steps.






by Optimizely
‎05-02-2014 May 2, 2014 - edited ‎05-02-2014 May 2, 2014

Hi @Gbesen,


I think you raise a great point. As part of the support team, I do a lot of troubleshooting and use the forced URLs all the time.


I've written some code which you can add as a bookmark on your browser. Simply add a new bookmark and copy/paste the code below into the URL field, as in the screenshot I've attached.


Clicking on the bookmark will bring up a prompt into which you can enter the experiment ID and variation number. Hit enter and the parameter will be added for you at the correct place in the URL. The code takes multiple parameters and hash parameters into consideration.


Hope this helps,



javascript&colon; (function () { var id = prompt("Enter the experiment id and variation # separated by =\nExample: 123456789=0"); var newparam = "optimizely_x" + id; var _optly = {redir: document.createElement("a")}; var loc = window.location.href.substr(0, window.location.href.indexOf("?")); var hash = window.location.href.indexOf("#"); var hashloc = window.location.href.substr(0, hash); var hashslice; if (hash > -1){ hashslice = window.location.href.slice(hash); }; _optly.cur = window.location.search; if (_optly.cur.indexOf(newparam) <= 0) { loc += "?" + newparam; _optly.redir.href = loc; if (_optly.cur) { _optly.redir.search = _optly.redir.search ? _optly.cur + "&" + _optly.redir.search.slice(1) : _optly.cur; } if (hashslice) { window.location.replace(_optly.redir.href + hashslice); } else { window.location.replace(_optly.redir.href); } } })();



by Optimizely
‎07-29-2014 July 29, 2014
Status changed to: Maybe One Day