JavaScript error monitoring and session replay
The Flowhawk browser SDK records JavaScript errors, page loads, web vitals, console logs and session replays, and adds a traceparent header to your own API calls, so a failed checkout click opens the server trace behind it.
What you get
- JavaScript errors grouped into Issues, with stack traces mapped to your source through uploaded source maps.
- Session replays on Sessions, leading with the sessions that hit an error or a failed request. Inputs and text are masked unless a flow's settings turn masking off.
- Web vitals per page (LCP, INP, CLS) on each flow's page.
- Each request a page makes opens the backend trace it started.
Set it up
1. Install
npm install @flowhawk/browser
2. Start it when the app loads
Create a Web pages key in Settings > API keys. It is meant to be public: it can only send data.
import * as flowhawk from "@flowhawk/browser";
flowhawk.init({
service: "storefront",
apiKey: "<web pages key>",
endpoint: "https://api.flowhawk.dev",
version: import.meta.env.VITE_RELEASE, // your release, so issues show where they started
});
flowhawk.setUser({ id: user.id }); // an id, not an email
About 3 KB loads up front. The recorder loads afterwards, and only when the page's flow records sessions. In React, flowhawk.attachToReactErrorBoundary reports errors your error boundary catches.
3. Upload source maps
With Vite, the SDK's plugin builds hidden source maps, uploads them with a CI uploads key and removes them from the output:
// vite.config.ts; FLOWHAWK_UPLOAD_KEY=<CI uploads key> in CI
import { flowhawkSourceMaps } from "@flowhawk/browser/vite";
plugins: [flowhawkSourceMaps({ service: "storefront", release: process.env.VITE_RELEASE, endpoint: "https://api.flowhawk.dev" })]
Check it arrived
Open the page and click around, then open Sessions in the app. If nothing shows, Help and troubleshooting says why data can be refused and how to see it.
Common questions
I already use Sentry in the browser. Do I have to switch?
No. Keep Sentry's SDK and put a Web pages key in its DSN: https://<key>@api.flowhawk.dev/1. Errors, page loads, web vitals and replays arrive the same way (Sentry SDKs).
What happens when Flowhawk can't be reached?
The first visit records nothing until the page has its settings, so masking can't be skipped, and init never throws. Your page works as before.