How To Track 404 Not Found Pages In Google Analytics

How To Track 404 Not Found Pages In Google Analytics:

Sometimes visitors will reach a 404 or “Not Found” error page from your site. This may happen when they type in a filename that they think is available on your site, or reach a deleted or non-existent file or directory from an obsolete link on one of your pages.

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.

Please follow the steps below to obtain reporting on missing or error pages:

  1. Add the Google Analytics tracking code to a custom 404 error page.
  2. Modify the tracking code on the 404 page as follows:<script type=”text/javascript”>
    var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
    document.write(unescape(“%3Cscript src='” + gaJsHost + ”’ type=’text/javascript’%3E%3C/script%3E”));
    <script type=”text/javascript”>
    var pageTracker = _gat._getTracker(“UA-xxxxx-x”);
    pageTracker._trackPageview(“/404.html?page=” + document.location.pathname + + “&from=” + document.referrer);
    } catch(err) {}

    This code sends a virtual pageview of “/404.html?page=[pagename.html?queryparameter]&from=[referrer]” to your account, where [pagename.html?queryparameters] is the missing page name and referrer is the page URL from where the user reached the 404 page.

  • Look for /404.html in your Top Content report.


    Learn how you can get more sales from your website

    Subscribe for free and let us share with you:

    • how to submit your site to Google, Yahoo & Bing
    • how to optimise your site to get more traffic from Google
    • how to target the most valuable keywords for your business
    • how to make your site rank better in free Google listings
    • how to rank high & avoid Google penalties in 2015

    Trust Hobo with your SEO plan

    SEO Audit