SDK guides

Web SDK

@fixback/sdk is a self-isolating on-page feedback widget. It mounts a launcher only when a submission would be accepted, isolates its styles in a Shadow DOM, and — if Fixback can't be reached — stays completely silent. It never throws into your page.
  • MIT-licensed, and one self-contained file: its dependencies — the shared core and rrweb's recorder for session replay — are bundled in, so a script tag needs nothing else.
  • Isolated styles — the launcher and overlay each live in a Shadow DOM, so the host page's CSS can't reach in and the SDK's CSS can't leak out.
  • Private by default — the session replay masks every input and all page text inside the browser, as it records, so private text never leaves the page. The screenshot a report shows is rebuilt from that masked replay, not captured separately.
  • Two builds — an ESM entry for bundlers and a single minified <script> file for no-build sites.

Install

No build step — a script tag exposes a Fixback global from any npm CDN:

index.html
<script src="https://unpkg.com/@fixback/sdk@0.19.0/dist/fixback.umd.js"></script><script>  Fixback.init({ key: "pk_live_your_publishable_key" });</script>

The URL names an exact release, so a new SDK version reaches your site only when you change it — an unpinned URL would serve whatever was published last to every page that loads it.

With a bundler, import init. It returns a promise resolving to an instance with a destroy() method:

ts
import { init } from "@fixback/sdk";const fixback = await init({ key: "pk_live_…" });// later, to tear the launcher down:fixback.destroy();

Calling init again — React StrictMode, hot reloading, a re-rendered root — is safe: with the same key it resolves to the instance already running, so nothing is installed twice. See calling init more than once.

The launcher

The launcher is a Feedback pill in the bottom-right corner, and it stays out of the way:

  • Hover-peek & tuck-away — a chevron tucks it off-screen behind a small edge nub; hovering the corner (or the nub) peeks it back. This also covers pointers that can't hover — touch and keyboard.
  • Drag to a corner — the visitor can drag the pill to any screen corner, where it snaps and stays for that key; pass draggable: false to pin it.
  • First-visit welcome — a one-time toast greets a new visitor, once per publishable key per browser.
  • Reduce motion — pass reduceMotion: true to still the pulse and transitions; the launcher also honours the visitor's OS prefers-reduced-motion on its own.
  • Make it yours — position starts it in another corner when your page already uses bottom-right. text rewords its label, the panel's heading and placeholder, Send and the confirmation. The --fixback-* CSS properties and ::part() names restyle its colour, font and corners. See customizing the widget.

All of this chrome lives inside the launcher's Shadow DOM, so it never adds a global style or touches your markup.

The widget also works above a modal your page has open — a Radix Dialog or Sheet, which is what ShadCN's Dialog, Sheet, AlertDialog and Drawer are. A reporter can click, type, scroll and draw in it without the modal closing, stealing focus or freezing the panel.

The launch event

Activating the launcher opens the SDK's report overlay and dispatches a composed, bubbling fixback:launch event from the SDK's host element, so your page can react too:

ts
import { LAUNCH_EVENT } from "@fixback/sdk";document.addEventListener(LAUNCH_EVENT, () => {  // the report overlay is opening — react here if you need to});

Page shortcuts

⌥ ⇧ F opens the report panel from anywhere on the page, and ⌥ ⇧ E / ⌥ ⇧ S open it straight into picking an element or capturing a screenshot. For a Member who may record one, ⌥ ⇧ W starts a Walkthrough, during which P, C, Z and Esc pick, circle, remove the last mark and leave the tool. The Reporter turns every shortcut off with the panel's Page shortcuts switch; the full table is in the reference.

Automatic error capture

The SDK's signature capability: errors report themselves, with no prompt. Two handlers turn uncaught exceptions and unhandled promise rejections into Feedback (classified as a bug) for the current session — carrying the same masked replay (and the screenshot rebuilt from it) and Trace a manual report does. It's on by default; pass autoCapture: false to turn it off.

  • From the first line of your app. Capture starts the moment init runs, before Fixback has answered whether this visitor may report. An error thrown during the first render or while the page loads is kept, with the console and network lead-up before it, and sent once Fixback says yes. If Fixback says no, or can't be reached, it is discarded without being sent. Session replay starts once Fixback answers, so an error thrown before then carries the Trace but no replay.
  • Deduped & rate-limited. The same error collapses to one Feedback with a rising occurrence count; a burst limiter and per-session cap keep a runaway loop from flooding the queue, and auto-reporting backs off when Fixback asks it to slow down.
  • Nothing is lost to a busy or unreachable Fixback. When Fixback asks the SDK to slow down, every report and every repeat waits and goes when it says to. When it can't be reached, the SDK tries again a little later. Either way the error's first report still carries the Trace and the replay from the moment it was thrown.
  • Gated like a manual report, unless you capture errors from every visitor. By default auto-capture only runs where a submission would be accepted, so a public visitor's crash is tracked at their own tier — never auto-shipped. Set the environment's Capture errors from to Every visitor and visitors the Gate turns away have their errors captured too, with no launcher (see Environments). console.error is not promoted to a report; it stays breadcrumb-only Evidence.
  • Private by default. Every auto-report passes through the same beforeSend scrub choke point as a manual one.

An Issue the SDK filed this way reads Uncaught. One your app reported itself reads Captured.

Report errors you catch

Uncaught errors report themselves. An error your app catches never reaches the page's error handlers, so the SDK can't see it: an error boundary, React 19's onCaughtError, a router's errorElement, a data-fetching library's onError, or your own try / catch. Hand it to Fixback.captureException:

ts
import { Fixback } from "@fixback/sdk";try {  await placeOrder(cart);} catch (error) {  Fixback.captureException(error); // filed as "Captured", with the Trace and replay  showToast("We couldn't place your order");}

It's filed exactly as an uncaught error is: the same Trace and masked replay, the same dedup (a caught error and an uncaught one with the same fingerprint are one Issue), the same limits, and the same beforeSend and scrub. It's filed only where an uncaught error would be: an error reported before Fixback has answered is held until it does, and one from a visitor Fixback turns away is dropped. It never throws, even before init.

In a React app, use @fixback/react: its root error handlers and its error boundary file what a boundary caught with React's component stack, the part of the UI that was rendering when it was thrown.

React 19 root
import { createRoot } from "react-dom/client";import { init, rootErrorHandlers } from "@fixback/react";init({ key: "pk_live_…" });// React 19: every error React reports to the root, filed with its component stack.createRoot(document.getElementById("root")!, rootErrorHandlers()).render(<App />);

Elsewhere, call it where the error is caught:

TanStack Query
import { QueryCache, QueryClient } from "@tanstack/react-query";import { Fixback } from "@fixback/sdk";const queryClient = new QueryClient({  queryCache: new QueryCache({ onError: (error) => Fixback.captureException(error) }),});

Pass { handled: false } when the caught error stands in for a crash, as an error boundary's fallback does, and the Issue reads Uncaught. Reporting an error and then rethrowing it files it once.

For something that went wrong without an error to show for it, use Fixback.captureMessage. The message is filed under the name Message and grouped by its text, every number collapsed, so the same message from many visitors is one Issue. Its level is the level of the entry it leaves in the Issue's Trace.

ts
import { Fixback } from "@fixback/sdk";if (Date.now() - started > 8_000) {  Fixback.captureMessage("Checkout took longer than 8 seconds", { level: "warning" });}

An error's cause and an AggregateError's errors ride with it, whether the SDK caught it or your app reported it: the cause followed five deep, ten members of one aggregate, at most ten in all, each with its own name, message and stack frames, scrubbed like the error itself. The Issue shows them as Caused by sections under the error. The outer error leads, and the types behind it join its fingerprint.

Both are also methods on the instance init returns. With autoCapture: false they still file for a visitor who can report, but a visitor the Gate turns away runs no capture at all, so nothing is filed for them. See the reference for every option.

Grouping

Repeats of one error fold into one Issue with a rising count. An error's fingerprint is its type with the types behind it, and your own top frames — never node_modules, a library from a CDN, a bundler's runtime or a framework's files — by function and file, never by line, so an edit above the throw site keeps the Issue. An anonymous callback is known by the named function it is written in. The message counts only when the frames can't name where the error was thrown, with every number collapsed: User 42 not found and User 43 not found are one Issue.

Group your own way with fingerprint, on a capture or in beforeSend:

ts
// The usual grouping, split by tenant ("{{ default }}" is the fingerprint Fixback computed)Fixback.captureException(error, { fingerprint: ["{{ default }}", tenantId] });// Every outage of the payment provider is one Issue, wherever it was thrownFixback.captureException(error, { fingerprint: ["payment-provider-down"] });// Or decide in beforeSend, which sees a capture's fingerprint as report.fingerprintinit({  key: "pk_live_…",  beforeSend: (report) =>    report.errorName === "ChunkLoadError" ? { ...report, fingerprint: ["chunk-load"] } : report,});

Fingerprints changed in version 2 of these rules. An Issue filed before you upgrade keeps folding: the SDK also sends the old key, and Fixback moves the Issue onto the new one the first time it sees both.

Connect — reporting as yourself

A reporter is an Account. The overlay's identity chip shows "Anonymous · Sign in"; clicking it opens the platform's connect page in a popup (a full redirect when it is blocked), the person signs in with Google, GitHub, Apple, or an email magic link, and returns to your page as their Account — the chip then shows their name and tier, and the SDK holds a Reporter session that keeps recognising them on later visits (refreshed on boot, revocable). Nothing about identity is entered in your page, and the tier is always worked out by Fixback from the Account.

Where the key's environment is Open, the launcher and chip mount for everyone. Behind an Invited or Internal Gate nothing is shown to a signed-out visitor — entry is a Fixback-issued link (which carries a ?fixback= code the SDK exchanges on load) or a call from your own UI:

ts
import { Fixback } from "@fixback/sdk";// From your own UI — e.g. a "Report a bug" menu item on a gated site:await Fixback.signIn();

signIn / signOut / identity are also methods on the instance init returns. Signing out clears the Reporter session.

When the launcher shows

On init, the SDK checks with Fixback using your key and the page's origin. Fixback finds the environment the key belongs to, checks the origin against the sites that environment allows — those for all environments, plus any scoped to it — and weighs the visitor against its Gate. The launcher appears only when a submission would be accepted. Anything else — Fixback unreachable, a refused key, an unexpected error — means the launcher stays hidden, silently.

When the environment captures errors from every visitor, a visitor the Gate turns away gets no launcher either, but the SDK still records the trace and a masked replay and files their uncaught errors as Public Issues. Nothing shows on the page, and they can't send feedback. autoCapture: false turns this off as well.