When I add new Event or PageView tracking code that is bound to
click events, I want to be sure that the tracking code is fired without waiting for a site visitor to trigger it (or in some cases before the code is even on a live page). Because my own traffic is filtered out of all of my Google Analytics reports, I can’t rely on my clicks to show in my reports (not to mention the delay). But, even with the filter in place, the clicks are sent to Google, and I can check to be sure they’re sending the right information in Firefox using Firebug’s Net panel. Here’s how.
Enable the Net tab
If you don’t already have Firebug installed in Firefox, get it, because you need it for this.
Once it’s installed, enable the Net panel.
Load the page you want to test. Once you do, you’ll see a lot of stuff pop up in the Firebug Net panel. One of my posts looks something like:
Look for the PageView
Once you have enabled the Net panel, you can see if your Google code triggers the initial pageview. Look through the requests for one that starts with _utm.gif?. Expand it by clicking on the arrow to the left of it.
Looking at the params tab (it defaults to headers), you can see the information being passed to Google. The first line is your unique tracking ID. You’ll also see your page title, the domain, and most importantly, the URL being passed.
If you don’t find the _utm.gif? entry, something is wrong with your basic GA tracking code and no data is being sent to Google.
Trigger your event or new pageview and find the tracking info
After verifying that the GA code is tracking the pageview, you can see if your
click event code is working. To do so, trigger an event that you’ve attached tracking code to. In my screenshot, I open an external link, which I’ve coded to trigger a GA event. It’s important that if you are triggering a link to a new page that you open it in a new tab or window so that your Firebug Net panel still tracks the original page.
A new _utm.gif? line should show up in the Net panel. Expand this new tab. If you triggered another pageview, the params will look similar to those mentioned earlier. Events look a bit different.
The important field here is utme, which shows the information you passed in the
_trackEvent call. The arguments you passed to
_trackEvent are separated by asterisks. Mine reads
Outbound Link*us.php.net/strtotime*Why is date() returning 12/31/1969. This is because I track my outbound links under the
category Outbound Link, with the external URL as the
action and the
h1 text on the page the call was triggered from as the
Yours will likely differ depending on your schema for event tracking.
Again, if you don’t find this new _utm.gif? call in the Net panel, your
click event code isn’t running, or the GA _trackEvent/_trackPageview code is set up incorrectly. You’ll need to debug it, then check again.
Now you know how to check if your code is working. What do you use Google Event or Pageview tracking for?