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 = (("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>
The problem is all the extra entity encoding (i.e.
"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: