|
102 | 102 |
|
103 | 103 | var command = options.trackerName ? (options.trackerName + '.send') : 'send';
|
104 | 104 |
|
105 |
| - if (standardEventHandler) { |
| 105 | + if (globalSiteTag) { |
| 106 | + |
| 107 | + gtag('event', action, { |
| 108 | + 'event_category': 'Scroll Depth', |
| 109 | + 'event_label': label, |
| 110 | + 'value': 1, |
| 111 | + 'non_interaction': options.nonInteraction |
| 112 | + }); |
| 113 | + |
| 114 | + if (options.pixelDepth && arguments.length > 2 && scrollDistance > lastPixelDepth) { |
| 115 | + lastPixelDepth = scrollDistance; |
| 116 | + gtag('event', 'Pixel Depth', { |
| 117 | + 'event_category': 'Scroll Depth', |
| 118 | + 'event_label': rounded(scrollDistance), |
| 119 | + 'value': 1, |
| 120 | + 'non_interaction': options.nonInteraction |
| 121 | + }); |
| 122 | + } |
| 123 | + |
| 124 | + if (options.userTiming && arguments.length > 3) { |
| 125 | + gtag('event', 'timing_complete', { |
| 126 | + 'event_category': 'Scroll Depth', |
| 127 | + 'name': action, |
| 128 | + 'event_label': label, |
| 129 | + 'value': timing |
| 130 | + }); |
| 131 | + } |
| 132 | + |
| 133 | + } else if (standardEventHandler) { |
106 | 134 |
|
107 | 135 | standardEventHandler({'event': 'ScrollDistance', 'eventCategory': 'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventValue': 1, 'eventNonInteraction': options.nonInteraction});
|
108 | 136 |
|
|
115 | 143 | standardEventHandler({'event': 'ScrollTiming', 'eventCategory': 'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventTiming': timing});
|
116 | 144 | }
|
117 | 145 |
|
118 |
| - if (globalSiteTag) { |
119 |
| - gtag('event', 'scroll_depth', { |
120 |
| - 'category': 'Scroll Depth', |
121 |
| - 'scroll_distance': label, |
122 |
| - 'px_distance': scrollDistance |
123 |
| - }); |
124 |
| - } |
125 |
| - |
126 | 146 | } else {
|
127 | 147 |
|
128 | 148 | if (universalGA) {
|
|
0 commit comments