Knowing how an analytics tag fires and the type of information it contains is a crucial aspect to configuring analytics.
This brief post details how to debug typical analytics requests using a browser developer tool to view and analyze the analytics request.
Choose A Developer Tool
Developer tools allow a web browser to show the user the types of underlining data that supports a web page. They can display the source code, stylesheets, as well as resources requested by the page to build the visual layer and any scripts and assets to support site functionality. By default, Firefox, Chrome, and even Internet Explorer come prepackaged with powerful developer tools.
My tool of choice is Firebug for Firefox, but many tools can do the job.
Understanding Analytics Requests
Analytics systems usually track users using a request from the webpage to a tracking pixel. The image request is for a 1px by 1px GIF, which is ultimately invisible to the end user. This image doesn’t actually exist, but is a way to pass information about the computer, browser, and user. This image request stores information sent to the server hosting the tracking image, and is used to provide the values that end up in analytics reports.
In this post example, I am using Google Analytics on a blog pageview. To read more about how Google Analytics works, read this document on tracking code.
The Invisible Pixel Request
Here, the analytics tag fires an image request to Google Analytics.
You can see some of the key parameters needed for an analytics report.
dl refers to Document Location, which in this instance is blog.petergevers.com. sr means Screen Resolution, vp is viewport.
If this pageview came via a user in a campaign, we could see some key parameters such as cn Campaign Name, cs Campaign Source, and cm campaign medium.
For a full list of request parameters, view Google’s documentation about the measurement protocol.
Using Firebug, I can view the request parameters with the analytics hit to make sure my page is tagged correctly. I can also verify other aspects of the tag are collecting data as intended, such as any custom metrics or dimensions that might be configured with the page.
On my page requests, I send two custom dimensions with each blog post hit; blog Author and blog categories. In my pageview request parameters, I see those dimensions under cd1 Custom Dimension 1 and cd2 Custom Dimension 2.
Now I am sure my page fires my tag as I would expect. Using a developer tool is a critical step in testing the implementation and configuration of analytics tagging.