Documentation for Activate suggestion
Solved! Go to Solution.
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.
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
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
for each experiment that should be active on that page.
I hope that helps!
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.
Manager of Site Optimization
'The single biggest problem with communication is the illusion that it has taken place.' - George Bernard Shaw