Get started
Install
Add the widget with a script tag, in React, or in a Next.js App Router app.
Use the snippet from your project page
The examples below have a placeholder key. The project page in the dashboard shows the same code with your real key and the right API address for your workspace.
Plain HTML
Add the script before </body> on every page that should show the button. It loads asynchronously and does not block your page.
Loading…React
Copy this component into your app and render it once, near the root. It adds the script a single time and keeps the signed-in user in sync. It has no dependencies.
Loading…<Showbug user={{ userId: currentUser.id, accountId: currentUser.orgId }} />An npm package, @showbug/react, with the same component isComing soon. Until it is published, copy the component above.
Next.js (App Router)
Load the script from the root layout with next/script, so it is on every route:
Loading…To identify the signed-in user, call window.Showbug?.identify() from a client component, or use the React component above in a "use client" file instead of the Script tag.
Identify your users
Tell Showbug who is signed in and each report carries it. Call this after the script has loaded, and again when the user changes. All three fields are optional strings.
window.Showbug?.identify({
userId: "u_123", // your id for the person
accountId: "acme", // the customer account they belong to
plan: "pro",
});- Values are cut to 200 characters. Other fields are dropped.
- Send ids, not names or email addresses, unless you want them stored with the report.
- On sign-out, call
identify({})to clear the user.
Content Security Policy
Sites without a Content Security Policy need no change. If yours sends one, allow these sources:
Loading…script-src: the loader, andsession.js, which the loader imports from the same place when a report starts.connect-src: the Showbug API, the voice agent (OpenAI Realtime) and the storage bucket that receives the recording.style-src 'unsafe-inline': the widget styles itself inside its own shadow root.- A
Permissions-Policyheader must not denydisplay-captureormicrophone.
Test the policy first
This list is derived from what the widget does, not tested against every policy. Ship it as Content-Security-Policy-Report-Only first and watch for violations.
How the widget behaves
- The button lives outside your app, in a closed shadow root at the bottom-right. Your CSS does not affect it and it survives client-side navigation.
- The loader is about 5 KB compressed. The recorder (about 90 KB compressed) downloads only when someone clicks Start.
- In-app route changes are recorded as part of the report. A full page load ends the report; what was recorded until then is kept.
- Load the script once per page. A second copy adds a second button.
Next: Configuration lists every attribute and prop.