Finding silent failures with server logs, window.onerror, and sendBeacon
Why Error Tracking Matters
The most immediate value of analytics for developers is finding errors that users never report. Most users who encounter a broken page simply leave — they do not file a bug report. Interestingly, the marketing of all things means we adopt a specialized term for this use of analytics to see how software is behaving: observability.
Server-Side Error Detection
Server access logs contain HTTP status codes for every request. Filter for 4xx (client errors: broken links, missing resources) and 5xx (server errors: crashes, timeouts). This requires no code changes — just log analysis.
Client-Side Error Detection
JavaScript errors, failed resource loads, and unhandled promise rejections are invisible to the server unless you explicitly capture and report them: