// the find
GoogleChrome/web-vitals
Essential metrics for a healthy site.
web-vitals is Google's tiny wrapper library for capturing Core Web Vitals (CLS, INP, LCP) plus FCP and TTFB in the browser, matching exactly how Chrome/CrUX/PageSpeed Insights compute them. It's for anyone wiring real-user monitoring into an analytics pipeline rather than relying on synthetic lab tests.
Genuinely tiny (~3K brotli'd) and has zero runtime dependencies, using PerformanceObserver's buffered flag so you don't need to load it early. The attribution build is a real differentiator — it hands back the specific DOM element or event responsible for a bad CLS/INP/LCP score, which is the actual hard part of RUM (collecting the number is easy, explaining it is not). API is a single callback per metric with sane defaults (delta reporting, bfcache handling, visibility-based flushing) already worked out for you.
No batching or transport built in — you're on your own for sendBeacon queuing, sampling, and retry logic, so this is a building block, not a drop-in RUM solution. Soft-navigation support (Chrome 151+) is Chromium-only and adds a second, subtly different reporting path (TTFB reports as 0, CLS/INP reset) that's easy to get wrong if you don't read the docs closely. As with any Google-authored vitals tool, thresholds and rating buckets are Chrome's opinion of 'good' — cross-browser parity for INP/CLS observers is still spotty outside Chromium engines.