Clycyo
How-to4 min read

How to Track 404 Errors and Recover Lost Traffic

Every 404 is a visitor you earned and dropped. Track not-found pages as events, find the broken inbound links, and fix the leaks.

Every 404 is a visitor you already won — they clicked a link to you, typed your domain, followed a bookmark — and then dropped at the doorstep. Server logs technically record these; nobody reads server logs. Put 404s in your analytics instead, with the referrer attached, and broken-link recovery becomes a weekly five-minute habit with measurable traffic returns.

Implementation: one event on the 404 template

<!-- On your 404 page only -->
<script>
  window.webanalytics?.track('not_found', {
    path: location.pathname + location.search,
    referrer: document.referrer || 'direct',
  });
</script>

Every framework has a 404 template to put this on — Next.js not-found.tsx, Hugo's 404.html, Webflow's 404 page, Rails' public/404 with the snippet inlined. The referrer property is the whole value: a 404 without its source is trivia; with it, it is a to-do item.

Triaging the report

  1. External referrers → redirect. Someone else links to a path that moved. You cannot fix their link; you can 301 it in one line and reclaim every future click (plus the link equity, as the SEO tracking guide notes).
  2. Internal referrers → fix the link. Your own page links to a dead path — the only 404 class that is entirely your fault and entirely fixable.
  3. Direct with patterned paths → check old campaigns. QR codes, printed URLs, and email archives keep sending people to retired pages for years. A redirect map for legacy campaign URLs is permanent infrastructure.
  4. Garbage paths (wp-admin probes, .env hunts) → ignore. Bots probing for vulnerabilities; filter them out of the report by pattern and move on.

Make the 404 page itself convert

While you are on the template: a search box, links to top content, and a one-line apology outperform the default sad robot. Track clicks on those recovery links (CTA events) and you will know your 404 recovery rate — the most overlooked conversion rate on the site.

Cost of the whole setup: five lines on one template. Yield: a weekly report that converts directly into redirects, fixed links, and recovered visitors. Few analytics habits pay better per minute invested.