JavaScript Error Monitoring: What to Track and Why It Costs You Sales

JavaScript Error Monitoring: What to Track and Why It Costs You Sales

JavaScript errors run in the visitor's browser, so your server logs and uptime checks will not show them. You need code or a tool that reports them from the page. Two hooks catch most of them: the global error event for uncaught exceptions and the un

TLDR;

Capture uncaught exceptions, unhandled promise rejections, and important handled failures. Record the page, browser, device, release, stack trace, and preceding actions while masking sensitive data. Compare browser and server errors on the same funnel steps. Prioritize affected sessions and conversion impact over raw event counts, fix checkout and signup first, and confirm recovery after release. Alert on sustained user-visible problems rather than every exception.

JavaScript Error Monitoring: What to Track and Why It Costs You Sales

JavaScript error monitoring means capturing the errors that happen in your visitors' browsers, which you never see from your own laptop, and ranking them by what they cost you. For a business site, the useful question is not "how many errors do we have?" but "which errors stop people from buying, signing up or reaching the page we want ranked?" Our Website Monitoring covers downtime, errors and SEO health, and sits next to revenue and conversion data, so an error can be read against the money it touches.

Why JavaScript errors are easy to miss

A server error leaves a trace on your server. A JavaScript error does not. The code runs on the visitor's device, in their browser, with their extensions, their connection and their version of the page. When something throws, the visitor sees a button that does nothing or a form that will not submit. You see nothing.

That is more common than most owners assume. A study of 50 popular websites by researchers at the University of British Columbia and Microsoft Research found JavaScript errors in 49 of them, averaging 3.88 distinct error messages per application. The study is from 2011, and the web has changed a great deal since, but the pattern holds: the more third-party scripts, tag managers, widgets and A/B tests a page loads, the more places something can break.

The same study found that about 72% of the errors were non-deterministic, meaning they did not happen on every run. That is the reason testing on your own machine is not monitoring. An error that appears for one visitor in fifty, on one browser, after one specific click sequence, will pass every manual check you do.

Why JavaScript errors are easy to miss

Common causes on a live site

For a small store or marketing site, most errors come from a short list:

  • Third-party scripts. Chat widgets, review apps, ad pixels and consent banners fail or change without notice.
  • Undefined values. Code expects an element or a data field that is not there yet, or is not there on that page template.
  • Failed network calls. A request to a payment, cart or search endpoint times out or returns an error, and the code does not handle it.
  • Load order problems. A script runs before something it depends on is ready. Scripts that delay rendering, such as render-blocking resources, often sit at the center of these timing issues, because they change when the rest of the page can run.
  • Browser differences. A feature works in one browser and throws in another, or in an older version still in use.

The same study found that roughly 93% of errors fell into four categories: permission denied, undefined symbol, null exception and syntax errors. Most of what you will see in a report comes down to a handful of patterns like these, which is good news: fixing the top few removes most of the noise.

How JavaScript error tracking works

Browsers give you two main hooks. Every monitoring tool, whether it is a hand-written snippet or part of a platform, builds on them.

Uncaught exceptions

When code throws and nothing catches it, the browser fires an error event on the window. MDN's documentation notes that this event covers script errors thrown synchronously, for example during initial loading or inside event handlers. A listener receives the message, and typically the file, line and column where it happened.

Unhandled promise rejections

Modern code leans heavily on promises and async functions, and failures there do not trigger the error event. MDN explains that when a promise is rejected and nothing handles the rejection, an unhandledrejection event fires instead. A failed fetch to your cart endpoint is the classic example. If you only listen for error, you miss these.

The Front-End Monitoring Handbook on freeCodeCamp shows both patterns: a window.onerror handler that captures the message, file URL, line, column and stack trace, and an unhandledrejection listener that records the rejection reason along with a timestamp and the page URL.

Errors you catch yourself

Sometimes your code already catches an error, for example inside a try/catch around a payment call, and shows the visitor a friendly message. Those handled errors still matter. If you only log what escapes, you will not see the checkout failure the visitor was politely told about. Report handled errors deliberately, as custom events, so they are counted too.

What to capture with each error

A message such as "Cannot read properties of undefined" tells you almost nothing on its own. What lets you reproduce and rank an error is context. For each one, aim to record:

  1. The page. The URL or route pattern (for example /products/:id rather than every resolved product URL), so errors group by template.
  2. The browser and device. Browser, operating system, device class and viewport size. Many errors turn out to belong to one browser or to mobile.
  3. The release. Which version of your code was running, so you can tell whether an error is new.
  4. What happened just before. The last few clicks, navigations and network calls.
  5. The stack trace. In production your code is usually minified, so the trace points to unreadable line numbers until it is mapped back to your source.
  6. The session. How many distinct visitors were affected, not just how many times the error fired. One visitor stuck in a loop can produce thousands of events.

That last point is the one that changes decisions. Ten thousand events from one broken session is a minor bug. Forty events from forty different shoppers on the checkout page is an emergency.

Source maps and privacy

Two housekeeping points save trouble later.

Source maps translate minified code back into your original files. Upload them to your monitoring tool as part of your build, and avoid serving them publicly, since a public map exposes your source code.

Privacy matters because error payloads can pick up more than you intend: email addresses in URLs, form values in breadcrumbs, tokens in query strings. Strip or mask these before anything leaves the browser, and keep identifiers anonymous. Cookieless, first-party tracking helps here, because it avoids collecting personal identifiers in the first place. Cromojo's First-party Tracking is built that way.

Where server error monitoring fits

Searches for JavaScript error tracking often sit next to searches for server error monitoring, and the two are easy to blur. They answer different questions.

JavaScript (client-side) errors Server errors
Where it happens In the visitor’s browser On your host, application or a service behind it
What the visitor sees A broken button, blank section or frozen form An error page, a timeout or a missing page
How you find out Reports sent from the page Status codes, logs and uptime checks
Typical cause Script bugs, third-party code, browser differences Overload, crashes, bad deploys, upstream failures

Server errors are the 5xx status codes. MDN's status code reference describes 500 as a generic "the server hit a situation it cannot handle", 502 as a bad response from an upstream server, 503 as a server not ready to handle the request (for example during maintenance or overload) and 504 as a gateway that did not get a response in time.

The two connect more than they seem to. A 503 from your cart API can surface in the browser as an unhandled promise rejection. A bad deploy can cause both at once. If you watch only one side, you will chase the wrong cause. Watching both, against the same pages and the same funnel steps, tells you quickly whether the fault is in the code that ran in the browser or in the service it called.

From error list to revenue priority

The error list in a developer tool is sorted by count. A business owner needs it sorted by damage. Here is a routine that gets there.

  1. Group errors by page and by funnel step. An error on a blog post and an error on the payment step are not the same problem, even if each fires equally often.
  2. Count affected sessions, not events. This removes loops and bots from the picture.
  3. Compare affected sessions with converting sessions. If visitors who hit an error convert far less than those who did not, you have found a fix worth paying for.
  4. Fix by impact. Checkout and sign-up first, then landing pages that carry paid traffic, then everything else.
  5. Confirm the fix. After a release, check that the error stops appearing and that conversion on that step recovers.

This is where an analytics platform earns its place beside an error tracker. Funnels show where visitors drop, Session Replay lets you watch what a visitor did before they left, and Custom Events let you record the moments you care about, such as a failed payment attempt. With Revenue Analytics, connected to Stripe and Shopify, you can put a dollar figure on the traffic and pages involved.

A worked example

Suppose your store gets 8,000 product page sessions in a week and your add-to-cart rate is 6%. A script error on one browser stops the cart button on a product template. Your monitoring shows 300 affected sessions, with almost no add-to-cart actions among them, against roughly 6 in 100 for everyone else.

Normally those 300 sessions would produce around 18 carts. At that gap you lose most of them every week until the error is fixed. Multiply by your average order value and checkout rate and you have a figure to put against the fix. The numbers are illustrative, but the logic is the one to apply to your own data: affected sessions, normal conversion rate, value per conversion.

Affected sessions and estimated lost carts

Alerting without alert fatigue

The fastest way to make a team ignore monitoring is to alert on every new error. Browsers throw harmless errors constantly, from extensions and bots that you cannot control.

Google's SRE team offers a useful model in its workbook chapter on alerting on SLOs. For a 99.9% target, it recommends paging when the error budget burns very quickly (14.4 times the sustainable rate over one hour, which consumes 2% of the budget), raising a lower-urgency alert at a slower burn, and opening a ticket for a slow leak. It pairs each long window with a short one, so the alert clears within minutes once the problem is fixed.

You do not need a formal SLO to borrow the idea. A practical small-business version:

  • Page someone when errors on checkout, cart or sign-up spike sharply and persist.
  • Send an email when a new error appears on a high-traffic page or affects a meaningful share of sessions.
  • Review weekly the slow-burning errors that never cross a threshold but add up.

Scheduled email summaries cover the third category well, since nobody needs an interruption for something that can wait for Monday.

Perspective

Most error tooling is built by developers for developers. It answers "what broke?" very well and "what did it cost?" hardly at all. For an owner or a marketer, that second question is the one that decides whether a fix happens this week or next quarter.

That is why we put monitoring in the same place as revenue. Cromojo is designed around revenue-first analytics: traffic, funnels, goals and Stripe and Shopify revenue, together with website monitoring for downtime, errors and SEO health. When an error sits on the same screen as the conversion step it affects, you do not need a data analyst to tell you what to fix first.

Our approach is also cookieless and privacy-friendly, with minimal setup on any tech stack. You should not have to choose between understanding your site and respecting your visitors, and you should not need a second and third tool just to see what is going wrong.

See errors next to revenue

If you run a store, a SaaS site or client sites for an agency, you probably want one place that shows what visitors do, what they spend and when something breaks. Cromojo combines real-time analytics, revenue attribution by keyword, page and channel, conversion funnels, goal tracking and Website Monitoring in one platform. Its Smart Insights use agents that continuously watch performance and point out specific issues and opportunities.

Cromojo

Plans start at $19 per month for Starter, then $49 for Pro, $129 for Business and $299 for Agency, billed by pageviews and number of tracked sites, with overages per 1,000 additional pageviews. A Free Plan is also available. See the pricing page for what each tier includes.

Sources

‌

Frequently asked questions

How do I track JavaScript errors on my website?

Add listeners for the window error event and the unhandledrejection event, and send what they capture (message, page, browser and stack) to a place you can review. Most teams use a monitoring platform that does this with a short script, and report handled errors from try/catch blocks as custom events so they are counted too.

What is the difference between JavaScript errors and server errors?

JavaScript errors happen in the visitor's browser while the page runs, and your server never sees them. Server errors are 5xx responses produced on your side or by a service behind it. A failing server response can trigger a browser error, so it helps to look at both for the same page.

Which JavaScript errors should I fix first?

Start with errors on checkout, cart and sign-up pages, then on landing pages that receive paid or organic traffic. Rank by the number of affected sessions and by how much conversion drops for those sessions, not by raw event counts.

Do I need source maps?

If your code is minified, yes. Without them, stack traces point to unreadable lines. Upload maps to your monitoring tool during the build and keep them off public servers so your source code is not exposed.