Web Vitals
Report Core Web Vitals from the browser SDK
Add the Web Vitals extension to report LCP, CLS, INP, FCP, and TTFB from visitor sessions.
Enable Web Vitals
Import the extension from its package subpath. It takes no options.
import { webVitals } from "@faststats/react/web-vitals";
<Analytics siteKey="your_site_key" extensions={[webVitals()]} />;faststats: {
siteKey: "your_site_key",
extensions: { webVitals: true },
}import { init } from "@faststats/web";
import { webVitals } from "@faststats/web/web-vitals";
init({
siteKey: "your_site_key",
extensions: [webVitals()],
});Collected Metrics
The tracker reports the following metrics.
| Metric | Name |
|---|---|
LCP | Largest Contentful Paint |
CLS | Cumulative Layout Shift |
INP | Interaction to Next Paint |
FCP | First Contentful Paint |
TTFB | Time to First Byte |
Each metric is sent with its value, an id, a rating, the navigation type, and the delta since the last successfully sent value. Metrics are flushed when the page is hidden and when the client stops, and are attributed to the URL the document was loaded on.
Attribution
Attribution data is always included. Every metric carries the web-vitals attribution fields that point to the element, resource, or interaction responsible for it, such as the LCP element or the INP interaction target. There is nothing to turn on.