Go – Is Google Analytics Accurate

google analytics

My records show a particular page of my web site was visited 609 times between July 2 and November 15.

Google Analytics reports only 238 page views during that time.

I can't explain this discrepancy.

For Google Analytics to track a page view event, the client browser must have JavaScript enabled and be able to access Google's servers. I doubt 60% of my visitors have either disabled JavaScript or firewalled outbound traffic to Google's tracking servers.

Do you have any explanation?

More Info

My application simply puts a record into a database as it serves up a page.

It doesn't do anything to distinguish a bot viewer from a human.

Best Answer

The disparity is almost certainly from crawlers. It's not unheard-of for crawler traffic to be 10x user traffic.

That said, there's a really easy way to validate what's going on: add an ASPX page which emits a uncacheable, 1x1 pixel clear-GIF image (aka "web bug") to every page on your site, and include an IMG tag referencing that image on every page on your site (e.g. in a header or footer). Then parse your logs for hits to that image, looking at a query-string parameter on the image call (e.g. "referrer=") so you'll know the actual URL of the pageview.

Since crawlers and other bots don't pull images (well, Google Images will, but not images sized as 1x1 pixel in the IMG tag!), you'll get a much more accurate count of pageviews. Behind the scenes, most analytics software (including Google Analytics) uses a similar approach-- except they use javascript to build the image URL and make the image request dynamically. But if you use Fiddler to watch HTTP requests made on a site that uses Google Analytics, you'll see a 1px GIF returned from www.google-analytics.com.

The numbers won't line up exactly (for example, users who quickly cancel a navigation via the back button may have downloaded one image but not the other) but you should see roughly comparable results. If you don't, then chances are you don't have Google Analytics set up correctly on all your pages.

Here's a code sample illustrating the technique.

In your header (note the random number to prevent caching):

<img src="PageviewImage.aspx?rand=<%=new System.Random().NextDouble( )%>&referer=<%=Request.UrlReferrer==null ? "" : Server.HtmlEncode(Request.UrlReferrer.ToString()) %>"
  width="0" height="0" hspace="0" vspace="0" border="0" alt="pageview check">

The image generator, PageviewImage.aspx :

private void Page_Load(object sender, System.EventArgs e) 
{ 
    Response.ContentType="image/gif";
    string filepath = Server.MapPath ("~/images/clear.gif");
    Response.WriteFile(filepath);
}

BTW, if you need the image file itself, do a Save As from here.

This is of course not a substitute for a "real" analytics system like Googles, but if you just want to cross-check, the approach above should work OK.