Replacing or removing certain parameters on a Split URL experiment
It may be the case that you want to redirect your users, on an experiment to another page while removing certain parameters that might be in a different order.
So, let say that you have a URL in which you want to remove two parameters:
What we want is to replace the pid=omabsv4 with pid=sls, and usfid=oadflow03 with usfid=oadflow04.
So, we would like to get a resulting URL like:
One of the advantages of using this over a normal Split URL is that the parameters can be in any order, and that query parameters alternative to the ones replaced will be only transferred to the new URL.
url = document.location.href;
var replace = '';
var p1 = /pid=.*?&/;
var p2 = /usfid=.*?&/;
url = url.replace( p1, 'pid=sls&' );
url = url.replace( p2, 'usfid=oadflow04&' );