Created
October 5, 2011 04:01
-
-
Save caefer/1263597 to your computer and use it in GitHub Desktop.
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
(function() { | |
$.fn.extend({ | |
scrolltracker: function(step) { | |
var maxDepth; | |
maxDepth = 0; | |
return this.scroll(function() { | |
var depth; | |
depth = Math.floor($(this).scrollTop() / step); | |
if (depth > maxDepth) { | |
maxDepth = depth; | |
return _gaq.push(['_trackEvent', 'ScrollDepth', depth * step]); | |
} | |
}); | |
} | |
}); | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment