How to test if a google analytics code works?

In Chrome:

  • Right Click anywhere on page
  • Inspect Element
  • Click Network Tab
  • Reload Page

Look for:

  • Type 'image/gif'
  • Method: 'GET'
  • Name (starts with): _utm.gif?

Look for the __utm.gif tracking pixel request. A few different ways of doing this are:

  • A web debugging proxy like Fiddler (my preference)
  • The Network tab in Firebug or Chrome Developer Tools.
  • The Google Analytics debugging script ga_debug.js will log tracking requests & errors.
  • Google Analytics Tracking Code Debugger is a Chrome extension that enables ga_debug.js.

The analytics code on the page probably has a _trackPageview, so as the page loads you'll see an initial __utm.gif.

When _trackEvent fires, there should be a new __utm.gif request being made. Parameters to examine in __utm.gif URL are:

  • utme=5(Outbound Linkslabellink.href) -- _trackEvent parameters
  • utmac=UA-1234567-8 -- the analytics UID

Also, (as pointed out by @Eduardo), take a look at Google Analytics Basic Debugging