In this article, I explain how you can use two very simple custom reports in Google Analytics to monitor 404 errors on your website. If your 404 error page is set up correctly, Google Analytics already automatically tracks all 404 errors encountered by users. With the two custom reports I present in this article, you can easily find these errors and fix them.

Note: This guide was first posted on rebelytics.com in 2017 and has since then been updated several times and moved to this blog.

First of all, let’s have a look at how your 404 page should be set up (not just for tracking purposes, but also for SEO reasons):

  • The 404 page should always load on the false URL that has been called, and should NOT have its own URL (like, e.g., /404/).
  • When a URL that does not exist on your website is called, this URL should give back a 404 HTTP status code, and not a 200 (OK) status code or a 301 redirect to an error page with a different URL.
  • Only for tracking purposes: Make sure the page title (in the title tag) of your error page contains “404”, “page not found”, or another expression you can use to identify the page in Google Analytics.

If you want to see an example of a 404 page that is set up exactly like this, just go to https://www.searchviu.com/this-url-doesnt-exist. The 404 page on this website is pretty boring and not very helpful, but at least from a technical perspective it’s fine.

So, if your 404 page is already working like this, you can just move on and create the two custom reports I am presenting next. If not… well, fix it and come back. I’ll wait for you right here.

Custom report for finding and fixing 404 errors caused by internal links

The first very handy custom report I would like to show you today helps you find internal links that cause 404 errors on your website. Internal links are links that point from one page on your website to another page on your website. You have full control over these links, so you can fix errors as soon as you find them. Internal links to 404 errors are bad for the user experience of your website and they can also harm your SEO performance.

Note: If you don’t want to set this up manually, you can just scroll down a bit and import this report from the Google Analytics solution gallery.

How to build the report for 404 errors from internal links yourself

Here’s how to set up the report (also see the screenshot below for better orientation):

  • Go to Customization > Custom Reports in Google Analytics and click on +New Custom Report.
  • Select the report type Flat table.
  • Select the dimensions Page, Previous Page Type and Page Title.
  • Select the metric Unique Pageviews.
  • Add a filter that excludes the value (entrance) for the dimension Previous Page Path. This filter makes sure that only 404 errors that were preceded by a page view on your own website (and thus caused by an internal link) show in the report.
  • Add a Regex filter for the page title that contains the expression that helps you identify your 404 error page (“404” in the example below, but it could also be “page not found” or something else, depending on the title tag of your 404 error page).

Now, if you save the report and open it, you will see the following columns:

  • Page: URL that caused a URL error.
  • Previous Page Path: Page that links to the false URL (in most cases).
  • Page title: Title of your 404 page.
  • Unique Pageviews: Number of sessions this error happened in.

Quickly import the report for 404 errors from internal links

If you don’t want to go through the hassle of setting up this custom report yourself, you can import it directly from the Google Analytics Solutions Gallery:

404 errors from internal links by Eoghan Henn

What you can do to fix 404 errors caused by internal links

  • Set up a 301 redirect for each URL in the first column to a matching target. This redirect makes sure that every user and search engine bot that tries to access the faulty URL from now on is redirected to a page that works.
  • Go to each URL in the second column, check if there is really a link to the false URL in the first column on it (sometimes there might not be one, because the URL can end up in this report for other reasons, for example if a user manually types in a false URL while he or she is already on a different page on your website), and fix the link. This is necessary in addition to setting up the redirect for the faulty URL, because internal links to 301 redirects are also a bad signal for search engines and have a negative impact on user experience, because they slow down the loading of the next page.

Now that you are taking care of your 404 errors caused by internal links, let’s have a look at 404 errors that are caused by links from other websites to yours.

Custom report for finding and fixing 404 errors caused by external links

The second custom report I would like to share with you for the purpose of monitoring 404 errors on your website is a close variant of the first one. The difference is that this second report shows you 404 errors caused by external links. External links, in this case, are links that point from other websites to pages on your website. You normally don’t have direct control over those links, so you can’t just fix them when you find them.

Note: Again, if you don’t want to set this up manually, just scroll down and import this report from the Google Analytics solution gallery.

How to build the report for 404 errors from external links yourself

Here’s how to set up this report (again, you’ll find a screenshot below for better orientation):

  • Go to Customization > Custom Reports in Google Analytics and click on +New Custom Report.
  • Select the report type Flat table.
  • Select the dimensions Page, Full Referrer and Page Title.
  • Select the metric Unique Pageviews.
  • Add a filter that includes the value (entrance) for the dimension Previous Page Path. This filter makes sure that only 404 errors that were not preceded by a page view on your own website (and instead caused by an external link) show in the report.
  • Add a Regex filter for the page title that contains the expression that helps you identify your 404 error page (“404” in the example below, but it could also be “page not found” or something else, depending on the title tag of your 404 error page).

Now, if you save the report and open it, you will see the following columns:

  • Page: URL that caused a URL error.
  • Full referrer: Page on another website that links to the false URL. Please note: In lots of cases this will not help you actually find the faulty link, as it includes referrers like “Google” for clicks from search results and lots referrers are not passed correctly. Focus on referrers that actually look like URLs of pages that are linking to your content.
  • Page title: Title of your 404 page.
  • Unique Pageviews: Number of sessions this error happened in.

Quickly import the report for 404 errors from external links

You can also import this report directly from the Google Analytics Solutions Gallery:

404 errors from external links by Eoghan Henn

What you can do to fix 404 errors caused by external links

  • Set up a 301 redirect for each URL in the first column to a matching target. This redirect is very important for users or search engine robots that follow the link from the other website to yours. You don’t want them to end up on an error page. Make sure the content on the redirect target is as similar as possible to the content that was originally linked to.
  • Check the second column for false links that you can actually identify. In some cases it might make sense to reach out to webmasters that link to URLs on your website that don’t exist to ask for a link update.

Any questions or comments?

If you have any questions about this article, please don’t hesitate to leave a comment. I normally manage to reply to all comments on this website within a couple of days.

Eoghan Henn

Author Eoghan Henn

Eoghan Henn is responsible for searchVIU's marketing. Before joining searchVIU, he worked as an SEO consultant for 6 years and built a reputation as a blogger and conference speaker.

More posts by Eoghan Henn

Join the discussion 48 Comments

  • Thank you so much for this info. I set up my custom report to monitor my 404 errors.

    I do have a question that I am still unable to find help for regarding 404 errors.

    While in my GA looking at the top landing pages the first page is listed as /, clicking on it goes to a 404 error page – it’s my url but instead of .com its .com//.

    Any idea on how to fix this and understand what happened would be greatly appreciated.

    -Sirita

    • Eoghan Henn says:

      Hi Sirita,

      Thank you for your interesting question. The problem you describe might be related to the “Website’s URL” setting in your view settings.

      You can go to the Google Analytics admin area > view settings and remove the slash from the domain in the field “Website’s URL”.

      If the domain in this field does end with a slash, then Google inserts an extra slash into the links from the reports to your pages.

      Please let me know if this helped solve your problem.

  • Calvin says:

    Is there any way to have the unique regex content search the entire page, instead of just the header? Thanks for the custom report!

    • Eoghan Henn says:

      Hi Calvin!

      Thank you for your interesting question. The content of a page is not normally tracked in Google Analytics, so with a standard configuration, you wouldn’t be able to search the page content. You could configure your tracking setup so that it does track certain elements in custom dimensions in Google Analytics, which is not a very difficult thing to do if you’re using Google Tag Manager.

      I guess you’re asking this question because you’re working on a case where the page title does not allow you to identify a 404 page? Please let me know if you have any further questions about this. I’d be happy to help you.

  • romainlange says:

    Hi,
    thanks for this tutorial !
    Unfortunately, I don’t have the **previous page path** in my dashboard. Has the name changed ?

    • Eoghan Henn says:

      Hi Romain,

      Thank you for your comment. No, the name of the dimension is still the same. Were you looking at it in the exact same place as described in the article above? Sometimes, certain combinations of dimensions and metrics aren’t possible, so not all dimensions show up everywhere in the GA account.

      Another possibility that I can think of is that the dimension might have a different name, if you’re using GA in a different language.

      I hope this helps for now! Please let me know if you have any further questions.

  • Eoghan,

    Thanks for a great article.

    One question though, I mainly rely on the IOS Google Analytics app and have several standard reports. Can the Custom Reports that you have suggested be created on the IOS Google Analytics App?

    Thanks

    Raul Gonzalez

    • Eoghan Henn says:

      Hi Raul,

      Thank you for your comment. I’ve never used the iOS GA app, but I do use the Android one a lot and unfortunately, I’m not aware of a way to reproduce this kind of report in the app. As we need to combine at least three dimensions for this to work, the possibilities I know of in the app are far too limited.

  • sandip says:

    Hi Eoghan,

    Thanks for this wonderful post. For the last few days, I am getting international visitors from many different countries to this page https://ideasoncanvas.in/h/452665.html and its a 404 page. so, how I can I remove this URL? it is only showing in google analytics not in my wordfence plugin dashboard’s live traffic status.

    I have already redirected all 404 page to home page. but this doesn’t work for this url.

  • Shehnaaz says:

    Hi Eoghn Henn,

    Thank you for this great post.

    I migrated my site from Blogger to WordPress and I have been constantly watching out for any 404 errors. I see two referrers like Weborama Fetcher(weborama.com) and Addthis(my social media sharing plugin) on my 404 page.

    Should I just let them go or redirect them. These started appearing only after I installed the AddThis social sharing plugin.

    • Eoghan Henn says:

      Hi Sheennaz,

      it would probably be a good idea to identify the root of this problem and fix it. To me it sounds like your Addthis plugin is generating URLs that don’t exist on your website that Google then tries to crawl. This is probably something you can fix in the configuration of the plugin. If you just ignore it, or even if you just set up redirects, this type of error is likely to show up again and again and you’d be wasting Google’s resources by having them crawl non-existent URLs.

      Please let me know if you need any help with this process.

  • Alex Gogarty says:

    Hi Eoghan,

    Great article, clear and well-written! Thank you for sharing.

    I have a slightly different question. Our 404 page includes four internal links suggesting to the user where on our site to go next.

    I’d like to see which of those links gets the most clicks – I would go by Previous Page Path on those specific four pages, but that necessitates using the 404 URL and not the Page Title.

    Do you have any suggestions on how I could get this data/track the next pages most commonly visited after the 404?

    Thanks so much!

    Alex

    • Eoghan Henn says:

      Hi Alex,

      Thank you very much, I’m glad you found the article useful.

      I suggest you use Google Tag Manager to track the clicks on those links as events in Google Analytics. If you need any help with this, just let me know. I’ll be happy to send you some instructions.

      • Sneha says:

        Hi Eoghan,

        Your report is very helpful.
        I want to track the number of clicks on these 404 links.
        Please help.

        Thank You!
        Sneha

        • Eoghan Henn says:

          Hi Sneha,

          Are you referring to the same issue Alex mentioned above? Do you have a 404 page with links to other website sections and you would like to track the clicks on these links? If so, please let me know and I can share a quick instruction on how to do this with Google Tag Manager.

  • Anjali says:

    Hi Eoghan,

    Your report seems to be really helpful.

    But, when I am creating the same report in GA dashboard, it shows nothing. However, can see 404 urls in search console.

    Please check sample URL: –removed–

    I request you not to publish this comment with the mentioned URL. 🙂

    Thank you
    Anjali

    • Eoghan Henn says:

      Hi Anjali,

      Your 404 page does not contain the Google Analytics tracking code, so it is not being tracked in GA currently. You should make sure your 404 pages are tracked in GA for the report to work. And even then, the report will only show URLs that have been accessed by users, so they won’t mirror what you see in the crawl error reports in GSC.

      As requested, I removed the sample URL from your comment.

      I hope this helps!

  • Hello Sir
    I face crawl errors because last month I changed the name 3 urls and 1 url removed.
    But now as search console detected as error for old url, I don’t know how to fix it.
    Please would you suggest me what should I do and fix the errors.
    Please mail your advice to me.
    As I cannot found it here.
    Thank you.

    • Eoghan Henn says:

      Hello Smita,

      For the URLs you changed, you should set up 301 redirects from the old URLs to their new equivalents. Depending on what system you’re using, you’ll probably find a plugin to easily manage this.

      For the URL you removed, you can check if there is a fitting target (another URL with similar content) that you can redirect it to.

      I hope this helps!

  • Aldo says:

    I read on Google official blog that 404 errors — or even too many such pages won’t hurt our blog and its pages on Google result pages.

    But now I am having about 500 pages labelled 404 not found to which is hurt for my new post to get ranked.

    The reasons for this issue after migrating from Blogspot to WordPress, many of the post’s permalink from Blogspot changed when it’s converted to WordPress’s permalink.

    • Eoghan Henn says:

      Hi Aldo,

      You’re right, 404 errors normally don’t hurt your rankings directly, but they’re still something you should avoid and take care fo for several reasons (see article and other comments).

      If your URLs change due to a system migration, you should set up 301 redirects from your old URLs to their new equivalents. Even if it’s been a long time since the migration, you can still set up these redirects.

      I hope this helps! Please let me know if you have any further questions.

  • David says:

    Thank you, have tested this code out and works great. Was thinking there maybe a better wy using GA’s AutoTrack Plugins however, your method gives good results.

    • Eoghan Henn says:

      Hi David. I’m glad this worked out for you. And yes, there are probably lots of other (and better) ways to do this.

  • Sasa Rebic says:

    Hi Eoghan,
    great text, I have problem with client who have too much broken link. How fast fix this problem. He has 4000 page on site. I found 8 broken link on one page.
    Thx in advance

    • Eoghan Henn says:

      Hi Sasa,

      I would recommend crawling the entire website with a tool like Screaming frog and exporting all links to URLs that return errors. As a quick fix, you can set up 301 redirects from the error URLs to equivalent working URLs, but this should only be a temporary solution. It is not desirable to keep internal links to redirect very long. In the next step, there’s really no way around checking all of the faulty links you’ve exported and fixing them step by step.

      I hope this helps! Please let me know if you have any further questions.

    • Damian says:

      Hi Sasa,

      You can use Google Analytics as per Eoghan’s article or download a list of 404 errors from the Google Search Console (under Crawl Errors).

      Once you have this list you can use an automated URL mapping tool like https://getredirects.com (shameless plug) to match broken URLs to existing pages on your site and create 301 redirects.

      Hope this helps,
      Damian

  • Hello Eoghan,

    We just made some changes to our site structure and your article has been very helpful.

    One issue I seem to be having is the external link report. I have found known external links that are broken on sites but can ‘t seem to get anything to show up in the report.
    I imported your reports and the internal report works great but it seems I may need a different configuration to get the external report to work.
    Any thoughts?

    Thanks
    Michael

    • Eoghan Henn says:

      Hi Michael,

      I’m happy to hear that my article has been helpful. Errors from external links will only show up in Google Analytics if users actually click on the links and land on your error page. Maybe the links you are referring to haven’t generated any traffic? You can test this by clicking on the links yourself and making sure that you’re actually being tracked (and not filtered out of the view because of an internal traffic filter) by checking the real-time report. Your own visits should then show up in the external link report after a couple of hours.

      If this doesn’t work, please let me know via e-mail, so we can have a look at it together to see what needs to be fixed.

  • Anup Nair says:

    The is exactly what I was looking for. There is so much in Google Analytics, that you need to know how to choose right elements to get the information you seek.

    Thanks a lot Eoghan Henn

    ps. wondering if I can use Custom Reports for Server Response time and Page Load Times (although I get the figures as in Site Behaviour, but something more detailed to track and fix)

    • Eoghan Henn says:

      Hi Anup,

      I’m glad you found this useful.

      Sure, you can create custom reports with almost all metrics and dimensions that are available in Google Analytics. I recommend you play around with it a bit, in order to find something that fits your needs. What I really like about the “Flat Table” option ist that you can combine up to five dimensions! This gives us a lot of room for interesting reports.

  • Irvin says:

    Hello Eoghan,

    Thanks for this information. However, in my case it seems different, search console shows 404 error on page that i do not know exited. Like the URL’s below. It gives me headache.

    https://www.sample.com/%E5%A4%A7%E5%A5%96%E8%80%81%E8%99%8E%E6%9C%BA%E4%BF%A1%E8%AA%89%E5%A5%BD%E4%B8%8D%E5%A5%BD+Q82019309.com.com

    %E5%A4%A7%E5%A5%96%E8%80%81%E8%99%8E%E6%9C%BA%E6%89%8B%E6%9C%BA%E7%89%88+Q82019309.com.com/

    %E5%A4%A7%E5%A5%96%E5%A8%B1%E4%B9%90%E6%80%8E%E4%B9%88%E6%B3%A8%E5%86%8C+Q82019309.com.com/

    %E5%A4%A7%E5%A5%96%E5%A8%B1%E4%B9%90TTG%E8%80%81%E8%99%8E%E6%9C%BA%E6%B3%A8%E5%86%8C+Q82019309.com.com/

    404

    %E5%A4%A7%E5%A5%96%E6%8D%95%E9%B1%BC%E5%BC%80%E6%88%B7%E9%80%81%E9%92%B1+Q82019309.com.com/

    404

    %E5%A4%A7%E5%A5%96%E5%A8%B1%E4%B9%90%E5%AE%98%E7%BD%91%E7%99%BB%E5%BD%95%E5%85%A5%E5%8F%A3+Q82019309.com.com/

    404

    %E5%A4%A7%E5%A5%96%E6%B3%A8%E5%86%8C%E5%B0%B1%E9%80%81%E9%92%B1+Q82019309.com.com/

    404

    %E5%A4%A7%E5%A5%96%E6%8D%95%E9%B1%BC%E8%B5%8C%E5%8D%9A%E7%BD%91%E7%AB%99+Q82019309.com.com/

    404

    • Eoghan Henn says:

      Hi Irvin,

      These look like percent encoded Chinese URLs. If you let me know what website it is, I can have a closer look. Often, but not always, there’s a simple explanation for why Google’s bot discovers certain URLs.

    • Nancy says:

      Need solution for the same too, GWT showing around 1K results with such queries. What solution do you recommend?

  • berbagi73 says:

    Hi Eoghan,
    thank’s for quick response my comment. I try your suggestion.

  • berbagi73 says:

    Hi, Eoghn Henn
    I have crawl error on webmaster. When I opened it”s not my page. Ex : myblog/2017/01/content-wrapper
    I removed it, with remove url from webmaster. After few month the error page was comming again on report.
    So I make redirect option from blogger dashboard to another page I haved.
    my question is, do I need remove again that issue or ignore that, because I already redirect to another page.
    sorry if my language not good.

    • Eoghan Henn says:

      Hi Berbagi,

      Thank you very much for your comment. Please don’t worry about your language. I understood everything you wrote perfectly well.

      You did the right thing redirecting the URL. You can now mark it as fixed in your error reports and it should not show up again. There is no need to remove the URL via the “remove URL” feature if there is a redirect in place. One thing that you can do to speed up the process of removing the URL from the index is the following: Go to Crawl > Fetch as Google (in Google Search Console) and fetch the old URL (myblog/2017/01/content-wrapper, in your example). The status should show as “Redirected” and you can click on “Request indexing” next to it (see screenshot).

      Fetch URl with Google Search Console, status redirected, request indexing

      By doing this, tho old URL should disappear form the index very quickly.

      I hope this helps! Please let me know if you have any further questions.

  • Ben says:

    Still amazes me that this isn’t a default report in GA?

  • Josh says:

    Thank you. Your custom 404 report was just what I needed.

  • Joe says:

    Hi Harris,

    Great article! I notice the 404 errors reported are in root-relative rather than absolute. How do I get the report to show the absolute URLs?

    Thanks you,
    Joe

  • Harris says:

    Fantastic post! I only wish you had told me about the solutions gallery link before I did it manually 🙂

    • Eoghan Henn says:

      Hi Harris! I’m sorry, you’re right. I added a note above the instructions so that this doesn’t happen to anyone else 🙂

Leave a Reply