JavaScript error tracking

JavaScript error tracking for real users' browsers

Most frontend errors happen on devices you'll never see. @errorlenshq/browser reports them with the clicks, requests and navigation that led there — and source maps turn minified traces back into your code.

Install with npm or a script tag

npm install @errorlenshq/browser
import * as ErrorLens from "@errorlenshq/browser";

ErrorLens.init({
  dsn: "https://<key>@errorlens.io/<project-id>",
  release: "[email protected]",
  tracesSampleRate: 0.1,
});
Without a bundler
<script src="https://cdn.jsdelivr.net/npm/@errorlenshq/browser@1/dist/errorlens.min.js" crossorigin="anonymous"></script>
<script>ErrorLens.init({ dsn: "https://<key>@errorlens.io/<project-id>" });</script>

What is captured

  • Uncaught errors and unhandled promise rejections
  • Breadcrumbs: clicks with a readable element path, fetch/XHR calls, navigation and console output
  • Page-load and route-change transactions with network timing and web vitals (LCP, FCP, CLS)
  • A traceparent header on same-origin requests, so frontend and backend share one trace
  • Noise dropped: browser-extension errors, cross-origin “Script error.” and ResizeObserver warnings

Readable stack traces with source maps

Upload your source maps for each release from CI and ErrorLens shows the original file, line and code instead of main.4f2a.js:1:120554. See releases and source maps.

Reliable delivery

Reports are sent with fetch keepalive and flushed when the tab is hidden, so an error right before the user navigates away still arrives. Requests are CORS “simple” requests: no preflight round trip.

Frequently asked questions

Is the DSN safe to put in frontend code?

Yes. The DSN's key can only send data to its project; it can't read anything.

Does it work with React, Vue, Angular and Svelte?

Yes, it works with any framework. See the React and Next.js guides for error boundaries and server-side setup.

Will ad blockers block it?

Self-hosting on your own domain avoids most blocklists. On the hosted service, allow errorlens.io in your Content-Security-Policy connect-src.

Start tracking errors in minutes

Free hosted plan with 5,000 errors a month, or self-host with no limits. No credit card.