Skip to content

Commit 4e3f91a

Browse files
Adds support for the new Universal Analytics script (analytics.js)
More info: https://developers.google.com/analytics/devguides/collection/analyticsjs
1 parent f48c6c5 commit 4e3f91a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

jquery.scrolldepth.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,18 @@
4343
function sendEvent(action, label, timing) {
4444
if (!options.testing) {
4545

46-
_gaq.push(['_trackEvent', 'Scroll Depth', action, label, 1, true]);
46+
if ( typeof(ga) == "function" || typeof(ga) == "object" ) {
47+
ga('send', 'event', 'Scroll Depth', action, label, 1, {'nonInteraction': 1});
48+
} else if ( typeof(_gaq) == "function" || typeof(_gaq) == "object" ) {
49+
_gaq.push(['_trackEvent', 'Scroll Depth', action, label, 1, true]);
50+
}
4751

4852
if (arguments.length > 2) {
49-
_gaq.push(['_trackTiming', 'Scroll Depth', action, timing, label, 100]);
53+
if ( typeof(ga) == "function" || typeof(ga) == "object" ) {
54+
ga('send', 'timing', 'Scroll Depth', action, timing, label);
55+
} else if ( typeof(_gaq) == "function" || typeof(_gaq) == "object" ) {
56+
_gaq.push(['_trackTiming', 'Scroll Depth', action, timing, label, 100]);
57+
}
5058
}
5159

5260
} else {

0 commit comments

Comments
 (0)