How do I add Google Analytics tracking code?

In order to use Google Analytics, you need to register an account first. Then create a website profile for it. Finally, you need to insert the tracking code into your website. There are 2 tracking codes currently – Legacy Tracking Code (urchin.js) and New Tracking Code (ga.js). Be sure to use the New Tracking Code (ga.js) because it can gain access to a wide range of exciting new features as they become available.

So where should I put it? You should put it into every webpage you want to track immediately before the </body> tag. Most of the websites use a footer template to display the bottom website layout. Just copy and paste the tracking code there.

Example, put the code right before </body>

<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”>
var pageTracker = _gat._getTracker(“UA-xxxxxxx-x”);
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>