Track 404 Errors in GA4 with PixelYourSite

When a visitor hits a URL that doesn't exist, your server returns a 404. PixelYourSite logs each one to GA4 with the broken URL and the referrer attached, so you can fix dead links before they cost sales, rank, or ad spend.

Get expert tracking tips in your inbox

Join 65,000+ marketers and site owners who already get our best guides on Meta Pixels, CAPI, GA4, Google Ads, TikTok & Pinterest tracking, GDPR, and more.

* We don’t spam, and all our emails have an “Unsubscribe” link that works. 

The stack

  • PixelYourSite Professional with automatic events enabled
  • A configured GA4 Measurement Protocol connection inside PYS Pro

1. Turn the event on

PixelYourSite Pro → Dashboard → Track key actions with the automatic events → Track 404 pages → on.

2. View the data

No Custom Dimensions to register — the 404 event uses GA4’s built-in page_location, page_referrer, and page_title.

Quick check — Realtime

GA4 → Reports → Realtime. Trigger a known 404 on your site. Watch for 404 in the “Event count by Event name” card. It appears within seconds.

Day-to-day view — Engagement → Events

GA4 → Reports → Life cycle → Engagement → Events. Find 404 in the list and click in. Use the dimension dropdown to switch between Page location (broken URLs) and Page referrer (where visitors came from).

Deep view — Exploration

GA4 → Explore → Blank → Free form.

  1. Date range: Last 30 days.
  2. Import dimensions: Event name, Page location, Page referrer.
  3. Import metrics: Event count, Total users.
  4. Drag Page location and Page referrer into Rows.
  5. Drag Event count and Total users into Values.
  6. Filters: Event name exactly matches 404.
  7. Sort by Event count descending.
  8. Save as 404s — last 30 days.

One row per broken-URL-and-referrer. Top of the table is what to fix first.

3. How to read it

Five patterns:

One URL, no referrer. Stale bookmark, old link in an email or PDF, or a URL that used to be indexed. Fix: 301 to the closest live page.

One URL, internal referrers. A broken link in your own site. Fix: open the referrer, find the dead link, fix at the source.

One URL, external referrer. Someone linked to a URL that no longer exists. Fix: 301 to the right page, and reach out if the source is reachable (partner site, newsletter).

Many 404s with paid utm_source or utm_medium=cpc. A campaign URL is wrong — typo, deleted landing page, or a tracking template mangling the URL. Fix: pause the campaign until the URL is corrected.

Long tail of strange URLs, no referrer. Bot probing. Ignore them, or block at the firewall if volume is high.

4. Alert on spikes

GA4 → Reports → Insights → Create:

  • Frequency: Daily
  • Metric: Event count
  • Condition: Event name equals 404
  • Threshold: % change anomaly detection
  • Email notification: your team

Regressions land in your inbox instead of in a customer ticket.

5. Recover wasted ad spend

The most expensive 404s are the ones paid traffic hits. Add Session medium to the Exploration as a filter set to cpc. Every event in that view is a paid click that landed on a dead page. Fix the URL or pause the campaign.

What this won’t catch

The event fires when WordPress runs and is_404() is true. It does not capture:

  • Static assets (images, CSS, JS) returning 404 — they don’t load WordPress.
  • 404s served by a CDN or full-page cache before WordPress runs.
  • Soft 404s — pages that return 200 OK with “not found” content.
  • 404s on subdomains where PixelYourSite isn’t installed.

For server-level logs that cover all of these, use your web server’s access logs.

Don’t stop here!

Subscribe to get more tips on tracking, analytics, and GDPR.

We’ll send you practical guides on Meta Pixel, CAPI, GA4, Google Ads, TikTok, Pinterest, GDPR compliance, and more, right to your inbox.

* We don’t spam, and all our emails have an “Unsubscribe” link that works. 

See the Google Ads GCLID in GA4

How to capture the Google Ads GCLID on every page view with PixelYourSite and see it inside a standard GA4 Pages report, no Explorations needed.

Find out when we have the next BIG OFFER!

Over 70 000 business-owners have access to our BIG DISCOUNTS. Don't miss the next one: