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
AY 07-10-17
 

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

Hi Amanda, 

I am trying to implement scroll tracking beforehand I can start working on the actual project. At the moment I have not added optimizely snippets on the website (i don't yet have rights to add it in the website script).

 

I have added scroll tracking snippet in the project javascript section and have also created a custom event goal in the experiment (called it in the variation for which we are tracking scroll depth). Even after doing everything I can't see the scroll event firing in preview mode (event tab).

 

Is there any way I can confirm scroll events are firing before starting the experiment or before even putting optimizely snippet on the website? 

 

AY
Level 1