--- title: Core Web Vitals tagline: Improve the user experience date: 2023-06-07 00:00:00 +100 description: > Optimizing the user experience you offer on your website is essential for the success of any online business. Google does use different user experience-related metrics to rank web pages for SEO and has continued to provide multiple tools to measure and improve web performance. keywords: > Jekyll, Theme, JekyllOne, Turorial, SEO, Optimizing, User Experience, Core Web Vitals, Speed Index categories: [ Tutorial ] tags: [ SEO, FCP, LCP, TBT, CLS, Speed Index ] image: path: /assets/images/modules/attics/leon-1920x1280.jpg width: 1920 height: 1280 alt: Photo by Leon fab_menu_id: open_toc regenerate: true permalink: /pages/public/learn/core_web_vitals/ resources: [ animate, clipboard, lightbox, rouge] resource_options: - attic: slides: - url: /assets/images/modules/attics/leon-1920x1280.jpg alt: Photo by Leon --- // Page Initializer // ============================================================================= // Enable the Liquid Preprocessor :page-liquid: // Set (local) page attributes here // ----------------------------------------------------------------------------- // :page--attr: // Load Liquid procedures // ----------------------------------------------------------------------------- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%} // Load page attributes // ----------------------------------------------------------------------------- {% include {{load_attributes}} scope="all" %} // Page content // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [role="dropcap"] Optimizing the user experience you provide on your website is essential to the success of any online business. Google uses various user experience-related metrics to rank websites for SEO and continues to provide several tools to measure and improve web performance. // Include sub-documents (if any) // ----------------------------------------------------------------------------- // See: https://css-tricks.com/improve-largest-contentful-paint-lcp-on-your-website-with-ease/ == Core Web Vitals In its recent attempt to make measuring and understanding a good user experience easier, _Google_ has standardized the site's user experience metrics. These standardized metrics, called *Core Web Vitals*, help evaluate the *real-world* user experience of a website. *Core Web Vitals* is a set of specific website performance metrics introduced by Google to measure and quantify the user experience of a web page. They focus on key aspects of web *page loading*, *interactivity*, and *visual stability*, which are crucial for providing a good user experience. The Core Web Vitals *metrics* are: * First Contentful Paint (FCP): `FCP` measures how long it takes the browser to render the *first piece of DOM content* after a user navigates to your page. Images, non-white `` elements, and SVGs on your page are considered DOM content; anything inside an iframe isn't included. Values should less than *1.8 seconds*. * Largest Contentful Paint (LCP): LCP measures the loading speed of the main content on a web page. It represents the time taken for the largest visible element, such as an image or a block of text, to be rendered within the viewport. To provide a good user experience, the `LCP` should occur within the first *2.5 seconds* of the page starting to load. * Total Blocking Time: `TBT` measures the total amount of time that a page is blocked from responding to user input, such as mouse clicks, screen taps, or keyboard presses. The sum is calculated by adding the blocking portion of all *long tasks* between *First Contentful Paint* (FCP) and *Time to Interactive*. Any task that executes for more than *50 ms* is a *long task*. Values for `TBT` should in total less than *200 milliseconds*. * Cumulative Layout Shift (CLS): `CLS` measures the *visual* stability of a web page. It quantifies how much the page layout *shifts* during the loading process. Layout shifts can be disruptive, causing users to accidentally click on the wrong elements or lose their place on the page. A good user experience aims for a `CLS` score of less than *0.1*. Very good (excellent) website performance values for *Core Web Vitals* takes a lot of work to achieve. Values like the screenshot below require much work in the optimization and even then, can only rarely be achieved. .Excellent performance values (Lighthouse) lightbox::core_web_vitals_best_full[ 800, {data-image--core_web_vitals_best_full}, role="mt-3"] Nevertheless, it makes sense to achieve the best possible performance. The ranking of a website will improve a lot, and above all: the readers will appreciate it and visit such sites again. == J1 Template Build-in Optimizations Optimizations of the *Core Web Vitals* are already done for all pages the template system. Bla ... First Contentful Paint (FCP:: Bla ... Largest Contentful Paint (LCP):: Bla ... Total Blocking Time:: Bla ... Cumulative Layout Shift (CLS):: Bla ... == Optimizise LCP The Largest Contentful Paint or short *LCP* is one of the Core Web Vitals metrics that measure when the largest *content element* becomes *visible* in the browser. While other metrics like *TTFB* (time to first byte) and First Contentful Paint (*FCP*) also help measure page experience, they don't indicate when the page has become *meaningful* to the user. Typically, the page provides only a less context information to the user until the largest element becomes fully visible. LCP is, therefore, more representative of user expectations. As a Core Web Vital metric, LCP accounts for *25%* of the total performance ccore, making it one of the most important metrics to optimize a page. As per Google, the types of elements considered for Largest Contentful Paint are: * `` elements * `` elements inside an `` element * `