Rich-text Reply

Optimizely's scroll depth tracking sample code not working

Gabriella 10-14-15

Optimizely's scroll depth tracking sample code not working

Hi

 

I'm using the scroll depth tracking code sample as found on the this page: http://developers.optimizely.com/javascript/code-samples/index.html

 

However, when I insert the code into the experiment Javascript area for this line of code

 

 window['optimizely'] = window['optimizely'] || [];

 

I get this error message

 

['optimizely'] is better written in dot formation

 

And it won't let me save the code.

 

How to fix the code?

 

Thanks!

 

Amanda 10-16-15
 

Re: Optimizely's scroll depth tracking sample code not working

@Gabriella Thanks for posting this. I was just testing this out with @Becca_Bruggman and we did see the error, but you should be able to ignore it and click the save button. In our tests it did save successfully. 

 

What are you seeing that leads you beleive it's not saving? Is there a console error or is the button grayed out?

 

Looking forward to hearing back from you

Optimizely
samh123 12-01-15
 

Re: Optimizely's scroll depth tracking sample code not working

Hi Amanda,

 

I am in the process of testing this scroll sample snippet on my site and I can't get it to work either.

The default engagement event is firing fine however there seems to be a confliction in Jquery libraries.

 

  • When I inlcude your jquery in my project we get an "uncaught error" on the .scrollTop() function. If we hard code e.g. window.scrollPercent=25; the event fires. Seems to suggest a confliction of the function.
  • When Ijust use our jquery and don't include yours (ours is v1.4.2) the event doesn't seem to fire at all Smiley Sad

@Gabriella try using the /?optimizely_log=true url parameter and checking the jS console. You may be having the same problem as I'm having. This should help debugging.

 

Thanks

 

Sam

 

 

Level 2