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 ?? '',
}); apiKey is enough. Optional release should come from
package.json — see SDK → Release.
| Option | Default | Notes |
|---|---|---|
apiKey | - | Required. |
environment | - | Attached to every error (for example production). |
enabled | true | false pauses sending. |
Auto-capture
init registers window listeners for error and
unhandledrejection. Uncaught throws and rejected promises are reported automatically.
Error
throw or rejection
Handler
SDK listener
Payload
stack, url, context
Dashboard
issue
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 ingest calls 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.