I need help figuring out a test methods for Google Analytic. Our client pushes out a lot of marketing campaigns and they love using GA to track what is working, what is not working and where to focus their efforts next time.

The client was under the impression that Google Analytics code could not be tested on a Dev or QA server without screwing with the Prod Data. So up until now they have just deployed the code up to a production server and hoped it worked. Then when it didn’t, have the Dev perform a fire drill to get it done before the marketing push. So my plan is to figure out an awesome way to test Google Analytics that is fast and efficient.

My understanding of GA is very limited. I mostly use it to see what browsers people are using to connect with out site. So this is what I have thought of so far...

1) I had them create me a test analytics code to use on Dev and QA, so I don’t mess with their Production statistics.

2) I can easily write a scripts that scans all the sites and verifies the GA js on all appropriate pages.

3) I know of the ‘__utm.gif’ file and that it’s a sign that GA is sending info out to the server, but is there a way to parse the url to know what it’s sending?

What other options do I have for testing GA? What else should I be looking for? How are you guys testing GA? How do you get around the 1-24hr wait time for the server to update.

4 Answers 4


I used to have a very similar problem. I've found a couple of things work.

You're already doing the right thing by scanning the pages for the javascript. You're right, the wait time can be too much, especially when you need quick turn arounds.

I've found that the Google Analytics Debugger add on for Chrome to be the most help with this. It will allow you to see any information that is being sent. It's just a small add-on that shows the data that the scripts are sending/would send in the javascript console. I'm not sure if there's an automated way to check the pages that you need, but, it works wonders when doing manual testing.


You approach seem to be on the right track

  • My suggestion is you can write a custom log in web server everytime when it processes a requests. Alternatively can you try tracking the requests and compare it against google analytics
  • You custom code / logging query might induce minimal latency impact but if you make it configurable you can switch off this when it goes to production. Enable it only when there is minimal site load (Non-peak hours)
  • Try evaluating with multiple tools (http://www.cloudsurfing.com/site/3582-Google-Analytics/competitors/). Pick two tools and compare analytics results between them. Instead of third party tools i would suggest custom development work (points #1, #2)

You can also using Fiddler or Firebug to inspect the parameters being passed in the ga js call. That should give you all the data you are sending to google analytics. Once you learn what each parameter means, its easy enough to check if the correct values are being passed by the call (i.e. right action or page)

You can do this all in realtime so you dont have to wait for google to update your analytics


When testing Google Analytics on a previous project I had the developers add in the ga-debug.js instead of the normal GA.js for the Dev and Test environment only. This debug version shows in plain text all the content that is sent to Google Analytics when an event is fired. Details here: http://code.google.com/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html

This lets you to use the console on firebug, chrome dev tools or fiddler to check what you are sending to GA for any event. This works cross browser and also within isolated dev and test environments.

The chrome plugin Lyndon mentions achieves the same effect but is not cross browser and when I tested it some time ago now it was not as reliable as using the ga_debug.js, but the reliability could easily have improved.

I never went as far as automating these checks as the overhead was not worth the effort but the ga_debug.js posts the events to the console so if you have a tool that can read the events then automating the checks should be possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.