|
13 | 13 | elements: [],
|
14 | 14 | percentage: true,
|
15 | 15 | userTiming: true,
|
16 |
| - pixelDepth: true |
| 16 | + pixelDepth: true, |
| 17 | + nonInteraction: true |
17 | 18 | };
|
18 | 19 |
|
19 | 20 | var $window = $(window),
|
|
66 | 67 |
|
67 | 68 | if (googleTagManager) {
|
68 | 69 |
|
69 |
| - dataLayer.push({'event': 'ScrollDistance', 'eventCategory': 'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventValue': 1, 'eventNonInteraction': true}); |
| 70 | + dataLayer.push({'event': 'ScrollDistance', 'eventCategory': 'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventValue': 1, 'eventNonInteraction': options.nonInteraction}); |
70 | 71 |
|
71 | 72 | if (options.pixelDepth && arguments.length > 2 && scrollDistance > lastPixelDepth) {
|
72 | 73 | lastPixelDepth = scrollDistance;
|
73 |
| - dataLayer.push({'event': 'ScrollDistance', 'eventCategory': 'Scroll Depth', 'eventAction': 'Pixel Depth', 'eventLabel': rounded(scrollDistance), 'eventValue': 1, 'eventNonInteraction': true}); |
| 74 | + dataLayer.push({'event': 'ScrollDistance', 'eventCategory': 'Scroll Depth', 'eventAction': 'Pixel Depth', 'eventLabel': rounded(scrollDistance), 'eventValue': 1, 'eventNonInteraction': options.nonInteraction}); |
74 | 75 | }
|
75 | 76 |
|
76 | 77 | if (options.userTiming && arguments.length > 3) {
|
|
81 | 82 |
|
82 | 83 | if (universalGA) {
|
83 | 84 |
|
84 |
| - ga('send', 'event', 'Scroll Depth', action, label, 1, {'nonInteraction': 1}); |
| 85 | + ga('send', 'event', 'Scroll Depth', action, label, 1, {'nonInteraction': options.nonInteraction ? 1 : 0}); |
85 | 86 |
|
86 | 87 | if (options.pixelDepth && arguments.length > 2 && scrollDistance > lastPixelDepth) {
|
87 | 88 | lastPixelDepth = scrollDistance;
|
88 |
| - ga('send', 'event', 'Scroll Depth', 'Pixel Depth', rounded(scrollDistance), 1, {'nonInteraction': 1}); |
| 89 | + ga('send', 'event', 'Scroll Depth', 'Pixel Depth', rounded(scrollDistance), 1, {'nonInteraction': options.nonInteraction ? 1 : 0}); |
89 | 90 | }
|
90 | 91 |
|
91 | 92 | if (options.userTiming && arguments.length > 3) {
|
|
96 | 97 |
|
97 | 98 | if (classicGA) {
|
98 | 99 |
|
99 |
| - _gaq.push(['_trackEvent', 'Scroll Depth', action, label, 1, true]); |
| 100 | + _gaq.push(['_trackEvent', 'Scroll Depth', action, label, 1, options.nonInteraction]); |
100 | 101 |
|
101 | 102 | if (options.pixelDepth && arguments.length > 2 && scrollDistance > lastPixelDepth) {
|
102 | 103 | lastPixelDepth = scrollDistance;
|
103 |
| - _gaq.push(['_trackEvent', 'Scroll Depth', 'Pixel Depth', rounded(scrollDistance), 1, true]); |
| 104 | + _gaq.push(['_trackEvent', 'Scroll Depth', 'Pixel Depth', rounded(scrollDistance), 1, options.nonInteraction]); |
104 | 105 | }
|
105 | 106 |
|
106 | 107 | if (options.userTiming && arguments.length > 3) {
|
|
0 commit comments