|
11 | 11 | var defaults = {
|
12 | 12 | elements: [],
|
13 | 13 | minHeight: 0,
|
14 |
| - percentage: true |
| 14 | + percentage: true, |
| 15 | + userTiming: true |
15 | 16 | },
|
16 | 17 |
|
17 | 18 | $window = $(window),
|
|
44 | 45 | if (typeof dataLayer !== "undefined" && typeof dataLayer.push === "function") {
|
45 | 46 | dataLayer.push({'event':'ScrollDistance', 'eventCategory':'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventValue': 1, 'eventNonInteraction': true});
|
46 | 47 |
|
47 |
| - if (arguments.length > 2) { |
| 48 | + if (options.userTiming && arguments.length > 2) { |
48 | 49 | dataLayer.push({'event':'ScrollTiming', 'eventCategory':'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventTiming': timing});
|
49 | 50 | }
|
50 | 51 | } else {
|
51 | 52 |
|
52 | 53 | if (typeof ga === "function") {
|
53 | 54 | ga('send', 'event', 'Scroll Depth', action, label, 1, {'nonInteraction': 1});
|
54 | 55 |
|
55 |
| - if (arguments.length > 2) { |
| 56 | + if (options.userTiming && arguments.length > 2) { |
56 | 57 | ga('send', 'timing', 'Scroll Depth', action, timing, label);
|
57 | 58 | }
|
58 | 59 | }
|
59 | 60 |
|
60 | 61 | if (typeof _gaq !== "undefined" && typeof _gaq.push === "function") {
|
61 | 62 | _gaq.push(['_trackEvent', 'Scroll Depth', action, label, 1, true]);
|
62 | 63 |
|
63 |
| - if (arguments.length > 2) { |
| 64 | + if (options.userTiming && arguments.length > 2) { |
64 | 65 | _gaq.push(['_trackTiming', 'Scroll Depth', action, timing, label, 100]);
|
65 | 66 | }
|
66 | 67 | }
|
|
0 commit comments