Rich-text Reply

Variation redirect all pages to same page with aditional params

christianhawk 10-30-16

Variation redirect all pages to same page with aditional params

Hello everybody.

 

I need to run an experiment:

Original: www.site.com/*

Variation: www.site.com/*?param1=x&param2=z

 

Do you know how can I do it?

thanks.

Chris

 

JasonDahlin 10-31-16
 

Re: Variation redirect all pages to same page with aditional params

Target your entire site and run this:

/* _optimizely_redirect=http://custom */
/* _optimizely_evaluate=force */
	var newURL = currentURL = window.location.toString();
	var newParams = 'param1=x&param2=z';
	if (currentURL.indexOf('?') > 0) {
		newParams = '&' + newParams;
	} else {
		newParams = '?' + newParams;
	}
	newURL = currentURL + newParams;


	var _optly={redir:document.createElement("a")};
	_optly.redir.href=newURL;

	if (_optly.redir.href !== '') {
		window.location.replace(_optly.redir.href);
	}
/* _optimizely_evaluate=safe */

But... you will probably want to exclude URLs that have the newParams in the URL.

 

 

 

--Jason Dahlin
Analytics and Testing Guru Smiley Happy