How to Track 404 Errors in GA4: How to Identify & Fix Broken Links
Let's talk about something that quietly sabotages user experience and can chip away at your SEO efforts: the dreaded 404 'Page Not Found' error. We've all landed on them – it's frustrating, right? As a user, it's a dead end. As a website owner or analyst, it's a missed opportunity and potentially a sign of deeper issues.
Now, if you've migrated to Google Analytics 4, you might be scratching your head, wondering, "Where's the ga4 404 report
?". The short answer? Unlike some Universal Analytics configurations, GA4 doesn't offer a dedicated, out-of-the-box report for 404 errors. But fear not! GA4's flexible event-based model means we can track these effectively; it just requires a little setup.
In this post, we'll dive deep into why you absolutely must track these errors and provide clear, step-by-step instructions on how to configure GA4 (ideally using Google Tag Manager) to get the insights you need to find and fix those pesky google analytics page not found
instances. Let's get started.
Why Bother Tracking 404 Errors?
Ignoring 404s is like ignoring leaks in a bucket. Eventually, you'll notice what you've lost. Here’s why proactive tracking is non-negotiable:
User Experience (UX): Hitting a 404 is jarring. It breaks the user journey, creates frustration, and often leads to users bouncing off your site entirely. Poor UX = lost trust & engagement. A user who hits a dead end is unlikely to try again.
SEO Impact: Search engines like Google aim to provide the best results. Continuously sending crawlers (like Googlebot) to broken pages wastes your site's crawl budget. Furthermore, if external sites link to pages on your site that now return a 404, you lose the valuable link equity (or "link juice") passed by those backlinks. This can negatively impact your rankings.
Lost Opportunities: Imagine a user clicking a link from a paid campaign, a crucial referral source, or even an old social media post, only to land on a 404. That's often a lost conversion, a lost lead, or at minimum, a wasted click. Identifying the source of traffic hitting 404s is vital for optimizing campaigns and fixing referral links.
Website Maintenance & Health: A sudden spike or consistently high number of
404 errors ga4
can signal underlying problems. Perhaps a CMS update broke URL structures, content was deleted without redirects, or there are widespread internal linking errors. Tracking helps you diagnose these issues promptly.
Method 1: Filtering by Page Title (If Consistent)
If you're looking for a quick-and-dirty method without setting up new tracking, and your 404 error page has a unique and consistent HTML title tag (e.g., <title>Page Not Found</title>
), you can leverage standard GA4 reports to find 404 pages.
How-To:
In GA4, navigate to
Reports > Engagement > Pages and screens
.Look for the filter option above the report table (often looks like "Add filter +").
Click to add a filter. Configure it as follows:
Dimension:
Page title
Match type:
contains
(orexactly matches
if you're certain)Value: Enter the exact text of your 404 page's title (e.g.,
Page Not Found
,404 Error
, etc.).
Click
Apply
.
The report will now show data only for page views where the page title matched your input. You can see metrics like Views
and Users
for the URLs that displayed this title.
Pros:
Fast setup – no GTM needed.
Uses existing GA4 data.
Cons & Limitations:
Crucially dependent on having a unique and consistently implemented page title across all 404 scenarios. If the title changes or isn't unique, this method fails.
It doesn't capture the 404 occurrence as a distinct event, making more advanced analysis harder.
Pinpointing the referring URL (where the user came from) is difficult within this standard report view.
Risk of false positives if, for some reason, other non-404 pages contain the same text in their title.
While useful for a quick check, this method lacks the robustness and detail needed for thorough 404 analysis.
Method 2: Creating a Custom error_404
Event (Recommended)
For accurate, reliable, and actionable 404 errors ga4
tracking, triggering a dedicated custom event is the way to go. Google Tag Manager (GTM) makes this process manageable and is highly recommended.
Prerequisites:
GA4 is correctly installed on your site.
GTM container is implemented across all pages.
You can reliably identify when a 404 page is served. Usually, this involves checking the
Page Title
. Less commonly, you might use a unique CSS selector on the page body or even rely on a JavaScript variable pushed by your backend. We'll focus on the Page Title method as it's most common.
Step-by-Step GTM Configuration:
Let's walk through setting this up in GTM:
Step 1: Create the Trigger
This tells GTM when to fire our 404 event tag.
In your GTM container, go to
Triggers
and clickNew
.Click
Trigger Configuration
and choosePage View
. (UsingWindow Loaded
might be slightly safer as it waits for all page resources, ensuring thedocument.title
is likely final, butPage View
often works fine).Under "This trigger fires on", select
Some Page Views
.Set the firing conditions:
Page Title
|contains
|Page Not Found
(<- IMPORTANT: Replace"Page Not Found"
with the exact text that appears in the<title>
tag of your 404 error page. Be precise!).5. Give your trigger a clear name, like
PV - 404 Page Title
.6. Click
Save
.
Step 2: Create the GA4 Event Tag
This tag sends the actual event data to GA4 when the trigger fires.
Go to
Tags
and clickNew
.Click
Tag Configuration
and selectGoogle Analytics: GA4 Event
.Select your existing
Google Analytics: GA4 Configuration
tag from the dropdown. (If you don't have one, you need to set that up first).Event Name: Enter
error_404
. Use lowercase snake_case. This is the name you'll see in GA4 reports.Event Parameters: This is where we add crucial context! Click
Add Parameter
twice:
Row 1: Parameter Name:
page_location
| Value:{{Page URL}}
(The built-in GTM variable for the current page URL – this tells you which URL returned the 404).Row 2: Parameter Name:
page_referrer
| Value:{{Referrer}}
(The built-in GTM variable for the previous page URL – this tells you where the user came from before hitting the 404. Invaluable for finding broken links!).
6. Firing Triggers: Click the triggering section and select the PV - 404 Page Title
trigger you created in Step 4.1.
Give your tag a clear name, like GA4 Event - error_404
.
Click Save
.
Step 3: Preview, Test, and Publish
Never skip preview mode!
Click the
Preview
button in GTM. Enter your website URL.Navigate to a URL on your site that you know returns a 404 error.
In the Tag Assistant debug window, look for the "Page View" or "Window Loaded" event on the left. Click it.
Check the "Tags Fired" section. Your
GA4 Event - error_404
tag should appear here.Click on the fired tag. Verify that the
Event Name
iserror_404
and that thepage_location
andpage_referrer
parameters have captured the correct URLs.page_referrer
might be empty if you navigated directly or from an untrackable source, but it should populate if you clicked a broken link on your site.Once confirmed, go back to GTM, click
Submit
, give your version a name (e.g., "Added 404 Event Tracking"), and clickPublish
.
Step 4: Register Custom Dimensions in GA4
To effectively use the page_referrer
parameter you're sending within GA4's reporting interface (especially Explorations), you need to tell GA4 about it.
In GA4, go to
Admin
(bottom left gear icon).In the Property column, click
Custom definitions
.Select the
Custom dimensions
tab and clickCreate custom dimensions
.Configure it as follows:
Dimension name:
Page Referrer (Event)
(Make it user-friendly for your reports).Scope:
Event
(Because we sent it as an event parameter).Description: (Optional but good practice) e.g.,
Referring URL for error_404 events
.Event parameter:
page_referrer
(This must exactly match the parameter name you used in the GTM tag).
5. Click
Save
.
Important Delay: Custom dimensions aren't retroactive. Data collected before you registered the dimension won't be populated. Furthermore, it typically takes 24-48 hours after registration for new data associated with this dimension to start appearing in your GA4 reports, especially Explorations. Be patient!
Building GA4 404 Report: Visualizing the Data
Okay, you've set up the tracking. Now, where do you see the report of tracking 404?
Option 1: Using Standard Reports (Filtered)
For a quick glance:
Go to
Reports > Engagement > Events
.After a day or two (allowing for data processing), you should see
error_404
listed in the event name table. Click on it.This provides a basic overview – event counts, user counts over time. You might see some parameter data in cards below the chart, but it's not ideal for deep analysis of which pages and referrers are involved.
Option 2: Creating a Custom Exploration Report (Recommended)
This is where the power lies! Explorations let you slice and dice the data exactly how you need it.
Navigate to the
Explore
section in GA4 (looks like a graph icon on the left).Click
Blank
orFree form
to start a new exploration.Name your Exploration: Something clear, like "404 Error Analysis".
Variables Column (Left Panel):
Click the "+" next to DIMENSIONS. Search for and import:
Event name
Page location
(Shows the URL that generated the 404)Page Referrer (Event)
(The custom dimension you created! This shows the source URL)(Optional)
Session source / medium
(To see traffic sources leading to 404s)
Click the "+" next to METRICS. Search for and import:
Event count
(How many times theerror_404
event fired)Total users
(How many unique users triggered the event)(Optional)
Sessions
5. Tab Settings Column (Right Panel):
Drag
Page location
from Variables to Rows.Drag
Page Referrer (Event)
from Variables to Rows (belowPage location
).Drag
Event count
from Variables to Values.Drag
Total users
from Variables to Values.CRITICAL: Drag
Event name
from Variables to the Filters section at the bottom. Configure the filter:matches exactly
->error_404
. ClickApply
.
You now have a powerful table showing exactly which pages (Page location
) are causing 404s, where users are coming from (Page Referrer (Event)
), and how often it's happening (Event count
).
Analyzing 404 Data: From Numbers to Action
Your Exploration report isn't just a pretty table; it's a diagnostic tool. Here’s how to interpret it:
Identify High-Volume 404s: Sort the table by
Event count
(descending). ThePage location
URLs at the top are your biggest problems. Address these first.Trace the Source (Referrers): For each high-volume
Page location
, examine the associatedPage Referrer (Event)
values:
Internal Referrers: If the referrer URL is part of your own domain (
www.yoursite.com/...
), you have a broken internal link. Find that referring page and fix the link immediately. This is entirely within your control.External Referrers: If the referrer is another website (
www.externalsite.com/...
), they have a link pointing to a broken page on your site. The best course of action is usually to set up a 301 redirect from the broken URL (Page location
) to the most relevant, live page on your site. This preserves UX for referred visitors and helps reclaim SEO value. Contacting the external site owner can work but is often slower and less reliable than implementing a redirect yourself.Direct / None or Search Engines: If the referrer is empty or a search engine (e.g.,
google.com
), users might be using old bookmarks, typing URLs incorrectly, or landing via outdated search results. Implementing 301 redirects for any known moved or deleted content is crucial here.
3. Look for Patterns: Are most 404s happening in one section of your site (e.g.,
/blog/...
)? Did a specific marketing campaign (Session source / medium
) lead to a spike in 404s? These patterns can point to systemic issues or campaign tracking errors.
Taking Action: Fixing the Leaks
Data is useless without action. Based on your analysis:
Fix Internal Links: Go into your CMS or HTML and correct any internal links identified via internal referrers.
Implement 301 Redirects: This is your workhorse fix. Use your server configuration (
.htaccess
for Apache, configuration files for Nginx, or platform-specific tools) to set up permanent (301) redirects from the brokenPage location
URLs to the most appropriate live URLs. Avoid mass-redirecting all 404s to the homepage – it's lazy, bad for UX, and not great for SEO. Be specific.Update Sitemaps: Ensure your XML sitemap is accurate and doesn't list any URLs that now return a 404 status. Submit the updated sitemap to Google Search Console and Bing Webmaster Tools.
Content Strategy Review: If content was intentionally deleted, ensure redirects are in place. If a popular page was removed, was that the right decision? Could replacement content or a consolidated page serve users better?
(Optional) Contact External Sites: For high-value external links pointing to 404s, a polite email to the site owner informing them of the broken link (and suggesting the correct one) can sometimes work.
Advanced Considerations & Other Tools
While GA4 provides valuable browser-side tracking, keep these in mind:
Server Logs: Your web server logs are the absolute ground truth for all requests, including those from bots that don't execute JavaScript (and thus won't be tracked by GA4). Analyzing server logs can reveal 404s missed by client-side tracking.
Google Search Console (GSC): GSC is essential. Check the
Indexing > Pages > Not found (404)
report regularly. This shows URLs that Googlebot specifically encountered as 404s during crawling. Cross-reference GSC data with your GA4error_404
report. You can mark errors as fixed in GSC after implementing redirects.Custom 404 Page Design: Make your 404 page useful! Don't just show a cryptic error. Include your site branding, acknowledge the error clearly, provide a prominent search bar, and suggest links to key areas like the homepage, blog, or popular products. Turn a dead end into a helpful detour.
Simplify Your 404 Analysis with Watson: The GA4 Audit Dashboard You've Been Missing
While setting up custom tracking for 404 errors in GA4 is valuable, maintaining and analyzing this data can become another task on your already busy analytics schedule. This is where Watson, the GA4 Audit Dashboard, becomes indispensable for technical analysts. Unlike basic reporting tools, Watson automatically identifies page views where the page title contains "Not Found" or "404" as part of its comprehensive 58+ audit checks, giving you immediate visibility into potential error pages without the complex setup we just walked through.
What makes Watson particularly powerful for 404 analysis is its ability to consolidate these findings alongside other critical GA4 implementation issues, creating a holistic view of your site's technical health. Rather than jumping between custom explorations and server logs, you can quickly identify problematic 404s, cross-reference them with other tracking anomalies, and prioritize fixes based on comprehensive data—all from a single, intuitive dashboard that updates automatically.
Try the free Watson GA4 Audit Dashboard to complement your custom 404 tracking and take your technical analytics workflows to the next level. Your future self will thank you when you catch that critical 404 error before it impacts your conversion rates or SEO performance.
Conclusion
Let's wrap up. 404 errors might seem minor, but they represent friction, frustration, and missed opportunities. While GA4 doesn't hand you a ga4 404 report
on a silver platter, setting up custom event tracking via GTM (specifically the error_404
event capturing page_location
and page_referrer
) provides the detailed insights needed.
By regularly building and analyzing your 404 Exploration report, tracing errors back to their source (internal or external referrers), and taking decisive action (fixing links, implementing 301 redirects), you can significantly improve user experience, protect your SEO efforts, and ensure visitors find the valuable content you've created. Don't let 404s be a blind spot – take control with GA4 and GTM!
FAQs
Does GA4 automatically track 404 errors?
A: No, GA4 does not have a built-in, dedicated report specifically labelled "404 Errors". You must configure tracking yourself, typically by setting up a custom event (like error_404
) using Google Tag Manager that fires when a 404 page is viewed.
What's the best way to track 404s in GA4?
A: The most reliable and informative method is to create a custom error_404
event using Google Tag Manager. This event should be triggered when your 404 page loads (usually based on the Page Title
) and should capture crucial parameters like page_location
(the broken URL) and page_referrer
(where the user came from).
How can I see which external sites link to my broken pages?
A: Capture the page_referrer
parameter with your error_404
event (as described in Method 2). Then, register page_referrer
as an event-scoped custom dimension in GA4's Admin section. Finally, create an Exploration report using Page location
and your custom Page Referrer (Event)
dimension, filtering for Event name
equals error_404
. The report will show external referrers alongside the broken page they link to.
Why isn't my
page_referrer
data showing up immediately in GA4?
A: There's a processing delay. After you create a new custom dimension in GA4 (like the one for page_referrer
), it typically takes 24 to 48 hours for data associated with that dimension to become available in your reports, especially in Explorations. Data collected before registration won't be backfilled.
Should I just redirect all 404 errors to my homepage?
A: It's generally not recommended. Redirecting all broken URLs to the homepage can confuse users looking for specific content and isn't optimal for SEO, as it doesn't pass link equity effectively. Best practice is to implement specific 301 (permanent) redirects from each significant broken URL to the most relevant live page on your site. If no relevant page exists, provide a helpful custom 404 page with navigation and search options.