Find 404 Pages in Google Analytics

A 404 report in Google Analytics is a gold mine for data analysis. 404 error pages are not only an SEO problem but also an analytics problem.

This report is a mystery to most as this tracking goes under people’s radar. These 404 error instances happen “under the hood”. This needs detective work to collect them and derive insights from them. So, how do you find 404 pages in Google Analytics?

What is a 404 Error?

A 404 error is a status code. This is when a user lands on a page and the browser can’t request resources because the content can’t be found. The page often displays a ‘not found’ message. You landed on a 404 error page if this message appears. It’s one of the status code examples and is important in SEO.

Why Is The Google Analytics 404 Report Important?

404 page views is an example of friction that makes the user experience of a website worse. And the rule of thumb with any website is to give a frictionless experience. 404 page views might correlate a decrease in conversions.

It’s not guaranteed to connect 404 page views with low website performance. But it helps detect user activity that leads to unforeseen situations. Users might experience this friction and it’s important to fix.

404 page reports also give efficiency to digital marketers and analysts. They can capture these issues on “auto-pilot”. No more crawling in an SEO audit tool to check these 404 pages since user tracking happens in real-time.

Here’s an example…

total events 404 2
404 Pages

transactions2
Transactions

This website had a boost in 404 page views. This is due to website redesign, product re-stocking, or it might be a small mistake in the background.

On the second screenshot, the transactions decreased. Now, there might be some correlation. It’s not 100% certain that the increase of 404 errors caused the dip in transactions. But at least it encourages further investigation.

This is one of the few ways to uncover unknowns and understand website visitors better.

How To Find The 404 Report in Google Analytics

Google Analytics is already reporting on 404 error pages.

Step 1: Go To Behavior -> Site Content -> All Pages.

measuring blog performance

Step 2: Click “Page Title” as Primary Dimension.

404 page title

Step 3: Filter 404 pages. Most cases, it’s “404 page not found”, or “404”, or “not found”.

404 page title2

Downside:
This 404 reporting in Google Analytics has a downside. It requires a couple of clicks into the tool. Also, the report is too reactive. You won’t know 404 page views in real-time.

You need to retrace the steps and correlate the 404 error. And retracing with a marketing channel, device, and the location is a challenge. It’s still possible, but it takes too many clicks to derive to a conclusion.

That said, you can also track 404 error pages in Google Tag Manager for efficiency.

Add 404 Error Tracking in Google Tag Manager

This requires Google Tag Manager implementation. Google Tag Manager is a tag management system by Google and works best with Google Analytics.

Google Tag Manager simplifies how to track user activity on the website. This tool doesn’t need heavy web development resources. Knowing a little bit of coding and having a little bit of tech-savviness helps.

Find Your 404 Error Page

The first thing to do is know the title tag of your 404 pages. To do that, browse through a made-up URL under your domain.

Example: domain.com/404test

404 medium

The screenshot above is from medium.com. Look at the tab on top of the web browser and remember what it says. This is the page title or SEO title tag. This is also the text when you bookmark the web page.

This title tag is added in Google Tag Manager…

Method 1: JavaScript Variable

Step 1: Click “Variables”.

gtm variables

Step 2: Scroll Down and Click “New” under “User-Defined Variables”.

gtm user defined variables

Step 3: Click the “Variable Configuration” button. Then find and click “JavaScript Variable”.

gtm js variable

Step 5: Add document.title under “Global Variable Name”.

gtm js page title

Step 6: Name the Variable and Save. Name it “JS – Page Title” as an example but this is up to you.

Now add a Trigger…

Step 1: Click Triggers.

gtm triggers

Step 2: Click New. Then click Trigger Configuration

Step 3: Choose Page View.

gtm pageview

Step 4: Follow the settings.
This trigger fires on:
Some Page Views

Fire this trigger when an Event occurs and all of these conditions are true:
“JS – Page Title” or whatever name you gave the Variable.
contains
404 Page not found

404 trigger

Note: Add your title tag version here from earlier. Scroll back up to the medium.com example.

Step 5: Name Trigger and Click Save. Name it “404 Page Trigger” as an example but up to you.

Now create a Tag…

Step 1: Click Tag.

gtm tags

Step 2: Click New. Then click Tag Configuration.

Step 3: Choose Google Analytics: Universal Analytics.

gtm ga tag

Step 4: Follow the screenshot.
Track Type: Event
Category: 404 Page
Action: 404 {{Page URL}}
Label: {{Referrer}}
Non-Interaction: True

gtm 404 tag2

Step 4: Scroll down and click Triggering. Add the Trigger you created from earlier.

Step 5: Name the Tag and Click Save. Name it “GA Event – 404 Page” as an example but up to you. Done!

Make sure to Preview and Debug the Tag by going through a 404 test page. Browse through a made-up URL under your domain.

404 debug

Finally, Publish the container. Voila!

general

Method 2: Custom JavaScript Variable

Sometimes, there’s no title tag available for a website. If you look at the title tag and bookmark the page, it only specifies the domain name or a blank. This means the words “404” or “page not found” are not there.

When this happens, document.title doesn’t work because there’s no data to catch. To solve this, you need to capture the on-page HTML tag instead. In most cases, the element that contains “404” on the webpage is the H1. This means you catch the H1 element.

404 medium2

As an example, Medium.com’s 404 page has “404” on the page. This means we can trigger Medium’s 404 page views through the HTML tag that contains “404”. Note that learning a little bit of HTML and CSS is helpful.

To find which HTML tag the 404 is in, you need to check Developer Console.
Do these sub-steps:
-Go to any web page
-Press right-click
-Click “Inspect”

Or this step:
-Go to any web page
-Press right-click
-Click “View page source”

<h1 class="col u-size5of12 u-sm-size12of12 u-xs-paddingLeft12 u-sm-fontSize150 u-fontSize200 u-fontWeightBold">404</h1>

For medium.com, the “404” text on the page is inside an H1 tag. Note that it could be different on your website. Ask a web developer or a web consultant to help out.

After getting the appropriate HTML tag, add the code snippet below to Google Tag Manager. Replace h1 to whatever the HTML tag is on your website.

function (){
var pageH1 = document.querySelector('h1').innerText;
return pageH1;
}

Step 1: When adding a Variable, choose “Custom JavaScript”.

gtm custom JS

Step 2: Add this code snippet under the Custom JavaScript Variable in Google Tag Manager.

gtm custom JS2

After which, add the the same Trigger and Tag. Then Preview and Publish the container.

Track 404 Page Views in Google Analytics as a Custom Metric

Step 1: In Google Analytics, go to Admin. Then click Custom Dimensions. Then click Custom Metrics

ga custom metrics

Step 2: Add the settings and Save.
Scope: Hit
Formatting Type: Integer
Check Active and leave the value fields blank.

404 custom metrics

Step 3: Remember the Index number.

404 custom metrics2

Go back to the Tag you created in Google Tag Manager.

Step 1: Check Enable overriding settings in this tag.

Step 2: Under Custom Metrics, add the index number and 1 as value.

404 custom metrics5

You can now do analysis besides other metrics in Google Analytics once the 404 Page View tag is a custom metric

404 custom metrics4

Conclusion: Start Reporting 404 Error Pages in Google Analytics

There are other ways to catch these 404 Error Pages. Screaming Frog and other SEO audit crawlers are the main tools to catch these. This guide serves from the point of view of web analytics.

Proactive 404 Error Page reporting in Google Analytics mitigates any website leaks. It’s a good way to quantify friction and possible user frustrations. 404 error pages are bad for user experience and SEO so it’s always best to 301 redirect them.

Getting more value with Google Analytics and Google Tag Manager is important. There are other user activity digital marketers can track. It’s a matter of knowing website visitors better and investigating other website activities.

References:
AnalyticsMania “How To Track 404 Errors With Google Analytics and Google Tag Manager


About The Author

Francis Angelo Reyes

Francis is the owner and runs Lupage Digital. With 5 years of experience, Francis writes everything he knows about digital marketing. There’s a large knowledge gap between developers and digital marketers. Francis is the middleman between where the non-technical and technical meet.