Rich-text Reply

Conditional activation issue in an Angular Single Page App

johnsrobinson 08-09-16

Conditional activation issue in an Angular Single Page App

I’m trying to get conditional activation to work with multiple experiments running at the same time, using the same targeting URL.

 

For example, I’d like to run different concurrent experiments on the following views of our single page app.

 

https://www.oursite.com/account#/upgrade

https://www.oursite.com/account#/signup

https://www.oursite.com/account#/login


I’ve been able to get these experiments each to activate individually using the following code:

function(activate, options) {
  window.onload = function() {
    if (window.location.hash === '#/upgrade'){
      activate();
    }
  };

  window.onhashchange = function(){
    if (window.location.hash === '#/upgrade'){
      activate();
    }
  };
}

However, when I try to turn on all of these experiments at the same time, none of them will activate. I believe the main challenge I have is that we use the same targeting URL for all our SPA experiments: https://www.oursite.com/account.

 

Can anyone me figure out a different approach for activating multiple Angular experiments at the same time?

 

Thanks!

AllisonR 08-10-16
 

Re: Conditional activation issue in an Angular Single Page App

Hi there,

 

Thanks for your question! It sounds like you've been able to identify a reliable way to activate individual experiments on your site using conditional activation. Can you let me know what you see when you push the Optimizely log to your browser console? Instrucitons for how to do this are here. Are there any errors regarding any of these experiments? 

 

Allison
Sr. Technical Support Engineer
Optimizely | EMEA
Optimizely