Monitoring

Browser SDK

A small script for websites and single-page apps, at `sillydev/monitoring/browser`. It sets no cookies and records no IP addresses or user identifiers.

← Monitoring docsUpdated

Browse the docs

Set up

Make a browser key (it starts with sdevb_) on the project's Settings tab and add your website under Allowed origins. Then call init() with the key when the page loads. A browser key is safe to put in your page source; a server key is not.

JavaScript

import { init } from 'sillydev/monitoring/browser';

init({
    key: 'sdevb_1_…',
    service: 'website',
    release: '2026.10.1',
    sampleRate: 1,
});

What it records

Uncaught errors and unhandled promise rejections, page views (including navigations in a single-page app), and the Core Web Vitals: largest contentful paint, interaction to next paint, cumulative layout shift, time to first byte and first contentful paint. Each is tagged with the page's path, with ids replaced by :id and never the query string.

Turn any of these off with captureErrors: false, pageViews: false or webVitals: false. sampleRate is the share of errors and events sent. You can also record your own with increment, timing, event, captureException and captureMessage, imported from the same module; metric names from a browser must start with browser..

Data is sent in the background with navigator.sendBeacon, a few seconds after it is recorded and when the page is hidden, so it does not slow the page down.

Read next