How to Properly Track 404 Errors in GA4
404 pages are one of the most overlooked issues in digital analytics.
Broken pages create poor user experiences, hurt SEO performance, interrupt conversion flows, and often go unnoticed for months.
Unfortunately, GA4 does not automatically provide a reliable “404 Report” out of the box.
In this guide, you’ll learn how to properly track 404 errors in GA4 so you can:
- Identify broken pages
- Find internal links causing errors
- Detect outdated campaigns
- Monitor SEO issues
- Improve website experience
Why Standard GA4 404 Tracking Is Often Inaccurate
Many teams try to identify 404 pages using:
- Page Title contains “404”
- Page Title contains “Page Not Found”
- URL contains
/404
While this approach works partially, it has major limitations:
- Different sites use different 404 page titles
- Some sites return 200 status codes instead of true 404s
- Referrer information is often missing
- Internal broken links are difficult to identify
- Browser privacy restrictions can hide referrer data
That’s why implementing a dedicated GA4 event is the best approach.
Recommended Approach: Track a Dedicated page_not_found Event
Instead of relying only on page titles, send a dedicated event whenever a user lands on a 404 page.
Example event:
gtag('event', 'page_not_found', {
requested_path: window.location.pathname,
page_location: window.location.href,
page_referrer: document.referrer
});
This creates a much more reliable and structured tracking setup.
Recommended Parameters to Capture
We recommend sending these parameters with the event:
| Parameter | Purpose |
|---|---|
| requested_path | The missing URL path |
| page_location | Full URL |
| page_referrer | The previous page |
| error_type | Optional classification |
| page_title | Helpful for debugging |
These parameters help identify:
- broken internal links
- bad redirects
- outdated campaign URLs
- SEO problems
- navigation issues
Option 1: Implement Using Google Tag Manager
Step 1: Detect the 404 Page
Most websites display a unique title or body class for 404 pages.
Common examples:
- “404”
- “Page Not Found”
error404not-found
You can create a trigger based on:
- Page Title
- Page Path
- DOM element
- Body class
Example:
- Trigger Type: Page View
- Condition:
- Page Title contains “404”
Step 2: Create a GA4 Event Tag
Create a new:
- GA4 Event Tag
Event Name:
page_not_found
Parameters:
| Parameter | Value |
|---|---|
| requested_path | {{Page Path}} |
| page_location | {{Page URL}} |
| page_referrer | {{Referrer}} |
| page_title | {{Page Title}} |
Step 3: Test the Setup
Use:
- GTM Preview Mode
- GA4 DebugView
Then intentionally visit a missing URL like:
/example-404-page
Verify:
- the event fires
- parameters are populated
- the event appears in GA4 DebugView
Option 2: Implement Using gtag.js
If you are not using GTM, you can send the event directly with JavaScript.
Example:
<script>
gtag('event', 'page_not_found', {
requested_path: window.location.pathname,
page_location: window.location.href,
page_referrer: document.referrer
});
</script>
Place this code only on your 404 template.
Important: Make Sure Your Server Returns a True 404 Status Code
Many websites display a “Page Not Found” message while still returning:
200 OK
This creates major SEO and analytics issues.
Your server should return:
404 Not Found
You can verify this using:
- Chrome DevTools
- Screaming Frog
- browser network tab
- SEO audit tools
Common Problems You’ll Discover
Once proper tracking is enabled, you’ll often uncover:
Broken Internal Links
Examples:
- outdated navigation links
- old blog links
- removed landing pages
- incorrect redirects
SEO Problems
Examples:
- indexed pages removed accidentally
- backlinks pointing to dead pages
- old URLs still receiving traffic
Campaign Errors
Examples:
- typo in paid campaign URL
- incorrect email links
- expired seasonal landing pages
How to Analyze 404 Errors in GA4
After collecting data, build reports using:
Dimensions:
- requested_path
- page_referrer
- page_title
Metrics:
- eventCount
- users
- sessions
This allows you to prioritize:
- high-traffic broken pages
- internal-link problems
- SEO-impacting issues
Best Practices
Prioritize High-Traffic 404s First
Not all broken pages matter equally.
Fix pages that:
- receive significant traffic
- affect conversions
- interrupt funnels
- impact SEO
Use Redirects Carefully
301 redirects are useful, but avoid:
- redirect chains
- redirecting everything to homepage
- irrelevant redirect targets
Monitor 404s Regularly
404 issues constantly reappear due to:
- site redesigns
- CMS changes
- deleted content
- campaign mistakes
Regular monitoring helps maintain analytics quality and user experience.
Final Thoughts
404 tracking is not just a technical SEO task.
It directly impacts:
- user experience
- conversion performance
- campaign effectiveness
- data quality
Implementing a dedicated page_not_found event in GA4 provides much more accurate insights than relying only on page titles or URL patterns.
If you want deeper visibility into broken pages, internal link issues, and tracking quality, proper 404 monitoring should be part of every analytics audit strategy.