JavaScript API
Three functions. Available as ESM exports from @tracebird/web or on window.Tracebird when loaded via script tag.
init(options)
Installs the capture layer (console, network, errors, navigation), mounts the widget, and resumes an in-flight test session after a page load. Idempotent — calling it twice is a no-op.
init(options: {
projectKey: string; // required
endpoint?: string; // default: https://api.tracebird.dev
environment?: string;
release?: string;
tester?: string;
}): voidSee Configuration for what each option does.
startSession()
startSession(): Promise<TestSession>Begins a test session: loads the recorder chunk, starts the rrweb stream and the click journey, shows the REC badge. Resolves once recording is live. Calling it during an active session returns the existing session.
endSession()
endSession(): voidStops recording and discards the session state (including the cross-page storage). You rarely need it — sending a report ends the session automatically.
Loading behavior
The SDK is split so your app only pays for what testers use:
| option | type | default | description |
|---|---|---|---|
| core | on load | ~11 KB gz | init, capture buffers, widget shell. Loads async, never blocks rendering. |
| recorder | on session start | ~82 KB gz | rrweb — fetched the first time a test session starts. |
| editor | on capture | ~8 KB gz | Rasterizer + annotation editor — fetched on “Capture & annotate”. |
| snapshot | on send | ~24 KB gz | DOM snapshot serializer + compression — fetched when a report is sent. |
tracebird.js — when self-hosting the SDK, serve the whole dist/ folder from the same directory.