Tip: Tracking 404 Pages

Thursday, September 07, 2006 | 9:55 AM

Besides telling you from which sources your site traffic originates, Google Analytics also tracks just about any activity that occurs on your site, including popular navigation paths, plus track downloads, outbound links, and activities on cross-domain properties. But one shortcoming is the lack of reporting on 404 pages, which appear when there's no file or page that corresponds to the visitor's request. For example, sometimes visitors will type in a filename that they think is available on your site, or sometimes your site might have a obsolete link which routes to a deleted or non-existent file or directory. In both cases, a 404 or "Not Found" error page will appear on the browser.

It's valuable to see these requests so you can learn what visitors are looking for, and consider adding new content or fixing the broken link.

Reporting on missing or error pages requires a few steps:
1. Add the Google Analytics tracking code to a custom 404 error page

2. Modify the tracking code on the 404 page as follows (see the urchinTracker modification in red below):

<script type="text/javascript"
<script type="text/javascript">
_uacct = "xxxxx-x";
urchinTracker("/404.html?page=" + _udl.pathname + _udl.search);

This code sends a virtual pageview of "/404.html?page=[pagename.html?queryparameter]" to your account, where [pagename.html?queryparameters] is the missing page name.

3. Look for /404.html in your Top Content report. Or to make it easier open the Dynamic Content report and expand the list for "/404.html."