Skip to main content
Telemetry is in early access. To turn it on for your workspace, book a call or ask in Discord.
The Superlog browser SDK sends errors, sessions, traces, and Web Vitals as standard OpenTelemetry over OTLP/HTTP. It has three packages:
  • @superlog/browser: error capture, breadcrumbs, user and attributes, sessions, fetch and XMLHttpRequest tracing, navigations, and Web Vitals.
  • @superlog/react: an error boundary, React 19 root error handlers, and route patterns from React Router.
  • @superlog/sourcemaps: a Vite plugin and a CLI that upload your source maps, so errors show and group by the original code.
The source is at github.com/superloglabs/browser.

Install

Create an ingest key

The SDK sends to Superlog with an ingest key. Create one for the app. See Create an ingest key. The key ships in your page’s JavaScript, so anyone who loads the page can read it. An ingest key can only add telemetry to your workspace. It can’t read data or change settings. Use a separate key for each app, so you can revoke one without affecting the others.

Start the SDK

Call init before the app renders. The SDK sends to https://superlog.sh/api/ingest by default. For a workspace in the US region, set endpoint to https://us.superlog.sh/api/ingest. The SDK adds /v1/logs and /v1/traces to it.
  • service is sent as service.name, release as service.version, and environment as deployment.environment.name.
  • ignoreUrls keeps requests, such as analytics, out of traces and breadcrumbs.
  • tracesSampleRate keeps a share of traces, from 0 to 1. Errors are always sent.
  • beforeSend can change or drop any error, and beforeBreadcrumb any breadcrumb.

React

Add the error handlers to your root and instrument the router so errors carry the route pattern:
With declarative routes, use SuperlogRoutes in place of <Routes>:
@superlog/react needs React 18 or later, and React Router 6.4 or later for the router integration.

Capture errors yourself

Upload source maps

Source maps let Superlog map minified stack frames back to the original file, line, and function before it groups errors. Uploads use a workspace API key from Settings → API keys, not the ingest key. With Vite, add the plugin:
vite.config.ts
The plugin builds hidden source maps, writes a debug ID into each file and its map, uploads the maps with SUPERLOG_API_KEY, and deletes them from the output. A failed upload is printed and the build still succeeds. Set failOnError: true to fail the build instead. For other bundlers, run the CLI on the build output:
Uploads go to https://superlog.sh. For a workspace in the US region, pass url: "https://us.superlog.sh" to the plugin, or --url https://us.superlog.sh to the CLI.

What gets captured

Each error is an OpenTelemetry log record at ERROR severity, so it appears in Errors and Logs. It carries: The SDK also sends:
  • Spans for fetch and XMLHttpRequest calls, which appear in Traces.
  • Logs for page loads and navigations, page load timing, and Web Vitals (LCP, INP, CLS, FCP, and TTFB).
These errors are dropped before sending:
  • Script error. without details, and the ResizeObserver loop notice.
  • Errors whose frames all come from browser extensions or from denyUrls.
  • Errors that match ignoreErrors.
  • The same error repeated within a second.
  • Errors past 30 per minute. Change this with maxErrorsPerMinute.