Rich-text Reply

Documentation for Activate suggestion

Peter 11-26-15
Accepted Solution

Documentation for Activate suggestion

It looks like the API Activate call (found on does nothing when an expirement is set in “Immediate” mode? If that’s true, then I think those docs should clarify that detail. If it’s not the case, any idea why I’m not seeing it do anything with an experiment that’s set to “Immediate”?

Level 2

Re: Documentation for Activate suggestion

Hi Peter,


Thanks for your question! To first give someo context: when you use the API Activate call, there are two ways to use it:


  • Without experimentId: window['optimizely'].push(["activate"]);
  • With experimentId: window['optimizely'].push(["activate", experimentId]);

The one without experimentId does nothing when an experiment is set to "immediate" mode. In the documentation it also says that this call only activates manual activation mode experiments (so no immediate activation mode experiments).


The one with experimentId should also work for immediate activation mode experiments. I've just tried it out for myself, and it did work for me. You should change the experimentId to the experiment you're looking to activate.


Having said that, can I ask which one you're trying to use and where/how/in which way you're trying to use it? I'll need a little bit more context in order to have a look at your issue.





Peter 11-28-15

Re: Documentation for Activate suggestion

Thanks Nils. That helps—I did not see that info while looking over the docs.

The website I’m using has most pages load statically, but some pages can also show up via HTML5 pushState, and for those I need to activate the experiment when the URL changes (but the browser doesn’t do a fresh load). So, my current solution is:

1. Add the following snippet after the optimizely script include: `<script>window.optimizely=window.optimizely||[]; window.optimizely.push(['activate'])</script>`
2. Set all experiments to manual
3. In my code that handles the state changes, also run the code from step 1
Level 2

Re: Documentation for Activate suggestion

Hi Peter, if you use the


 call, it will only activate the manual experiments. So my suggestions:


* Set all your experiment to manual and add the JS API call


 to all your pages, so that all experiments on your pages will be activated using that call (depending on URL targeting and Audiences whether the experiment will actually run).

* Specifically call 

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


for each experiment that should be active on that page.


I hope that helps!

cubelodyte 04-26-17

Re: Documentation for Activate suggestion

Just a note (Optimizely, please correct me if I'm mistaken), for anyone finding this in the age of Optimizely X.


In Optimizely X, it is no longer true that the "activate" API will not activate an experiment set to "Immediate" mode. Of course, the syntax is very different as well, but it is worth noting that you can now re-activate variations for this type of experiment.

Scott Ehly
Manager of Site Optimization

'The single biggest problem with communication is the illusion that it has taken place.' - George Bernard Shaw