Rich-text Reply

Suggestion: Option to load in custom javascript upon experiment activation

aalleavitch 03-29-18
Accepted Solution

Suggestion: Option to load in custom javascript upon experiment activation

One of the reasons we really like Optimizely is that it allows us to run experiments that alter site behavior through custom javascript without having to directly touch our production code at all.

 

The problem is that for some of the experiments we want to run the javascript can get quite hefty (even when pre-minified), which is bad given that the Optimizely snippet is render blocking. Given that we tend to run a fair number of experiments where experiment activation doesn't happen until after the rest of the page has loaded (via callback), it'd be nice if we could have an option to have the experiment javascript loaded in upon experiment activation rather than having it added straight to the Optimizely snippet.

JasonDahlin 03-29-18
 

Re: Suggestion: Option to load in custom javascript upon experiment activation

Are you also using a tag management system?
Quite often, I will have optimizely set a window-scoped variable and then use the existence of that variable as a pre-condition for a tag in my tag management system which then performs code that is specific to that variation of the experiment.

For example, if we are testing different recommendations schemes, an experiment may contain:

window.optimizelyRecommendations='2';

Then the TMS system uses the existence of that variable (or the value of that variable) to alter what it normally does.  The example above tells the TMS system to use recommendations scheme "2" instead of the one it usually does.

--Jason Dahlin
Analytics and Testing Guru Smiley Happy


Experimentation Hero
aalleavitch 03-30-18
 

Re: Suggestion: Option to load in custom javascript upon experiment activation

This is a great idea. It seems fairly easy to do this via GTM.