@stagewright-ai/browser
v0.1.1
Published
Stagewright browser SDK: feature-usage events and in-app guidance that's checked on every PR.
Maintainers
Readme
@stagewright-ai/browser
The Stagewright browser SDK. It tells Stagewright which features people actually use, so walkthroughs and help content follow real usage, and it shows in-app guidance (nudges) that's checked against your product on every PR.
npm install @stagewright-ai/browserimport { stagewright } from "@stagewright-ai/browser";
stagewright.init({ key: "pk_sw_…" });
stagewright.identify(user.id, { role: user.role });
stagewright.group(account.id, { plan: account.plan });Your publishable key (pk_sw_…) is under Insights → Usage data in Stagewright. It's safe to ship in client code.
What it captures
- Route changes, and clicks on elements your feature map knows (by test id, role and accessible name).
- Views of Stagewright content.
- Events you send with
stagewright.track(event, properties).
No keystrokes, no form values, no session replay. Ids are hashed by the API before storage, and properties are allow-listed. If PostHog or Segment is already connected to Stagewright, you only need identify and group.
Options
stagewright.init({
key: "pk_sw_…",
autocapture: true, // route changes and known clicks
guidance: true, // in-app nudges
quietRoutes: ["/checkout"], // never show guidance here
viewerToken, // signed by your backend; ties views to a person
});Other calls: page(), reset() (on sign-out), flush(), shutdown().
Script tag
<script src="https://api.stagewright.ai/sdk/v1/stagewright.js" data-key="pk_sw_…" defer></script>
<script>stagewright.identify(USER_ID, { role: ROLE })</script>data-api-url, data-autocapture="false" and data-guidance="false" are optional. Calls queued on window.stagewright = [["identify", id, traits]] before the script loads are replayed.
License
MIT
