Sign in Sign Up

This site uses cookies and other tracking technologies to make possible your usage of the website, assist with navigation and your ability to provide feedback, analyse your use of our products and services, assist with our promotional and marketing efforts, and provide better user experience.

By using the website, you agree to our Privacy policy

Report a bug

How-to 8 min read August 27, 2019

How to track 404 errors with Google Analytics and Tag Manager

Error 404 means that the web page is not available at the entered address. Over time, the search engine dropping such pages out from the index. To avoid this, you should purposefully track 404 errors in special reports in Google Analytics and Google Tag Manager.
Pages with 404 errors do not affect website promotion. But if we are talking about pages that give an unplanned error, this is a problem. Especially when we do not know about the existence of an error. If visitors pass to them, then errors merge the traffic that was planned to attract due to a specific landing page.

The purpose of the error page is to report that something has gone wrong and to offer the visitor a transition to relevant links — the main page or a similar remote one.

The main reasons when the web page gives the server response code "404 Not Found":

  • the page removed by webmaster;
  • the page moved to a new address;
  • the page moved to another section;
  • the link was broken;
  • wrong redirection;
  • the server worked incorrectly;
  • human error (misprint in the URL), and more.
Error 404 on the site
To track 404 page errors, we have Google Analytics and Google Tag Manager. We will describe several possible options that will help you quickly track down the error.

Google Analytics: where the customer received an error notification

Find out how many transitions turned out with an error, perhaps in a summary of all pages of the website. Get a selection by going to the "Behavior" menu on Google Analytics, click on the "Site Content" line, where this report is contained - "All Pages". The Bottom screenshot will show you what needs to be done with an example:
All site pages in Google Analytics
Now, sort the pages like this, to finally get a summary, a search that focuses on the title the "Page not found." In our case, this name is used, so it is used on the sample website.

Similar names differ on different websites, check what you have set by hovering the cursor over the name of the error page in the browser.
404 error page
Under the graph, there are custom fields. Click on "Page Name" and use the search by name, which is located next to the "More" button:
Names of pages in Google Analytics
Search for pages containing an error message in the header. Since the search will be by name, the screenshot uses the name the "Page not found" as an example.
Search Pages in Google Analytics
The system automatically filters all pages of the website by title and presents a report of the sessions that received the error page.

In this example, we checked the visits of 404 pages in a day; you will need to look at a wider range. Adjust the appropriate range in the upper right corner of the graph and study the resulting table.
Analytics 404 Error Statistics
Click on the name of the page in the table, and you will receive the URL address for which the user received error 404. So you will create a list of broken web pages, which you will need to work through later, find out the causes and troubleshoot if they exist.

The screenshot shows how the link is displayed in the table. It is active, so check in person, if the page remains inaccessible.
404 Errors in Google Analytics

How to add an event to Google Analytics and Google Tag Manager

To enable the monitoring of 404 errors through the Tag Manager, start by creating a variable. Use a custom name or "Page Header Variable". Our goal is to create a variable that checks the page title (for example, "Page not found").

Perform the following steps:
Go to "Variables" and click "Create."
Edit the following parameters:

  • name: "JavaScript - Page Title";
  • type: "JavaScript variable";
  • global variable: "document.title".
Variable in Google Tag Manager
The configured variable will report the name of the web page which the visitor entered. Due to the fact that we are interested in a specific title, for example, "Page not found," we will clarify the problem. Create a trigger that responds to the header "Page not found". Note that the names of the pages vary: "404", "Error", "Page in Processing", etc. Therefore, specify the one which is recorded on your web resource.

Let's move on to creating a trigger. When adding a new trigger, you need to clarify its settings. Set up tracking of 404 errors called "404 Trigger Title" or another name that you can understand.

Select event type Google Analytics "View Page". Configure activation on some pages that should respond with 404 code:
Setting a trigger in Google Tag Manager
Now we need to figure out how to set up an event in Google Analytics, in order to send the received information to the analytics system.

Create a special tag called "404 - Event Tag". Fill out the proposed configuration to this tag.

Parameters that you need to set:

  • type - "Universal Analytics";
  • track type - "Event";
  • category - "Error 404";
  • action - "{{Page URL}}";
  • write a tracking ID, which you can add as a constant variable to the Google Analytics tool, this will simplify your work in the future;
  • Finally, associate the prepared "Page Viewer" trigger with the analytics type from the first item.

Save and test your work with a preview.

All variables, trigger and tag work directly to track events in Google Analytics.

404: Event Reports

Independently of your tracking method - whether using the tag manager or tracking your views manually - your reports should be the same in Google Analytics, that is, show the same information. In the "Behavior" menu, you will find the element "Events". There you will receive event messages tagged 404.
Top Events in Google Analytics
The "Event" and "Event Action" summaries, which are located in the table header, will provide you with relevant information about the URL that generated 404 errors and their source (links).

Setting up Google Analytics events with GTM makes it easy to track 404 errors and fix them quickly.


Error 404 is not a failure for a website if it responds quickly. There is no direct influence on SEO promotion, but a large mass of 404 pages adversely affect behavioral factors and website rankings. Especially if 404 server response code occurred due to a malfunction.

Two free tools - Google Analytics and Google Tag Manager - help to track when a visitor came to the page and something went wrong. GA shows all failed sessions due to 404. All that is required of you is to sort by page name with the appropriate heading the "Page not found".

If you do not want to remember every time to check visits for errors, set up events which Google Tag Manager will send to Google Analytics.

This article is a part of Serpstat's Checklist tool
Checklist at Serpstat
Checklist is a ready-to-do list that helps to keep reporting of the work progress on a specific project. The tool contains templates with an extensive list of project development parameters where you can also add your own items and plans.
Try Checklist now

Learn how to get the most out of Serpstat

Want to get a personal demo, trial period or bunch of successful use cases?

Send a request and our expert will contact you ;)

Rate the article on a five-point scale

The article has already been rated by 0 people on average out of 5
Found an error? Select it and press Ctrl + Enter to tell us

Share this article with your friends

Sign In Free Sign Up

You’ve reached your query limit.

Or email
Forgot password?
Or email
Back To Login

Don’t worry! Just fill in your email and we’ll send over your password.

Are you sure?


To complete your registration you need to enter your phone number


We sent confirmation code to your phone number

Your phone Resend code Queries left

Something went wrong.

Contact our support team
Or confirm the registration using the Telegram bot Follow this link
Please pick the project to work on

Personal demonstration

Serpstat is all about saving time, and we want to save yours! One of our specialists will contact you and discuss options going forward.

These may include a personal demonstration, a trial period, comprehensive training articles & webinar recordings, and custom advice from a Serpstat specialist. It is our goal to make you feel comfortable while using Serpstat.




We are glad of your comment
Upgrade your plan

Upgrade your plan

Export is not available for your account. Please upgrade to Lite or higher to get access to the tool. Learn more

Sign Up Free

Спасибо, мы с вами свяжемся в ближайшее время

View Editing


You have run out of limits

You have reached the limit for the number of created projects. You cannot create new projects unless you increase the limits or delete existing projects.

I want more limits