We use cookies to make Serpstat better. By clicking "Accept cookies", you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Learn more

Report a bug

Cancel
13601 1
How-to 9 min read

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 drops 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 return an unexpected error, this is a problem. Especially when we do not know about the existence of an error.

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.

You can check the presence of 404 errors with the help of Serpstat Site Audit tool. Just set up the audit and go to All issues report when the process is finished:
404 not found
Advanced SEO Audit: A Complete Guide To All Stages Of The Analysis [Infographic]
Personal demonstration
Our specialists will contact you and discuss options for further work. 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.

Google Analytics: where the customer receives 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 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:
1
Go to "Variables" and click "Create."
2
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, 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.

Conclusion

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.

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 1 people on average 4 out of 5
Found an error? Select it and press Ctrl + Enter to tell us