How To Track 404 Page Not Found Errors in Google Analytics

How to track 404 Page Not Found Errors in Google Analytics

We have a client right now whose ranking took quite a dip lately. As we continue to help them fix errors documented in Google Search Console, one of the glaring issues is 404 Page Not Found errors. As companies migrate sites, many times they put new URL structures into place and old pages that used to exist do not exist anymore.

This is a HUGE problem when it comes to search engine optimization. Your authority with search engines is determined by how many people are linking to your site. Not to mention losing all the referring traffic from those links that are all over the web pointing to those pages.

We wrote about how we tracked, corrected, and improved the organic ranking of their WordPress site in this article… but if you don’t have WordPress (or even if you do), you’ll find these instructions helpful to identify and continuously report on pages not found on your site.

You can do this easily in Google Analytics.

Step 1: Make Sure You Have A 404 Page

This may sound a bit dumb, but if you’ve built a platform or are using some kind of content management system that doesn’t incorporate a 404 page, your web server will simply serve the page. And… since there’s no Google Analytics code in that page, Google Analytics won’t even track whether or not people are hitting pages that are not found.

Pro Tip: Not every “Page Not Found” is a visitor. Oftentimes, your list of 404 pages for your site will be pages where hackers are deploying bots to crawl known pages with security holes. You’ll see a lot of garbage in your 404 pages. I tend to look for actual pages that may have been removed and never properly redirected.

Step 2: Find The Page Title Of Your 404 Page

Your 404 page title may not be “Page Not Found”. For instanced, on my site the Page is titled “Uh Oh” and I have a special template built out to try to get someone back to where they could search or find the information they’re seeking. You’ll need that page title so that you can filter a report in Google Analytics and get the information for the referring page URL that’s missing.

Step 3: Filter Your Google Analytics Page Report To Your 404 Page

Within Behavior > Site Content > All Pages, you’ll want to select Page Title and then click the Advanced link to do a custom filter:

Site Content > All Pages > Advanced Filter = Page Title

Now I’ve narrowed down my pages to my 404 page:

Advanced Filter Results in Google Analytics

Step 5: Add a Secondary Dimension of Page

Now, we need to add a dimension so that we can actually see the page URLs that are causing the 404 Page Not Found Error:

Add Secondary Dimension = Page

Now Google Analytics provides us with the list of actual 404 not found pages:

404 Page Not Found Results

Step 6: Save and Schedule This Report!

Now that you have this report set up, make sure that you Save it. Additionally, I would schedule the report on a weekly basis in Excel Format so that you can see what links may need immediately corrected!

google analytics schedule this report

If your company needs assistance, let me know! I help a lot of companies with content migration, redirects, and identifying issues like these.


  1. 1

    I also updated this to use in the footer of WordPress:
    if (is_page_template(‘404.php’) ) {

    _gaq.push([‘_trackEvent’, ‘404’, document.referrer, document.location.pathname]);

  2. 2
  3. 4

    Hello Douglas,

    I have been facing a error on my google analytics, when I try to login with my account then it shows “page not found”. How can I fix this error? ?. Please Tell Me.

    • 5

      I’m not sure what this might be. It sounds as though you may have an authentication issue where you should clear your cookies. Try logging in in a private window. If that doesn’t work, I would contact Google Analytics support.

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.