Add the following lines in the script TAG (or JS file)
<script type="text/javascript" >
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
</script>
Second
Add the rest of the code in an onLoad function
function init()
{
(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);
})();
}
<body onload="init()">
Thats it, i tried it and it worked for me
Tweet
No comments:
Post a Comment