Web Vitals
Capture Core Web Vitals (LCP, CLS, FCP, INP, TTFB) for performance monitoring.
Capture Core Web Vitals — the metrics Google and most performance tools use to judge real-world user experience.
#Enable
Set capture_performance: true in init. The SDK lazy-loads the web-vitals library and emits one event per metric per page.
vt.init('YOUR_PROJECT_TOKEN', {
api_host: 'https://www.vtilt.com',
capture_performance: true,
})typescript
#Metrics captured
| Metric | What it measures |
|---|---|
| LCP | Largest Contentful Paint — when the main content is visible. |
| CLS | Cumulative Layout Shift — visual stability through page life. |
| FCP | First Contentful Paint — when any content first paints. |
| INP | Interaction to Next Paint — input responsiveness across the page. |
| TTFB | Time to First Byte — server response latency. |
Each metric is reported as a $webvitals event with the metric name, value (ms or unitless for CLS), rating (good / needs-improvement / poor) per the official Web Vitals thresholds, and the page URL.