Documentation

Browser

Hooks into window, fills url and userAgent from the page, records fetch and XHR as breadcrumbs. Call init before your app mounts.

Initialize

import { init } from '@retrace-kit/sdk';

init({
  apiKey: import.meta.env.VITE_RETRACE_KIT_API_KEY ?? '',
  endpoint: '/api/error-events',
  release: '1.4.2',
  environment: 'production',
});
Option Default Notes
apiKey - Required.
endpoint https://api.retracekit.cloud/api/error-events Relative paths resolve against the page origin (handy with a dev proxy).
release, environment - Attached to every error.
enabled true false pauses sending.

Auto-capture

init registers window listeners for error and unhandledrejection. Uncaught throws and rejected promises are reported automatically.

Broken <img> / <script> tags without a JS exception are skipped — see Capture. Handled errors need captureException.

Page metadata

Each event gets url from window.location.href and userAgent from navigator.userAgent. The dashboard groups them under Affected sources (Chrome, Firefox, Safari, …).

Network

fetch and XMLHttpRequest are patched after init. Requests become breadcrumbs on the next error. SDK calls to /api/error-events and /api/sessions are excluded. Details: SDK → Breadcrumbs.

Sessions live in localStorage (retracekit_session_id) and power EFU — Session / SDK.

Script tag

<script src="https://unpkg.com/@retrace-kit/sdk/dist/umd/index.js"></script>
<script>
  RetraceKit.init({ apiKey: 'your-project-api-key' });
</script>

Global: RetraceKit.init, captureException, addBreadcrumb, setUser, setTag.

Limitations

  • SSR — no window during render; hooks attach after hydration. Use Node.js on the server, or see Next.js.
  • Cross-origin scripts — stacks may be hidden by the browser without CORS.
  • Blocked storage — session falls back to in-memory for that page load.