Skip to content

How to track 404, 410 and other errors in Statable web analytics

Nobody files a ticket when a page breaks. Your users and potential clients try something, it fails, they leave, and the visit looks exactly like a visit that went fine. That is why broken pages survive for months even on popular sites.

The Errors tab in the dashboard, listing one row: 404 Not Found, counted at 184

Statable labels those hits. Your usual reports then show which URLs fail, with which codes, where that traffic came from, and which browsers, devices and operating systems it used.

Set it up

For Statable to track an error, edit the template that renders it. The 404 template for 404s, the 410 template for 410s, and so on for every error you care about.

Two things go into that template. The Statable tracking code, the same snippet that runs on the rest of your site. And one new line in the <head>:

<meta name="status:code" content="404">

Set content to the code that page actually returns, and repeat this for every error you want to track. The tag is read on every pageview, so one line covers every URL that template renders, including virtual pageviews in a single-page app when your router lands on a not-found route.

One thing to check before you go looking for data: your tracker build has to include the Status code module. It ships in the Standard build. The Nano build leaves it out. See tracking features.

Where the template lives

  • Next.js: the not-found file for the route segment.
  • WordPress: 404.php in the theme, or the wp_head hook. Our plugin does not add the tag for you.
  • Nginx with a custom error page: the HTML file behind error_page.
  • Static hosting: 404.html at the root.

If the report stays empty, check this first. Custom error pages are often built separately from the rest of the site, so the tracking code is missing. That is the usual reason a correct meta tag shows nothing.

Full reference: status codes for error pages.

Why it matters

Errors happen

Most sites have them. Links from years ago, pages that were deleted, a redesign that moved half the URLs, a typo in a link that already went out in a newsletter. No site is above this.

What separates a working site from a broken one is how long they last. Nobody complained, so nothing reached you, and the page goes on failing for everyone who lands on it. The fix is usually five minutes.

They leave for somebody else

Somebody clicks a link, gets a 404 or a 500, and does not conclude that a URL moved. They conclude the site is broken, and the next result in the search page is one click away. For a shop or a booking service that visit was the entire point of the traffic, and it most likely ends as somebody else's sale.

Dead ends add up

One stray 404 is nothing. A site where links keep dead-ending reads as abandoned, and a visitor who hits two of them does not go looking for a third.

Search engines lose the page

A URL that answers 404 leaves the index, and the queries it used to rank for go with it. Inbound links to that address stop passing their value anywhere, where a redirect to the nearest living page would have kept more of it.

Crawling matters less than it is usually made to sound. On a site with fifty pages the crawl budget is not the bottleneck. On a catalogue with tens of thousands of URLs, every fetch spent on an address that no longer exists is one not spent on a page you want indexed, and a sitemap full of them makes the whole file less trustworthy.

Lost sales

Picture a product page that answers 500, or a checkout step that fails on submit. The visitor gets an inconvenience. You get no order, no email about it, and no idea it happened. An ad pointing at a page that is gone spends its budget the same way, and platforms eventually stop showing an ad whose destination is broken.

A spike is a signal

Once the codes are visible you can start diagnosing the problem and looking for the fix. A jump in 404s the week you changed the URL structure means the redirects were never written. 500s that appear after a CMS update, or only in the hour your traffic peaks, are the application or the server telling you something an uptime check reports as fine.

Which codes exist

CodeWhat it meansTypical causeWhat to do with it
400The request is malformedA truncated link, broken parametersFind out what generates such URLs
401Not signed inAn emailed link into an account areaSend the person on after sign-in
403Access deniedMembers area, paid contentA lot of these means links are leaking
404Page not foundA typo, a deletion, a move with no redirectRedirect to the replacement, or fix the link
410Gone for goodA deliberate removalKeep the 410, it is a real answer
429Too many requestsRate limits, bots, people behind one NATFollow the traffic source behind the spike
451Blocked for legal reasonsRegional restriction, a takedownTell the visitor what happened
500Something broke on our sideAn application errorWatch how the line moves across days
502 504Proxy and timeout failuresInfrastructureHand it to whoever runs the servers
503Service unavailableMaintenance, overloadCheck whether a maintenance window caught real traffic

What this catches

Only what rendered in a browser with the tracking code on it. A friendly error page qualifies. A hard 500 that never reached your template does not, and 401 and 429 are usually served without your layout at all. That is the limit of the method.

The code in the tag is not validated either. Whatever you write is what lands in the report, 200 included. Use the code the page really returns.

Find them in Statable

The dashboard has an Errors section that lists every code Statable detected.

Click a code and the dashboard moves to Top Pages with that code applied as a filter, so the list you get is the exact URLs that produced it. The filter stays on for the rest of the dashboard too, so Sources, Browsers, Devices and the others then describe the error traffic alone.

Codes that mean the same thing to you can be read together. 404 and 410 both say the page is gone, so you can put both into one filter and read the pages behind them as a single list. Save the combination you reach for most and it comes back in one click. Details in reports.

Ready to see where your site breaks? Add the meta tag to your error template, keep the tracking code next to it, and the report fills itself as people hit those pages. Start a free trial and you will know by tomorrow which broken URL is costing you the most.