相关疑难解决方法(0)

Google Analytics(分析)hitCallback事件跟踪无法正常工作

我正在尝试使用事件跟踪和hitcallback来跟踪被点击的链接.我的分析代码看起来像这样......

<script type="text/javascript">//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
//]]></script>
Run Code Online (Sandbox Code Playgroud)

我试图跟踪的链接看起来像这样....

<a href='http://cool.com/' onclick="var href = this.href; ga('send','event','outbound','click', this.href, {'hitCallback': function(){document.location = href;}}); return false;">Cool</a>
Run Code Online (Sandbox Code Playgroud)

我从http://www.swellpath.com/2013/12/universal-analytics-using-hitcallback/跟随hitcallback示例,但它仍然无法正常工作.

我错过了什么吗?

google-analytics

6
推荐指数
1
解决办法
2555
查看次数

标签 统计

google-analytics ×1