npmやCDNで配布 Distributed via npm and CDN • Web Vitalsの指標を計測する際に はこのライブラリの利用を推奨 Recommended using this when you calculate CWV web-vitals JS Library https://github.com/GoogleChrome/web-vitals import {getCLS, getFID, getLCP} from 'web-vitals'; function sendToGoogleAnalytics({name, delta, id}) { // Assumes the global `gtag()` function exists gtag('event', name, { event_category: 'Web Vitals', event_label: id, value: Math.round(name === 'CLS' ? delta * 1000 : delta), non_interaction: true, }); } getCLS(sendToGoogleAnalytics); getFID(sendToGoogleAnalytics); getLCP(sendToGoogleAnalytics);