Quick start
From npm install to your first replay in about five minutes. You'll need a workspace and the project key from Settings → Projects.
1. Install the SDK
Add the browser package with your package manager of choice.
npm install @tracebase/browser2. Initialize once
Call Tracebase.initas early as possible in your app's lifecycle — before your framework mounts, ideally.
import { Tracebase } from "@tracebase/browser";
Tracebase.init({
projectKey: "tb_live_your_project_key",
environment: "production",
});That's the whole integration. The SDK now records navigation, interactions, console output and uncaught errors. New sessions show up in your workspace within seconds.
No build step? Use the script tag
PHP, WordPress, Rails or plain HTML — drop the standalone bundle (12 kB) before </head> and initialize the global. No bundler, no framework, same capture.
<script src="/js/tracebase.min.js"></script>
<script>
Tracebase.init({ projectKey: "tb_live_your_project_key" });
</script>3. Identify signed-in users
After authentication, attach a stable identifier so you can search sessions by user. Keep sensitive values out of user properties.
Tracebase.identify("user_8f31a", {
email: "d.moreau@example.com",
plan: "team",
});Privacy rules
Every input is masked by default. Add selectors for anything else that should be masked or blocked entirely before capture.
Tracebase.init({
projectKey: "tb_live_your_project_key",
privacy: {
maskAllInputs: true,
maskTextSelectors: [".customer-name"],
blockSelectors: [".payment-form", "[data-private]"],
},
});Sampling
Record a slice of routine traffic while always keeping the sessions that matter. Sampling decisions are made at session start.
Tracebase.init({
projectKey: "tb_live_your_project_key",
sampleRate: 0.25,
alwaysCaptureOnError: true,
});Error capture
Uncaught exceptions and unhandled rejections are captured automatically. Report handled errors when they matter.
try {
await submitPayment();
} catch (error) {
Tracebase.captureException(error, { area: "checkout" });
}Stuck on something? Ask us directly.