Rich-text Reply

custom javascript

psboxavramenko 08-18-15

custom javascript



I have used VWO before, and trying to use Optimisely now.

In VWO i inserted custom script into variation, it looked like as following:


$(document).ready(function() {





Actually you can test these scripts in brouser, like here:

Variation 1:

Variation 2:


In Optimisely i have inserted abovementioned scripts just in header block, as following:

Have i done it right or wrong?


Thaks in advance!



JDahlinANF 08-18-15

Re: custom javascript

[ Edited ]

Variation code is already set to be JavaScript.  Lose the opening <script> closing </script> tags.
All you need is the code:


You may or may not need to wait for "document ready"...


So try it like this to make sure it works:

$(document).ready(function() {

But looking at your libraries, it appears that the following should also work and may let the code run a little bit sooner:



Side note - I notice that you are loading Optimizely *after* two CSS files and two JS files.  If you ever decide to do experiments that alter something significant (redirecting users to a new page, changing images, etc.) having Optimizely *not* at the top of the page *will* result in increased "flashing" for the user.  If possible, consider moving the Optimizely snippet so that it is the very firts thing loaded by the page.