Last active
October 31, 2018 10:11
-
-
Save Gegam/ff098bdf9e95822d344a to your computer and use it in GitHub Desktop.
GA scroll depth in px
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var scrollDepthtracking = {}; | |
| window.addEventListener ('scroll', function () { | |
| var currentPos = body.scrollTop || window.pageYOffset || document.documentElement.scrollTop, | |
| currentPosRnd = Math.round((currentPos / 200) * 200); | |
| if (!scrollDepthtracking[currentPosRnd]) { | |
| scrollDepthtracking[currentPosRnd] = true; | |
| ga('b.send', 'event', 'Глубина прокрутки в px', currentPosRnd); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment