I came across a different way to include the analytics code then I normally do. Instead of using the normal code like this.
<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-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}</script>
I found a website that had used the analytics code like this.
<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
<div id="analytics-placeholder" class="param-sid=UA-4478973-1"></div>
Obviously it reduces the amount of code needed to get analytics to work. But I’m wondering if there could be another reason why you would want to code it like this instead of the “normal” way.
Has anyone seen analytics code used like this before? Could there be another advantage other then the reduced code? Maybe I overlooked it, but I can’t find any information about this on http://code.google.com/apis/analytics/docs/tracking/gaTrackingOverview.html
Thanks