Rich-text Reply

Redirect Experiment to Hundreds of Pages

Rhys 12-03-15
Accepted Solution

Redirect Experiment to Hundreds of Pages

Hi,

 

I want to setup a cross domain redirect experiment on a collection of landing pages without creating an experiment for each one. There could be hundreds.

 

So I want to target landing page URL.s which contain "g-cty" - easy/no problems

 

The format of the URL's between the 2 domains are identical :

 

www.site1.com/london-england.g-cty

www.site2.com/london-england.g-cty

 

I have hundreds of city-country combinations so i need to just change out the domain name from the site1 and substitue site2.

 

Is that possible via the standard redirect experiment type or do i need to create some custom code to make this work ?

 

Rhys

Level 2

Mia 12-04-15
 

Re: Redirect Experiment to Hundreds of Pages

/* _optimizely_redirect_no_cookie=http://www.example.com */
window.location.replace(window.location.href.replace("site1","site2"));

You could do something like this so that the whole URL is preserved, except for the site1 vs site2 piece. 

 

Do you think that would do the trick? 

- Mia Summers
Mia
Level 3
Rhys 12-04-15
 

Re: Redirect Experiment to Hundreds of Pages

Nice! Thanks - i'm not a JS expert but having looked that up it should work.
Level 2