In your Header or Footer template (.tpl file) add this
Code:
{literal}
<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("XXXXXXXXXXXXX");
pageTracker._trackPageview();
} catch(err) {}</script>{/literal}
I've just added mine to the footer template just above the <!-- END FOOTER --> and it works fine, remember to replace the ("XXXXXXXXXXXX") with your google analytic code which should start UA-