Skip to content

Buglapse's browser SDK captures errors, logs, traces, metrics, and (optionally) session replay in the page. Your project is identified by its DSN (https://{key}@{host}) — find it on the project's Settings → General tab; the ready-made script-tag snippet is on Settings → Loader Script.

Install ​

Nothing to build — one script tag, served fresh per request from this dashboard with your project's current Settings → Loader Script toggles already baked in:

html
<script src="https://app.buglapse.com/cdn/{project-token}/buglapse.min.js" async></script>

It self-initializes on load: the bundle served from that URL already carries the project's DSN, so there's nothing else to pass. Two optional attributes fill in commonly-set config directly from the tag:

html
<script
    src="https://app.buglapse.com/cdn/{project-token}/buglapse.min.js"
    data-environment="production"
    data-release="1.4.2"
    async
></script>

Everything past automatic error capture — console capture, device context, the hit counter, session replay, dedupe, inbound filters, and more — is toggled on Settings → Loader Script, not in this snippet. A toggle you flip there takes effect the next time this script loads on your site, with no redeploy and no change to the tag itself.

npm package ​

Until the SDK is published to the public npm registry, @buglapse/* packages are served by Buglapse itself. Point the scope at it once, in an .npmrc next to your package.json:

ini
@buglapse:registry=https://app.buglapse.com/npm/

Then install as usual — npm update picks up new versions like any other dependency:

bash
npm install @buglapse/browser
ts
import { init } from '@buglapse/browser'

init({
    dsn: '{dsn}',
})

Both install paths expose the same API. The script tag gives you a global Buglapse object (Buglapse.captureException(error), Buglapse.log.info(...), ...); the npm package exposes the identical methods as named exports (captureException(error), log.info(...), ...) — every example below works with either, substituting Buglapse. for the matching import.

What you get out of the box ​

Right after init() (or as soon as the script tag loads), unhandled errors are already being captured — uncaught exceptions and unhandled promise rejections, with no further setup. Nothing else is enabled yet: console capture, device context, the hit counter, session replay, and the rest are opt-in built-ins you turn on as needed — see Integrations.

Your first manual event ​

Automatic capture covers uncaught errors; report a caught one, or attach a breadcrumb leading up to it, with:

ts
Buglapse.addBreadcrumb({ type: 'ui.click', level: 'info', message: 'Clicked "Pay" button' })

try {
    await pay()
} catch (error) {
    Buglapse.captureException(error)
}

Open the project's Exceptions page and it should show up within a few seconds.