What are Web Vitals?
Review
+ Razširi članek s svojim mnenjem
Web Vitals is Google’s initiative to provide uniform guidance on the quality metrics that are essential to delivering a great user experience on the web.Google has provided many performance measurement and reporting tools over the years. Some developers are experts at using these tools, while others have found the abundance of tools and metrics a challenge to keep track of.Website owners don’t need to be performance gurus to understand the quality of the experience they provide their users. The goal of the Web Vitals initiative is to simplify the landscape and help websites focus on the most important metrics, the Core Web Vitals.Core Web Vitals
Core Web Vitals are a subset of Web Vitals that apply to all web pages, should be measured by all site owners, and will be displayed in all Google tools. Each of the key web vitals represents a specific aspect of the user experience, is measurable in practice, and reflects actual experiences with a user-centric key result.The metrics that makeup Core Web Vitals will evolve over time. The current set focuses on three aspects of user experience – loading, interactivity, and visual stability – and includes the following metrics (and their thresholds):• Maximum Content Color (LCP): Measures loading performance. For a good user experience, the LCP should appear within 2.5 seconds of the first page load.• First Input Delay (FID): measures interactivity. For a good user experience, pages should have an FID of less than 100 milliseconds.• Cumulative Layout Shift (CLS): measures visual stability. Pages should maintain a CLS of less than 0.1 for a good user experience.For each of the above metrics, a good threshold to measure 75 percent page load, segmented into mobile and desktop, is a good threshold to achieve the recommended goal for most users.Tools that assess compliance with the Core Web Vitals should consider a page successful if it meets the recommended goals of at least 75% for all three metrics listed above.Core Web Vitals Measurement and Reporting Tools
Google believes that Core Web Vitals are essential to all web experiences. As a result, it commits to disclosing these metrics in all of its popular tools.Core Web Vitals podpirajo orodja kot so PageSpeed Insights, Chrome UX Report, Search Console, Chrome DevTools, Lighthouse in pa Web Vitals Extension.Tools for measuring Core Web Vitals in a production environment
The Chrome User Experience Report collects anonymous data on actual user metrics for each Core Web Vital. This data allows website owners to quickly assess their performance without having to manually measure analytics on their pages, and tools like PageSpeed Insights and the Core Web Vitals Search Console report.The data provided by the Chrome User Experience Report provides a quick way to evaluate the performance of websites but does not include the detailed pageview telemetry that is often needed for accurate diagnosis, monitoring, and rapid response to regressions. Therefore, we strongly recommend that websites set up their own monitoring of actual users.Measure Core Web Vitals in JavaScript
Each of the key web vitals can be measured in JavaScript using standard web APIs.The easiest way to measure all Core Web Vitals is to use the web-vitals JavaScript library, which measures each metric in a way that closely matches how all the Google tools above report.With the web-vitals library, measuring each metric is as simple as calling a single function (see the documentation for full usage and API details ):import {getCLS, getFID, getLCP} from 'web-vitals';
function sendToAnalytics(metric) {
const body = JSON.stringify(metric);
(navigator.sendBeacon && navigator.sendBeacon('/analytics', body)) ||
fetch('/analytics', {body, method: 'POST', keepalive: true});
}
getCLS(sendToAnalytics);
getFID(sendToAnalytics);
getLCP(sendToAnalytics);
Once you have configured your site to use the web-vitals library to measure and send data to the Core Web Vitals analytics endpoint, the next step is to aggregate and report this data to see if your pages are meeting the recommended at least 75% page views.An example of this is the Web Vitals report, which allows website owners to measure their key values using Google Analytics.You can also report on each of the Core Web Vitals without writing any code using the Web Vitals Chrome extension. This extension uses the web-vitals library to measure each of these metrics and display them to users as they browse the web.This extension can be helpful in understanding the performance of your own pages, your competitors’ pages, and the web in general.