Rich-text Reply

Actiate Experiment AND Variation manually by Javascript

fidi 07-19-16

Actiate Experiment AND Variation manually by Javascript



is it possible to activate an experiment combined with a variation manually with a script? 

window.optimizely.push(["activate", 6570111943], ["variation", 1]);


The System does the split for the testgroups. 


My code would looks like this

if (group-a) {

<div id="foo"></div>

window.optimizely.push(["activate", 6570111943], ["variation", 1]);

} else {

<div id="bar"></div>

window.optimizely.push(["activate", 6570111943], ["variation", 2]);






Level 1

JasonDahlin 07-20-16

Re: Actiate Experiment AND Variation manually by Javascript

Hi @fidi,

I have not see anything that lets you push a member into a specific variation of an experiment in this manner.

If your split is controlled by some other mechanism, you could build 2 experiments, one for each variation with 100% traffic allocated to that experiment's sole variation.  This would require you to use an external tool for analysis and determining statistical significance of any of your goals.


If you *really* want to do this...

1- if you have force parameters enabled... you could detect a new user is a member of a group and redirect the user to the same page but with the force parameter that places them in the group

2- you could run code that updates the optimzieylBuckets cookie by placing the correct variation's Variation ID into the cookie.


I don't recommend either of these approaches... I merely present them as ways you could achieve what you are doing but with the possibility of unknown side effects.

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
bw 07-21-16

Re: Actiate Experiment AND Variation manually by Javascript



You can manually assign (bucket) a variation through the bucketVisitor API call (documentation below). As Jason noted, there are considerations for overriding the natural behavior and measuring significance.