This is a pared-down version of Google's web-vitals library for tracking core web vitals RUM via GTM, with various changes.
Google recommends loading it's web-vitals library via a CDN, which adversely impacts performance -- the very thing we're trying to measure & optimize! Using a common CDN has certain benefits mitigating the performance impact, but if we're already loading GTM it would be ideal to instead add the library as a GTM tag. (Actually the ideal way is to package this library with first-party code, but the purpose of Web Vitals trackings aligns nicely with the core needs of teams using GTM.) We lose the advantage of automatic library updates, but we want to make some tweaks anyway...
Primary changes:
- Only include what we need. This script is ~1/3 smaller than the UMD base+polyfill version of G's library. This script focuses on the three core web vitals,