0

I'm trying to load a new design template into optimizely.

The CMS stores the new templates in alternate URLs. The files are loaded in the section of the page.

The original templates are loaded as follows:

var name1 = /url1/ var name2 = /url2/

And we need to change the urls that go with the variables to:

var name1 = /url3/ var name2 = /url4/

I'm guessing we might have to use the append function, similar to this (this is for adding a new CSS stylesheet to a page): $("head").append("");

But I can't seem to make it work in optmizely.

Tom Enns
  • 172
  • 3
  • 15

1 Answers1

0

You can set variables on the window and then reference them like so:

/* _optimizely_evaluate=force */
window.foo = 'bar'; // in optimizely
 /* _optimizely_evaluate=safe */

// later in your code
var name = window.foo || 'baz';

Remember though anything not matching the $(selector).action() template will wait till domReady unless you also use the force comments.

TomFuertes
  • 7,150
  • 5
  • 35
  • 49