# Browser SDK

Observe client errors, requests, performance, and user sessions in a JavaScript app.


JavaScript frameworks and runtimes: Next.js, React, Vue, Svelte, Node.js, NestJS, Cloudflare; repository integration through GitHub.

## Install

```bash
npm install @everock/sdk@beta
```

Use the generic browser entry when you do not need the Next.js or Vite adapter. It runs in JavaScript browser applications; it is not a native Swift or Kotlin SDK.

```ts title="instrument-client.ts"
import { init, captureError, identify } from '@everock/sdk';
init({
  publicKey: 'pk_YOUR_PROJECT_KEY',
  endpoint: 'https://collector.example.com',
  environment: 'production',
  release: 'build-2026-11-10',
  component: 'web',
  serviceName: 'Web app',
});
identify({ id: 'user_123' });
captureError(new Error('An example handled failure'), { handled: true });
```

## Automatic capture

The browser entry captures unhandled errors and rejections. Request capture measures supported fetch and XMLHttpRequest traffic; performance capture reports supported web vitals and runtime performance signals. Request URLs are redacted before transmission.

Additional console logs, page events, rage clicks, and replay depend on the project's Browser SDK settings. Replay also requires local opt-in and visitor consent. A setting does not invent historical data.

## Custom events

```ts title="Application event"
import { capture, flush, identify } from '@everock/sdk';
capture('log', 'Checkout opened', { step: 'payment' });
identify(null); // Clear identity at logout.
await flush();
```

Use a stable application identifier, not a password or access token. Browser sessions and durable storage are bounded and subject to the browser's storage availability.

See [privacy](/docs/features/privacy), [replay](/docs/features/session-replay), and [delivery diagnostics](/docs/features/reliability).
