Skip to content

Commit faee09b

Browse files
committed
Merge branch 'kejjang-master'
2 parents 2232400 + 3dd97a3 commit faee09b

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

jquery.scrolldepth.js

100644100755
Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,35 @@
102102

103103
var command = options.trackerName ? (options.trackerName + '.send') : 'send';
104104

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) {
106134

107135
standardEventHandler({'event': 'ScrollDistance', 'eventCategory': 'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventValue': 1, 'eventNonInteraction': options.nonInteraction});
108136

@@ -115,14 +143,6 @@
115143
standardEventHandler({'event': 'ScrollTiming', 'eventCategory': 'Scroll Depth', 'eventAction': action, 'eventLabel': label, 'eventTiming': timing});
116144
}
117145

118-
if (globalSiteTag) {
119-
gtag('event', 'scroll_depth', {
120-
'category': 'Scroll Depth',
121-
'scroll_distance': label,
122-
'px_distance': scrollDistance
123-
});
124-
}
125-
126146
} else {
127147

128148
if (universalGA) {

0 commit comments

Comments
 (0)