This blog post will take you through the steps to setup reporting of 404s in Google Analytics and Google Data Studio.
Why Report & Monitor 404s
‘404 Not Found’ errors are not something you typically want on your website. If a page has been deleted moved, most of the time you’ll want to implement a redirect to point users (and crawlers!) to the new URL to provide a seamless experience and avoid a ‘dead end’ situation.
You’ll often know when your pages are moving or being deleted, but it’s also incredibly common for 404s to crop up unexpectedly. For instance, it could be the unintended side effect of a change made somewhere else on your website, or the change could’ve been made by a CMS editor that isn’t technically-minded or aware of the clean-up procedure.
In this case, if you don’t have a SaaS / tool in place to constantly check your site for 404s (such as ContentKing), or if you want access to the data and additional reporting capabilities, you’ll want to look at reporting the 404s either in Google Analytics or Google Data Studio.
This post will show you how.
About This Solution
This solution relies on finding the common string of text in your error-related title tags that specifically pegs those pages as responding with a 404 error and filtering your Google Analytics data to show these URLs.
In other words, we’re going to ask Google Analytics to show us only URLs where the page title includes a string like “404 Not Found”. Simple, right?
While this isn’t bomb-proof, it’ll pick up 99% of 404s for most websites (without us digging in to server logs), so it’s the quickest, easiest and cheapest way to get hold of this data.
Step 1: Find the Common Title Tag of Your 404s
Forcing a 404
First, we’re going to force a 404 error to check the title tag, so open up a new tab in your browser and type in your domain name followed by a random string of characters, for example:
www.example.com/abc123
You should see your 404 page template, like below.
Looking up at the browser tab, we can see that the 404 template for this site uses the string “Page not found” in its title tag. Excellent! We’re practically halfway there.
Checking Google Analytics for Other 404s
To be absolutely sure and confirm whether or not there are other 404 error-related titles, we’re also going to run a search in Google Analytics. Variations in the error message can crop up for a number of reasons, for example:
- A previous update to your website may have involved a change to the 404 title tag, meaning we want to capture the old title tag too for historical reporting.
- If one or more parts of your website run on a different platform (say you have a Shopify eCommerce site with WordPress taking care of the Blog part), these different platforms can display different titles on your error pages.
So let’s dive into Google Analytics.
The steps are straightforward:
- Go to Behavior –> Site Content –> All Pages
- Change the Primary Dimension to Page Title
- Copy and paste the following into the filter box and press Enter (this is regex and it will return results matching any of the three strings):
404|error|found|missing|unavailable
This will show you whether or not there are other title tag variations in use across your website.
Whether you find more variations or not, just make a note of the title tags you would like to report on and we’ll move on to Step 2.
Step 2, Option A: Setup a Report in Google Analytics
Creating a Custom 404 Report in Google Analytics
To create a report showing just these 404s in Google Analytics, start by going to Customization –> Custom Reports and click the +New Custom Report button.
Clicking that will bring up a new screen where we will configure our report. Set the fields as follows, leaving any not mentioned as their default values:
- General Information
- Title: 404 Report
- Report Content
- Add Metric: Unique Pageviews
- Add Dimension: Page
- Filters
- Add Filter: Include – Page Title – Regex – “Your 404 string” (my example would be “Page not found”, without the quotation marks)
Then click Save.
You should now see your report which lists the specific URL paths where users experienced a 404 Not Found error.
You can now look at each one and determine what action needs to take place (i.e. implementing a redirect), if any action is needed at all.
Schedule Sending the Custom 404 Report via Email
If you want to get this schedule this report to be sent regularly to your inbox – say once a month – in order to keep track of your site’s 404 errors, click the Share button and enter in the email addresses you want the report sent to, as well as the desired frequency.
Alternatively, if you’d like to do your reporting in Google Data Studio, check out the next section.
Step 2, Option B: Setup a Report in Google Data Studio
Google Data Studio allows you to build dashboards and reports with far more flexibility than Google Analytics, as well as the ability to pull in multiple data sources.
In this case, we are just going to pull in Google Analytics data and create the same sort of filter as we did in the previous step, but this time in the Data Studio way.
Creating a Custom 404 Report in Google Data Studio
To start, go to Data Studio, create a new blank report and add your Google Analytics account as a data source for this report.
Now click on Add a chart and then select the first Time series chart and drop it on your canvas, resizing it to your liking.
Now we’re going to swap out the default settings with our 404-related settings. Set yours as follows:
- Dimension: Date
- Metric: Unique Pageviews
- Default date range: your choice
- Filter: Add a Filter
- Name: 404 Pages Only
- Include – Page Title – RegExp Contains – “Your 404 string” (as above, replace this with your string we found in Step 1)
This is what your filter should look like, depending on your 404 string:
This is what your configured time series chart should look like:
Next we’re going to add a table chart to show the same info as our Google Analytics report, so go ahead and click Add a chart and then select the Table with heatmap chart, as shown below:
We’re going to configure this chart mostly the same, but with one primary difference. Instead of Date being the dimension, it’s going to be Page. You’ve already created your filter, so just select that from the list.
This table view is more actionable than the time series chart above it because it gives us the specific pages that we can investigate further. For that fact, I’d recommend adjusting the time period for the table to be short than the time series chart. It’ll mean you spend more time focusing on the most recent 404s, allowing you to resolve problems sooner rather than later.
Schedule Sending the Custom 404 Report via Email
To schedule the regular delivery of this report, click the Share dropdown and select Schedule email delivery.
On the modal that pops up, configure the settings accordingly.
In the example above, I’ll receive this report by email every month from now on.
There you have it; a simple way of finding the 404 errors on your site that your users are experiencing the most.
One reply on “How to Report & Monitor 404s with Google Analytics & Google Data Studio”
Cool stuff Bob! I started looking very closely at 404 errors no that Google crawls my websites less. Your tips for creating a Datastudio dashboard made my life easier. Tqvm.