npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arguslog/sdk-browser

v1.1.3

Published

Arguslog browser SDK — error tracking for vanilla JS/TS apps

Readme

@arguslog/sdk-browser

npm version license

Browser SDK for Arguslog — a multi-tenant error tracking platform. Captures unhandled exceptions, promise rejections, and manually-reported errors from any JavaScript app, then ships them to the Arguslog ingest endpoint where they're fingerprinted, stored, and surfaced on the dashboard.

Ships ESM only. Tested against modern browsers and TypeScript 5.x. No runtime dependencies.

Install

pnpm add @arguslog/sdk-browser
# or
npm install @arguslog/sdk-browser
# or
yarn add @arguslog/sdk-browser

Quick start

Initialize once at the top of your app — typically in main.ts or wherever your bootstrap lives. The SDK is a no-op until init runs, so it's safe to import in modules that load before bootstrap.

import { init } from '@arguslog/sdk-browser';

init({
  dsn: 'arguslog://<publicKey>@<ingestHost>/api/<projectId>',
  environment: 'production',
  release: '1.4.0',
  integrations: ['globalHandlers', 'autoBreadcrumbs'],
});

After init, unhandled window.onerror and unhandledrejection events are captured automatically (when the globalHandlers integration is enabled). The autoBreadcrumbs flag turns on every breadcrumb integration the SDK ships (console, fetch, xhr, history, dom, resourceErrors, webVitals, longTasks, visibility, workerErrors) so the dashboard timeline carries the trail of clicks, network calls (including 4xx/5xx response body previews), route changes, resource load failures, Core Web Vitals, main-thread freezes, page visibility transitions and worker errors leading up to the exception. Every event also picks up an auto-context bag with viewport, online status, locale, timezone, color scheme and effective connection type. Manual reporting is always available via captureException / captureMessage.

DSN format

arguslog://<publicKey>@<ingestHost>/api/<projectId>

Get yours from your Arguslog project settings page. The publicKey is safe to embed in a public bundle — it's a project-scoped token, not a secret. Ingest authenticates the request against the project ID + key combo and rejects unknown pairs with HTTP 401.

API

init(options): ArguslogClient

Configures and starts the client. Re-initializing tears down the previous handlers cleanly, so hot-reload during dev doesn't accumulate stale listeners.

| Option | Type | Default | Notes | | ---------------- | ------------------------------------------------- | ------------ | --------------------------------------------------------------------- | | dsn | string | required | See "DSN format" above. | | release | string | none | Free-form version tag — git sha, semver, etc. Stamped on every event. | | environment | string | none | E.g. production, staging, dev. | | sampleRate | number 0–1 | 1.0 | Fraction of events kept; useful for high-traffic apps. | | maxBreadcrumbs | number | 50 | Ring-buffer size. | | beforeSend | (event) => event \| null \| Promise<...> | identity | Last-mile mutation / drop hook. | | scrubbing | { enabled?: boolean; extraPatterns?: RegExp[] } | enabled | PII redaction in messages and URLs. | | transport | { fetch?: typeof fetch; maxRetries?: number } | global fetch | Inject a custom fetch (testing) or bump retry budget. | | integrations | IntegrationId[] (see below) | none | Opt in to auto-instrumentation. 'autoBreadcrumbs' is a meta-flag that turns on every breadcrumb integration. | | debug | boolean | false | Logs every send to the console — never enable in production. |

captureException(error, hint?): string | undefined

Reports a thrown value. Returns the generated event id, or undefined if the SDK isn't initialized. The hint lets you tag the event without mutating client-wide state.

import { captureException } from '@arguslog/sdk-browser';

try {
  riskyThing();
} catch (err) {
  captureException(err, { level: 'error', tags: { feature: 'checkout' } });
}

Non-Error values (strings, plain objects, symbols) are wrapped synthetically so you don't have to coerce upstream.

captureMessage(message, level?): string | undefined

Sends a string event without a stack trace. Useful for breadcrumb-level signals.

captureMessage('Cart abandoned at step 3', 'warning');

setUser(user | undefined)

Attaches user identity to subsequent events. Pass undefined to clear (e.g. on logout).

setUser({ id: '42', email: '[email protected]' });
// later
setUser(undefined);

setTag(key, value) / setContext(name, ctx)

setTag adds a single key/value to every event going forward; setContext attaches an arbitrary object under a named bucket (think "request", "feature flags", etc.).

addBreadcrumb(crumb)

Records a navigation / click / network / custom event. The last maxBreadcrumbs are attached to every captured exception, so debugging gets the trail leading up to the error.

addBreadcrumb({
  category: 'navigation',
  message: 'User clicked Buy',
  level: 'info',
  data: { sku: 'A-123' },
});

flush(): Promise<void>

Awaits the in-flight queue. Useful before window.unload or in service workers.

Integrations

Every integration is opt-in via the integrations array, returns a no-op when window is not defined (SSR), and installs an uninstaller that runs on the next init so hot-reload during dev never accumulates duplicate listeners. Pass 'autoBreadcrumbs' to turn on every breadcrumb integration in one go, or list them individually.

init({
  dsn: '...',
  integrations: [
    'globalHandlers',
    'autoBreadcrumbs',
    // …or pick à la carte:
    // 'console', 'fetch', 'xhr', 'history', 'dom',
    // 'resourceErrors', 'webVitals',
    // 'longTasks', 'visibility', 'workerErrors',
  ],
});

| ID | Captures | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | globalHandlers | window.onerror + unhandledrejection. The "actual error capture" integration — without it nothing reaches captureException automatically. | | console | Every console.log/info/warn/error/debug becomes a breadcrumb. The original console call is preserved. Levels map to info/info/warning/error/debug. | | fetch | Patches window.fetch. Every request leaves a breadcrumb with method, URL, status, duration. 2xx → info, 4xx → warning, 5xx → error. Network failures are recorded and re-thrown. For 4xx/5xx with a JSON / text content type, the first 4KB of the response body is captured into data.responsePreview so error messages from your own backend show up next to the status. Body is read via response.clone() so user code's await response.json() still works. | | xhr | Same payload shape as fetch but for legacy XMLHttpRequest traffic (jQuery AJAX, axios's xhr adapter, hand-rolled XHR). Same 4KB response preview on 4xx/5xx when responseType is '' or 'text'. | | history | Patches history.pushState / replaceState and listens for popstate / hashchange. Single-page-app routers leave a navigation trail (/start → /billing). | | resourceErrors | <img>, <script>, <link>, <audio>, <video>, <iframe> load failures. These never reach window.onerror — common cause of "image silently missing" / "ad blocker killed third-party script" bugs. | | webVitals | Core Web Vitals as breadcrumbs (LCP / INP / CLS / FCP / TTFB) via the web-vitals library. Poor ratings show as warning so a slow LCP next to a crash is visible at a glance. | | dom | Document-level capture-phase listeners for click and submit. Only interactive targets are recorded (<button>, <a>, <input>, <select>, <textarea>, <label>, [role=button \| link \| checkbox \| menuitem], [data-arguslog-track]). The closest interactive ancestor of the click target is used so a click on a <span> inside a <button> reports the button. | | longTasks | PerformanceObserver for longtask entries — main thread blocked >50ms. 50–200ms → info, 200–500ms → warning, 500ms+ → error. Reveals "the UI froze right before the click stopped responding" patterns. Source attribution (containerType / containerSrc) is included where Chromium supplies it. | | visibility | visibilitychange, pagehide, online, offline events. Distinguishes "error fired while user was on another tab" from "error fired during interaction" — different debugging stories. | | workerErrors | Forwards Web Worker + Service Worker errors into the main-thread client. Patches the global Worker constructor to attach an error listener on every new instance; service workers can also opt in by postMessage({ __arguslog: 'error', message, stack }). | | autoBreadcrumbs | Convenience meta-flag — turns on every breadcrumb integration (console, fetch, xhr, history, dom, resourceErrors, webVitals, longTasks, visibility, workerErrors). |

Customizing the DOM breadcrumb label

The dom integration auto-derives a label like button#pay.primary "Pay". Override with data-arguslog-label on any tracked element:

<button data-arguslog-label="Upgrade to Pro — annual">Upgrade <span>(save 33%)</span></button>

The breadcrumb message becomes exactly Upgrade to Pro — annual instead of an auto-derived selector.

Privacy / scrubbing

Built-in regex patterns redact common PII (emails, IPs, US-style SSNs, JWT-ish tokens) from message strings and URLs before send. Add custom patterns via scrubbing.extraPatterns: [/\bUSR-\d+\b/]. Disable entirely with scrubbing.enabled: false when you control the input shape and want full fidelity.

React?

Use @arguslog/sdk-react — it re-exports this SDK plus a <ArguslogErrorBoundary> and useArguslog() hook.

License

MIT — see LICENSE.