Skip to content

The CDN script tag from Quickstart self-initializes — most of what it needs is already baked into the bundle it's served from, and the rest comes from a small set of data-* attributes on the tag itself. Calling init() yourself only matters when you need an option that has no attribute.

The tag's data-* attributes ​

html
<script
    src="https://app.buglapse.com/cdn/{project-token}/buglapse.min.js"
    data-environment="production"
    data-release="1.4.2"
    data-debug="true"
    async
></script>
  • data-environment — stamped as contexts.environment on every event. Powers the environment dropdown/filter and environment: search token on the dashboard's list pages, and the "discard by value" inbound filter, which silently drops events from listed environments before they're stored.
  • data-release — stamped as contexts.release on exceptions only. Only matters if you upload source maps for this build — see Source maps — it's what lets the dashboard match a minified stack frame back to the map for the same release.
  • data-debug — set to "true" to log what the SDK is doing ([Buglapse] ...) to the console: client init, export attempts, dropped/failed batches. Leave it off in production.
  • data-dsn — the project's DSN. Not needed with the /cdn/{project-token}/buglapse.min.js embed: the bundle served from there already carries the DSN. Set it only if you self-host a copy of the static bundle — without a DSN from either source, auto-init doesn't run.

Calling init() yourself ​

Reach for this only if you're not using the /cdn/{project-token}/... embed (e.g. a self-hosted copy of the bundle without data-dsn, so auto-init has nothing to key off and never runs), or you need an option below that isn't exposed as a tag attribute — a custom transport, transportOptions, or an upfront integrations list:

ts
Buglapse.init({
    dsn: '{dsn}',
    environment: 'production',
    release: '1.4.2',
    debug: true,
})

Don't call this a second time on top of a tag that already auto-initialized — it replaces the client outright, dropping anything queued on the old one.

Full option reference ​

  • dsn — the project's DSN, https://{key}@{host}, from Settings → General. Required unless you pass your own transport. The default transport posts to {host}/api/envelope and sends the key in an X-Buglapse-Auth header. A missing or malformed DSN doesn't throw: the SDK logs one [Buglapse] Missing or invalid "dsn" warning and drops events.
  • environment / release — see above.
  • debug — verbose console logging, same as data-debug.
  • transport — a transport factory (Sentry-style: (options) => Transport) that replaces the default makeFetchTransport, e.g. makeConsoleTransport for local dev. See Transports.
  • transportOptions — tunes the default fetch transport: onError, maxBatchSize, flushInterval, immediateTypes, timeout, retries. Ignored by a custom transport. Also covered in Transports.
  • integrations — Sentry-style upfront list (init({ integrations: [...] })), merged with the platform defaults by name — an entry here sharing a default's name replaces it. use() / disable() remain the way to add or remove one after the fact. See Integrations.
  • resolveTraceId — supplies the trace id a root span/asyncSpan joins when no trace is already active. The browser's init() already wires this to an id that rotates per pageload/SPA navigation, so every root operation during one page view joins one trace; only override it for a custom grouping. See Tracing, Spans & Metrics.
  • tracesSampleRate — chance (0–1) that a trace is sent, like Sentry's option of the same name. Default 1. Rolled once per trace, so a trace arrives with all its spans or not at all. With the CDN embed it comes from Settings → Loader Script instead. See Tracing → Sampling.
  • storage — a Node-specific concurrency concern (@buglapse/node's init() wires in an AsyncLocalStorage-backed one automatically); nothing to configure here in the browser.

Settings → Loader Script vs. this config ​

Everything above lives in your own embed code — nothing here is editable from the dashboard. Separately, the project's Settings → Loader Script tab controls two different things server-side:

  • Integration toggles (console capture, device context, hit counter, dedupe, inbound filters, session replay, ...), each integration's options (breadcrumb sources, inbound filter patterns, HTTP error status threshold, tracing timeouts, replay masking, ...), the replay sample rates and the traces sample rate are baked into the bundle itself on every request (GET /cdn/{token}/buglapse.min.js), so flipping one takes effect on your site's next page load with no change to your snippet. See Integrations. Options that take a function (e.g. browser tracing's beforeStartSpan) can't be set there — register that integration from your own code instead. Inbound filter patterns written as /source/flags are turned into regular expressions; anything else is a substring match.
  • The Environment, Release, and Debug mode fields on that same tab aren't persisted — they only shape the copy-pasteable snippet shown there, as a convenience. The values that actually apply are whatever ends up in your data-* attributes or init() call.