Rich-text Reply

Using optimezely to test two server side algorithms

rafael 08-19-14

Using optimezely to test two server side algorithms

Hello,

 

I have two relevance based algorithms which I want to test. They both run on server side and are used to create a listing on my front page. I would not like to load two listings on the same page and switch using javascript. I would rather find out what variation the user belongs to (and allocate him to a variation if so needed) through the REST API. Then my server would answer only with the correct listing. Is that possible?

Level 2

MJBeisch 08-19-14
 

Re: Using optimezely to test two server side algorithms

I've done experiments like this when testing sorting algorithms on e-commerce product listing pages. In order to accomplish it I controlled the algorithm via a query string, then set up javascript redirect logic in the variation. The logic parsed the URL for the presence of the query string (to ensure that it wouldn't get applied twice) then added it to the URL if not present, setting it to a value that would trigger the corresponding algorithm. I can write up a more detailed explanation with code examples should you need it.
Matt Beischel - E-Commerce Optimization Specialist CohereOne

Level 2
rafael 08-19-14
 

Re: Using optimezely to test two server side algorithms

So, you may redirect during "Experiment variation code", as described here: https://help.optimizely.com/hc/en-us/articles/200040335-How-Optimizely-Works-Snippet-order-of-operat... Correct? Your redirect happens before the user gets a chance to see the page (but after DOM is loaded). At that moment you check for the variation code and apply a parameter to the querystring accordingly. Right? Say you have query A and B, how do you map the validation ID to A or B manually?
Level 2
MJBeisch 08-20-14
 

Re: Using optimezely to test two server side algorithms

Essentially, yes. Pretend that the page you're testing is "category.aspx", your query string is "sortmethod" and the algorithm you want to set is "mostpopular". You'd place code like this into the code drawer for your variation(s):

 

//Grab the current URL
window.current_url = window.location.href;

//Check if query string already exists
if( window.current_url.indexOf("sortmethod=") == -1 ) {
    //determine if it's the first query string to add and you need a ? or not
    if( window.current_url.indexOf("category.aspx?") == -1 ) {
        window.location = window.current_url + "?sortmethod=mostpopular";
    }
    else {
        window.location = window.current_url + "&sortmethod=mostpopular";
    }
} 

 That's how you build redirect logic in a nutshell. Of course, you may need to make it more complex based on if you have multiple possible URLs (ie a "true" URL versus a "clean" one for SEO), other query strings to check against, etc.

Matt Beischel - E-Commerce Optimization Specialist CohereOne

Level 2