检查_utm.gif
我已经确定了可扩展参数 utme
没有被通过。当我用 Firebug 检查它时,我根本看不到它。我正在尝试使用 Google Analytics(分析)跟踪事件 - 只需单击一下按钮即可。
<head>
中的 Google 代码.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']); //in reality, this ID is set correctly
_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>
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
try {
var myTracker=_gat._getTrackerByName();
_gaq.push(['myTracker._trackEvent', ' + category + ', ' + action + ']);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}
</script>
我在<body>
中使用的代码
<a onClick="recordOutboundLink(this, 'button', 'clicked');return false;" href="http://someoutboundlink.com">
<img src="http://some-image.png">
</a>
我错过了什么?为什么我的参数不是 button
和clicked
正在通过 _utm.gif
?
最佳答案
你的函数是错误的。只是因为您将跟踪器变量命名为 myTracker,所以它不是跟踪器的内部名称。在您的情况下,您使用的是无名跟踪器。为其触发事件的正确方法是调用 _trackEvent
。
function recordOutboundLink(link, category, action) {
try {
_gaq.push(['_trackEvent', category , action ]);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}
关于javascript - Google Analytics 跟踪 - 可扩展参数 (utme) 未显示在 _utm.gif 请求中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9930913/