October 17, 2026
How to Track 404 Pages in GA4
GA4 has no built-in 404 report. Learn how to track 404 pages with page titles or a custom event, see referrers, and understand GA4's limits.
Universal Analytics users often built a simple 404 report by filtering page titles. GA4 has no ready-made equivalent, but you can track 404 pages with a few minutes of setup. There are two common methods.
Method 1: Filter by page title
Most 404 templates use a title such as "Page not found" or "404". If yours does, you can analyze 404s without changing any code.
- Open Explore and create a Free form exploration.
- Add the dimensions Page title and Page path and screen class, and the metric Views (or Sessions).
- Add a filter: Page title contains "not found" (or "404", depending on your template).
- Put Page path in rows and Views in values.
You now have a list of missing URLs sorted by views.
Limitation: this only works if every 404 page has a consistent title. Some platforms keep the original product or category title on error pages, which breaks the filter.
Method 2: Send a custom event (recommended)
A dedicated event is more reliable. On your 404 template, push an event to the data layer:
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'page_not_found',
page_location: window.location.href,
page_referrer: document.referrer
});
</script>
In Google Tag Manager, create a Custom Event trigger for page_not_found and a GA4 Event tag that sends the event with page_location and page_referrer parameters.
If you use gtag.js without GTM, you can call gtag('event', 'page_not_found', {...}) directly on the error template.
See where visitors came from
The referrer is what makes a 404 report actionable. To use it in reports, register page_referrer as an event-scoped custom dimension under Admin → Custom definitions. New data appears after the dimension is created; it isn't applied retroactively.
Then build an exploration with the event name page_not_found, the missing URL and the referrer. Now you can tell internal broken links from external links, ads and AI assistants.
What GA4 does not see
GA4 is useful but incomplete for 404 monitoring:
- No JavaScript, no data. Bots, crawlers and many link checkers never run your tag.
- Consent. In regions with cookie consent, visitors who decline may not be measured, or only modeled.
- Ad blockers remove a share of hits.
- Non-HTML requests such as missing images, PDFs or API paths are not tracked.
- Delay. Reports are not real-time enough to catch a broken campaign within minutes.
For a complete picture, combine GA4 with server-side 404 logging. Search Console covers what Googlebot sees; see How to Read and Fix the "Not found (404)" Report.
Turn the report into fixes
Once 404s are visible, prioritize by views and source, then:
- fix internal links at the source,
- 301 redirect moved content to the closest equivalent,
- leave random or junk URLs as 404.
Our guide to recovering lost traffic from 404 logs walks through the full process.
Summary
GA4 can track 404 pages through page titles or, better, a custom page_not_found event with the referrer as a custom dimension. It's a good complement, but it misses bots, non-consenting visitors and non-HTML files. no404 records every 404 on the server side in real time and lets you add the redirect from the same screen.