1

We're running Optimizely on our Angular.js single page app. According to the documentation the best way to trigger the experiment is using conditional activation with a callback.

However, the code doesn't seem to run the experiment successfully as window.angular.element('body').scope() would return undefined

The way I understand it is that the main Optimizely script in HTML would call the activation function immediately on load and register a callback. At this point, the page itself might not be fully loaded and all the Angular variables (such as scope) not initialized, hence the undefined error which causes nothing to be registered on $locationChangeSuccess.

Anyone have experience dealing with this issue? What am I doing wrong here?

Thanks!

melonccoli
  • 398
  • 1
  • 4
  • 14
  • Can you provide a link to reproduce the issue with the running experiment? And of course the code you're using in this experiment's (function type) conditional activation, [here](https://help.optimizely.com/hc/en-us/articles/200040225#conditional)? Also just thinking, does the issue occur only on hard page refresh (i.e. it works when you load the home page, and then move to product page, which should trigger a location change event)? – Joel Balmer Mar 10 '16 at 14:47

0 Answers0