Web vitals & errors
Real-user Core Web Vitals and JavaScript error tracking, with two opt-in modules.
Core Web Vitals
Add data-vitals to your script tag. The vitals module measures real-user vitals with the browser's PerformanceObserver API and sends them once per page, when it's first hidden.
| Metric | Good | Needs improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | ≤ 2.5 s | ≤ 4 s | > 4 s |
| INP (Interaction to Next Paint) | ≤ 200 ms | ≤ 500 ms | > 500 ms |
| CLS (Cumulative Layout Shift) | ≤ 0.1 | ≤ 0.25 | > 0.25 |
| FCP (First Contentful Paint) | ≤ 1.8 s | ≤ 3 s | > 3 s |
| TTFB (Time to First Byte) | ≤ 800 ms | ≤ 1.8 s | > 1.8 s |
The dashboard reports the 75th percentile, matching Google's methodology.
Error tracking
Add data-errors to your script tag to capture uncaught errors and unhandled promise rejections (at most 10 per page load). They're grouped by a fingerprint of the error type, the normalized message and the top in-app stack frame. Each group shows first and last seen, occurrences and affected users.
Report caught errors yourself:
try {
await saveDraft();
} catch (err) {
stancelens("event", "$error", {
message: err instanceof Error ? err.message : String(err),
stack: err instanceof Error ? err.stack : undefined,
});
}Frames from browser extensions, node_modules and vendor bundles are skipped when choosing the frame an error is grouped by, so groups point at your code.