Are you aware of how many 404 “not found” errors your website is really serving? Are you aware of which URLs are causing this error? Or perhaps it’s a pain to comb through your log analysis software to find the answer?

If your website serves up custom 404 and 500 error pages, you can add a small tracking snippet to these pages to track the following in Google Analytics:

  • When these errors occur
  • What URLs are causing the errors
  • Where the user was referred from to trip the error

Here’s the snippet to add to your 404 error page:

And the one for 500 pages is similar, with a minor difference:

These errors will then be trackable via Events in Google Analytics, which can be found under the Behavior section.

You can now find this info in my Google Analytics Setup Guide in the Playbook. Check it out to learn about the process that I use to setup Google Analytics tracking on websites.

Hat tip to Dan Wilkerson’s Essential Guide to Error Tracking Using Google Analytics for this information.