Rich-text Reply

a/b testing by querystring on several pages

wouter 11-25-14

a/b testing by querystring on several pages

I have designed a new product detail page for a/b testing. To see the new variant you have to add a querystring parameter to the url like ?v=1. I want to a/b test all of my product detail pages to serve 50% of the visitors the new product detail page and 50% to the original. If optimizely serves the variant to a customer the customer must get on every product page the variant ( productpage with ?v=1).

 

original url: www.website.com/products/car

variant  url: www.website.com/products/car?v=1

Level 2

siherron 11-25-14
 

Re: a/b testing by querystring on several pages

[ Edited ]

Are you asking how you get a consistent experience across all of your Product Pages? I'm just guessing.

If that's the case then there are lots of ways to define that, but the simplest (in my opinion) would be using the URL targeting. Using your URL structure of "www.website.com/products/car" target all of the URLs that contain "/products/" with a substring match. The article below explains this more clearly:

 

https://help.optimizely.com/hc/en-us/articles/200040835-URL-Targeting-Choose-where-your-experiment-r...

Is the Querystring "?v=1" to identify something other than your variant. e.g. does it identify a audience segment?

If it is there only to identify your variation, then you don't need it as Optimizely will do that for you.

Does this make sense?

I'm working on an assumption (a bad idea at the best of times); if you can provide some clarity on your question I might be able to help you further Smiley Happy

Simon Herron
Optimisation Consultant
Level 2
JDahlinANF 11-25-14
 

Re: a/b testing by querystring on several pages

Presuming the different pag layouts are triggered based on the existence of the URL parameter "v=1"...

 

If you are targeting only the product pages as Simon illustrated, and exclude URLs containing "v=1" in the Qury String, you can set your Variation 1 code to redirect to the current URL with the new parameter appended to the URL.  Something like this:

var currentQS = window.location.search;
var newQS = (currentQS.length>0) ? currentQS + "&v=1" : "?v=1";

var newURL = window.location.protocol + "://" + window.location.hostname + "/" + window.location.pathname + newQS;

 

Keep in mind that this would cause some flickering since the user would start to see the first page and be redirected to the second page, so... the user experience is necessarily worse in the test group than in the original.

 

Brian_Abad 11-25-14
 

Re: a/b testing by querystring on several pages

Great job with providing that idea, @nap0leon ! A few adjustments I would make to the code you've outlined:

 

/* _optimizely_redirect=http://custom */
var currentQS = window.location.search;
var newQS = (currentQS.length>0) ? currentQS + "&v=1" : "?v=1";

var newURL = window.location.protocol + "//" + window.location.hostname + window.location.pathname + newQS;
window.location.replace(newURL);

 

I've just added comments that let Optimizely know that a redirect experiment is occurring, which prioritizes when code is executed to alleviate any chance of original content first appearing on the page. I've also added the line of code that actually triggers the redirect to occur.

 

Hope this helps!

---
Brian Abad
Manager, Technical Support
Customer Success
Optimizely
wouter 11-26-14
 

Re: a/b testing by querystring on several pages

@Simon
Are you asking how you get a consistent experience across all of your Product Pages?
Yes this is what i want. But it must be consistent for the user so if a user get the first time the variant product page they must get on each product the variant and not the original.

 

@napoleon / brian_abad
Smart! This looks like what i want, i wil give it a try and wil let you guys know if this works.

Level 2
JDahlinANF 11-26-14
 

Re: a/b testing by querystring on several pages

[ Edited ]

@wouterSince you didn't answer the question directly, I'm compelled - to make sure you are not creating a lot more work on your part, a degraded user experience, and additional httpRequests to your own web servers - to re-ask the question "Why do you need a URL parameter?"

 

Does the URL parameter impact the HTML delivered by the web server?

Or are you wanting to add it to control your variation's changes?

 

If you are able to alter the original HTML by running the same code on every page (e.g., adding a new style sheet that overrides colors and font sizes, or replacing the logo, or adding a marketing banner directly underneath the header, etc.), then there is no need to do any of that URL parameter stuff.  Optimizely automatically keeps users in the same variation for every page in the experiment for as long as you have the experiment Running.

wouter 11-27-14
 

Re: a/b testing by querystring on several pages

@nap0leon 

 

 

The querystring parameter is for the server to identify which variant of the product page it must serve. The two variants are complete different, not just the css, or some text. Answering your question, yes the url parameter impact the html delivered by the server that's all. 

Level 2