views:

2201

answers:

2

When using Google Analytics and using the newer ga.js file, is the __utm.gif file needed in your root directory of your web site?

I do see a call being made from my browswer to the file on google-analytics.com (http://www.google-analytics.com/__utm.gif?...), but in the past I was told that it needed to exist in the root of the site.

Does this still hold true?

Could you please provide a reference?

Thanks, Matt

+6  A: 

If you are using the new version of the tracking code (ga.js), the only thing you need to do is include this snippet of JavaScript:

<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-xxxxxx-x");
pageTracker._trackPageview();
</script>

This would imply that there are no requirements for you to host any __utm.gif file on your server (I'm not sure how this would even work for analytics anyway, as the whole point is for the client's browsers to make requests to Google's servers).

matt b
Right. The way GA works is by making a specially-crafted request for a 1x1 image from Googles servers. Google uses the url to obtain data about the current tracking event.
yodaj007
+1  A: 

I use the older urchin.js tracking mechansim and there are no requirements to host anything locally although you can put the .js file on your server for speed. There are four images that get requested to provide the tracking; __utma, __utmb, __utmc and __utmz which correspond to they cookies recorded of the same name.

From Google; When you first begin implementing tracking in Google Analytics website, you need to install the tracking code on your website pages. The generic tracking code snippet consists of two parts: a script tag that references the ga.js tracking code, and another script that executes the tracking code.

Dave Anderson