JavaScript API

web

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.

signature
init(options: {
  projectKey: string;      // required
  endpoint?: string;       // default: https://api.tracebird.dev
  environment?: string;
  release?: string;
  tester?: string;
}): void

See Configuration for what each option does.

startSession()

signature
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()

signature
endSession(): void

Stops 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:

optiontypedefaultdescription
coreon load~11 KB gzinit, capture buffers, widget shell. Loads async, never blocks rendering.
recorderon session start~82 KB gzrrweb — fetched the first time a test session starts.
editoron capture~8 KB gzRasterizer + annotation editor — fetched on “Capture & annotate”.
snapshoton send~24 KB gzDOM snapshot serializer + compression — fetched when a report is sent.
noteChunks resolve relative to tracebird.js — when self-hosting the SDK, serve the whole dist/ folder from the same directory.