0
我设置了Google Analytics事件来跟踪出站链接。我跟着the tutorial on Google's site。Google Analytics出站链接跟踪中没有“标签”
我遇到的问题是'url'参数(事件标签)没有在Google Analytics中被跟踪。 'outbound'和'click'都可以在ga()调用中正常工作。如果我在ga()调用之前提醒()线上的'url'变量,它会成功地将它提醒到屏幕。
为什么类别(出站)和动作(点击)工作得很好。但是,标签(var url)不会显示在Google Analytics中?
jQuery(document).ready(function() {
initExternalLinkLogging();
});
function initExternalLinkLogging() {
// ':external' is from here and works great: http://stackoverflow.com/questions/1227631/using-jquery-to-check-if-a-link-is-internal-or-external
externalLinks = jQuery("a:external");
jQuery(externalLinks).click(function() {
trackOutboundLink(this);
});
}
function trackOutboundLink(url) {
// This is the triggered on each outbound link click successfully
// 'url' has the correct value, but is not showing up in Google Analytics
try {
ga('send', 'event', 'outbound', 'click', url, {
'hitCallback': function() {
document.location = url;
}
});
} catch (err) {
// Do nothing for now
}
}