开发者

google analytics code is not recording the traffic?

One of my client's site's google analytics code is not working.

What is the problem in this code?

<script type='text/javascript'>
var gaJsHost = ((&quot;https:&quot; == document.location.pr开发者_开发问答otocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);


document.write(unescape(&quot;%3Cscript src=&#39;&quot; + gaJsHost + &quot;google-analytics.com/ga.js&#39; type=&#39;text/javascript&#39;%3E%3C/script%3E&quot;));


</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker(&quot;UA-8830811-1&quot;);


pageTracker._trackPageview();
} catch(err) {}</script>


The problem is all the extra entity encoding (i.e. &quot; etc). Additionally, once you use the right code it can take up to 24 hours for it to start showing data, though usually within a few hours it will show a green "√" to signify the tracking code is installed correctly. Use this instead:

<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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜