Finding Errors in Your Google Analytics Tracking Code
Installing the Google Analytics code is pretty easy – usually nothing goes wrong, and it is simply a matter of copying and pasting the code that Google provides you with. However, there are some cases where you might want to change the default code:
Google provides clear instructions for these tasks but nobody is perfect so sometimes errors will be made and nothing will be tracked. Normally it would take you 24 hours to realise this, 5 minutes to fix what you thought was the error and then 24 hours to find out that you hadn’t actually fixed anything. Repeat this cycle until you give up or get it sorted. Here is my guide to help speed this process up and make it less likely that a small typo in your Google Analytics code will take a week to fix.
So what do you do when there is no data in Google Analytics?
- Firstly, visually confirm that the tracking code is on the website. It sounds like a simple thing but you can end up looking pretty stupid if you miss this step out.
- Then install httpfox or some other program to monitor the requests your browser is making
- Start up httpfox and perform a full refresh (Ctrl-F5) of a page.
- In httpfox search for requests made to the google-analytics.com domain. If you see a request for _utm.gif then you know that data is being sent to Google Analytics. Apart from checking that the UA id is correct I have no more ideas about what could be going wrong here.
- If there is no request for the tracking pixel then something is wrong with the code (duh?).
- For simple errors (like typos) the firefox error console will give you a pretty good idea of what has gone wrong.
Firefox Error Console shows that I missed of the closing quotation marks when setting the session timeout to 5 minutes
- For more complicated changes to the code use a more powerful tool like firebug to find out where the error is occurring.
- Fix the problem and then repeat steps 3 and 4 to check that information is being sent to Google Analytics.