谷歌1页访问= BOUNCE。我的目标网页只有1页,因此对于Google,我的所有网页访问都会被标记为退回。
我不希望BOUNCE RATE为100℅所以为了避免这种情况,我需要创建一个EVENT TRACKING脚本。
通过将此EVENT TRACKING脚本添加到我的页面,我可以告诉Google我想要跟踪的是否为反弹。
我想在着陆页中跟踪的事件:
用户在page = NO BOUNCE
中花费45秒用户向下滚动50页= NO BOUNCE
用户观看视频=无BOUNCE
答案 0 :(得分:2)
window.setTimeout(function() {
ga('send', 'event', 'eventCategory', 'eventAction', 'eventLabel');
}, 45000);
/* GA Scroll Depth */
var body = document.body,
html = document.documentElement,
windowHeight = $(window).height(),
fullPageHeight = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight),
scrollableHeight = fullPageHeight - windowHeight,
quarterScrolledPos = Math.round(scrollableHeight * .25),
halfScrolledPos = Math.round(scrollableHeight * .5),
threeQuarterScrolledPos = Math.round(scrollableHeight * .75),
quarterScrollSentToGA = false,
halfScrollSentToGA = false,
threeQuarterScrollSentToGA = false,
fullScrollSentToGA = false;
function checkScrollDepth() {
var scrollPos = $(document).scrollTop();
if (scrollPos >= quarterScrolledPos) {
if (!quarterScrollSentToGA) {
sendScrollDepthToGa('25%');
quarterScrollSentToGA = true;
}
}
if (scrollPos >= halfScrolledPos) {
if (!halfScrollSentToGA) {
sendScrollDepthToGa('50%');
halfScrollSentToGA = true;
}
}
if (scrollPos >= threeQuarterScrolledPos) {
if (!threeQuarterScrollSentToGA) {
sendScrollDepthToGa('75%');
threeQuarterScrollSentToGA = true;
}
}
if (scrollPos === scrollableHeight) {
if (!fullScrollSentToGA) {
sendScrollDepthToGa('100%');
fullScrollSentToGA = true;
}
}
}
function sendScrollDepthToGa(scrollHeight) {
ga('send', 'event', 'Scroll Depth', 'scroll' + scrollHeight, urlPath);
}
$(window).on('scroll', checkScrollDepth);
/* END GA Scroll Depth */
ga('send', 'event', 'video', 'play', 'someOtherData');
您可能还想查看非互动事件:https://developers.google.com/analytics/devguides/collection/analyticsjs/events#non-interaction_events