@squasher-ai/browser
v0.1.1
Published
Official @squasher-ai/browser package for Squasher.
Readme
@squasher-ai/browser
Browser SDK for Squasher.
Capture frontend errors, Core Web Vitals, automatic breadcrumbs, analytics-style events, and optional session replay from a browser app.
Install
npm install @squasher-ai/browserSetup
import { init } from "@squasher-ai/browser";
init({
apiKey: process.env.NEXT_PUBLIC_SQUASHER_API_KEY!,
projectId: process.env.NEXT_PUBLIC_SQUASHER_PROJECT_ID!,
environment: process.env.NODE_ENV,
replay: {
enabled: true,
sampleRate: 0.1,
},
});React Error Boundary
import { SquasherErrorBoundary } from "@squasher-ai/browser/react";
<SquasherErrorBoundary fallback={<div>Something went wrong.</div>}>
<App />
</SquasherErrorBoundary>;Manual Capture
import { captureError, captureMessage, page, track } from "@squasher-ai/browser";
track("checkout_started", { step: 1 });
page("Checkout");
captureMessage("Frontend boot complete", "info");
captureError(new Error("Checkout failed"), { cartId: "cart_123" });Docs: https://docs.squasher.ai Homepage: https://squasher.ai
