Rich-text Reply

Manually Activate More than 1 experiment at once via JS API

parththakkar 03-17-16

Manually Activate More than 1 experiment at once via JS API

Hello,

So I can successfully activate 1 experiment via JS API, but for my particular usecase, I have to activate 2 at a time and I use audience segmenting to determine which one the user sees.

However, I have been unsuccessful in activating 2, the syntax I used is:

if (condition == "true") {

window.optimizely.push(["activate", xxxxxxxx]);
window.optimizely.push(["activate", xxxxxxxx]);
 
}

Any Tips or advice is much appreciated!

Analyst
MartijnSch 03-18-16
 

Re: Manually Activate More than 1 experiment at once via JS API

Hi,

What probably is happening right now that instead of trying to activate what you'd like to activate is that you're overriding the current test/variant that you're activating. What you could is initialise a second Optimizely with a different naming convention in order to do this. Not sure how you're dealing with the audience segments, could you share more about what you're achieving with that?

Re: Manually Activate More than 1 experiment at once via JS API

 To follow up with this,

I actually activated all the experiments first and then used JS to assign the visitor to the relevant audience that would then get picked up by the relevant optimizely experiment.

 

I used this bit of code to activate all manually activated experiments:

window['optimizely'] = window['optimizely'] || [];
window['optimizely'].push(["activate"]);
Analyst