Mendloop Docs Request access

Browser SDK

Install @mendloop/browser from npm or with a script tag, and choose what it captures.

@mendloop/browser has no dependencies and is about 8 KB gzipped. It speaks the Sentry envelope format, so the same DSN also works with any Sentry SDK.

Install from npm#

TerminalShell
pnpm add @mendloop/browser
app.tsTypeScript
import * as Mendloop from "@mendloop/browser";

Mendloop.init({
  dsn: "https://pk_live_xxx@ingest.getmendloop.com/42",
  environment: "production",
  release: "web@1.8.2",   // match the release you upload source maps for
});

Mendloop.setUser({ id: user.id });   // hashed at ingest
Mendloop.setTag("plan", "pro");
Mendloop.captureException(err);

Call init as early as possible when your app loads, so errors during start-up are caught too.

Or with a script tag#

No build step:

index.htmlHTML
<script
  src="https://unpkg.com/@mendloop/browser@0.1.0/dist/mendloop.min.js"
  data-dsn="https://pk_live_xxx@ingest.getmendloop.com/42"
  data-env="production"
  data-release="web@1.8.2"
  crossorigin="anonymous"></script>

Captured automatically#

  • Uncaught errors
  • Unhandled promise rejections
  • console.error
  • Failed fetch and XHR calls (5xx and network errors)
  • Breadcrumbs for clicks, navigation and requests

Options#

Option Default What it does
dsn Where to send events. Required.
environment, release Sent with every event. Use one project with several environments rather than a project per environment.
sampleRate 1 Fraction of events to send.
beforeSend Change an event, or return null to drop it.
ignoreErrors [] Strings or regexes for errors to ignore.
maskSelectors [] Extra elements whose text is never recorded.
enabled true false turns every call into a no-op, for local development.
Tip:

Set release to the same value you pass to --release when you upload source maps, and include the commit if you can (web@1.8.2+3f9c2ab). Root-cause analysis reads the code at that commit.

Privacy in the browser#

Input values are never read, sensitive URL parameters and headers are filtered, and tokens, JWTs and card numbers are masked before anything leaves the page. Ingest scrubs and hashes again: user ids, emails and IPs are stored as keyed hashes, never in the clear. See Security and privacy.

Rate limits and retries#

When a project goes over its event limit, ingest answers 429 with Retry-After. The SDK pauses and retries on its own, and duplicates (the same event_id within an hour) are dropped, so retries are safe. See Limits.