Google Analytics Debugging
Let's face it: Google Analytics' documentation contains a lot of examples that work very well for simple use-cases, but advanced configurations require planning and attention to detail, and copying-and-pasting sometimes introduces problems that can affect data accuracy.
Historically, the biggest problems we find stem from configuring multiple trackers – often because some third-party script (for user surveys, etc.) is trying to track their usage, but their trackers conflict with your own. Tracker conflicts almost always relate to their handling of cookies, which domains their being written to, and what value is used for the domain hash prefix. Recent changes to GA have improved this somewhat, but problems persist in some cases.
An important aspect of debugging these kinds of problems is to find all the trackers actively running on the page. The hard part is usually in searching through all the scripts on the page, looking for _setAccount or similar. Fortunately, GA has made that somewhat easier: they've introduced a method _gat._getTrackers that exposes all current trackers.
Modern browser debuggers, in combination with these Google Analytics methods, provide a convenient way to inspect tracking problems. For example, to list current trackers by Web Property ID and tracker name, paste this code in a debugger:
var m = _gat._getTrackers(), i = m.length; while(i--) console.info(m[i]._getAccount(
Step-by-step screenshots for listing trackers in Google Chrome:
We'll be posting more debugging tips in the nearer future. Stay tuned!