Rich-text Reply

URL Redirection on multiple pages

phs1919 04-28-15

URL Redirection on multiple pages

Hi,

 

I want to test different layout of products page for our website. I cannot find relevant resources on how to get started. We want to test totally different layout for product pages whose urls are like example.com/awesome-product-1 and exmaple.com/brilliant-product-2. 

 

I thought of using redirecting url. Let's say for example.com/awesome-product-1 page has a variant which redirects to example.com/awesome-product-1?utm_content=different_layout. Then I realized I want to implement this change to all the product pages which have the pattern of example.com/PRODUCT_NAME and maybe I need to use multi-page testing instead of A/B Testing. However, it does not really matter if a user sees mixed variations of product pages so I went back to thinking of implementing this in A/B Testing mode. 

 

It would be great if I could get the url of the page a user is directed to and make it as variable to be used for redirection url so that if a user goes in "example.com/awesome-product", he/she is redirected to the different layout variant "example.com/awesome-product?utm_content=different_layout". I would appreciate it if there is any other approach in implementing this test. Thank you very much!

Level 1

td_evans 04-28-15
 

Re: URL Redirection on multiple pages

/* _optimizely_redirect=http://custom */
$("head").append("<style>body{display:none!important;}</style>"); //This is to stop flash of unstyled content
var url = window.location;
var queryString = url.search;
var prefix = queryString.indexOf('?') >=0 ? '&' : '?';   
var redirect_url = location.protocol + '//' + url.hostname + url.pathname + url.search + prefix + 'utm_content=different_layout' ;
window.location = redirect_url;

The above should work. You'll need to make sure your regex pattern for the product URL's is setup correctly so this doesn't run sitewide.

Thomas Evans
Technical Product Manager - Conversion @ Secret Escapes

Level 2
adzeds 04-28-15
 

Re: URL Redirection on multiple pages

@td_evans has provided a solid answer there to get you going.

This is something that I think can be improved in the Optimizely system to make this a lot easier for people!
David Shaw
Level 11
tomfuertes 04-30-15
 

Re: URL Redirection on multiple pages

Hi @phs1919!

 

You have several factors and paths at play here. Hopefully by talking through them below I can help you choose a course of action.

 

1) Set up N number of experiments where N is equal to the number of product pages. 

Pros: Easy to code by setting up just a singular redirect test. 

Cons: Several different experiments to maintain and a lack of consistancy across pages

 

2) Set up a singular redirect experiment on your most trafficed product. 

Pros: Isolated data set, easy maintenance, easy reporting. 

Cons: Can take a long time to get data with such a little subset of traffic

 

3) Set up a Single Experiment targeted to several pages that redirects dynamically based on each url. 

Pros: Constant PDP Layout experience. 

Cons: Harder to setup, but I started a boilerplate for you here. Still might experience redirects on every pageviews which isn't that performant

 

4) Set up a Cookie Based experience instead of a querystring based one. You'd essentially pivot your PDP pages off of experience_cookie=(v0|v1|v2|etc...) and then use optimizely to do a check in each variation of `if (!cookie) setCookie() && location.reload()` 

Pros: Level playing field with consistant and performant experience across all variations. 

Cons: Requires server side deploys which can be difficult.

 

5) Code all or subsets of the major changes in the optimizely editor!

Pros: No redirects needed. Less changes gives you more information on what works

Cons: Might require dev support. Less changes means more tests means less big bets / wins

 

Hope that helps articulate the many paths you can take and their contingencies! Feel free to post further questions if you have them.

 

-Tom | director of engineering at clearhead.me

____
- Tom Fuertes | CTO @ CROmetrics / LinkedIn
"Most Impactful Use of Personalization" and "Experience of the Year" Optie award winner.


Experimentation Hero