我客户网站的某个Google分析代码无效。
此代码有什么问题?
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8830811-1");
pageTracker._trackPageview();
} catch(err) {}</script>
答案 0 :(得分:2)
问题是所有额外的实体编码(即"
等)。此外,一旦您使用正确的代码,它可能需要长达24小时才能开始显示数据,但通常在几个小时内它会显示绿色“√”以表示跟踪代码已正确安装。请改用:
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8830811-1");
pageTracker._trackPageview();
} catch(err) {}
</script>