Web Vitals
for a healthier open web
Ben Morss
Developer Advocate
Web Vitals for a healthier open web Ben Morss Developer Advocate - - PowerPoint PPT Presentation
Web Vitals for a healthier open web Ben Morss Developer Advocate DrupalCon Ben Morss Developer Advocate at Google, where I work to help the Web be faster and more beautiful. (And I still sometimes make music) @benmorss 3 12 seconds
Web Vitals
for a healthier open web
Ben Morss
Developer Advocate
Ben Morss
Developer Advocate at Google, where I work to help the Web be faster and more beautiful. (And I still sometimes make music)
@benmorss12 seconds
Average mobile web page load on 3G
worldwide are 2G
π bit.ly/web-vitals
Top stories
to all pages, provided they meet the Google News Guidelines
ranking factor
if available
Web Vitals:
What are they?
Loading
Is it happening? contentbazaar.co/20160314/pi-way Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnaInteractivity
Is it responsive?Visual Stability
Is it stable?Pillars of UX
Essential metrics for a healthy site
Core Web Vitals
(Loading)LCP
Largest Contentgul Paint GOOD NEEDS IMPROVEMENT POOR 4.0 sec 2.5 sec (Interactivity)FID
First Input Delay GOOD NEEDS IMPROVEMENT POOR 100 ms 300 ms (Visual Stability)CLS
Cumulative Layout Shifu GOOD NEEDS IMPROVEMENT POOR 0.1 0.2575%
Measures the render time of the largest content element (image or block of text) visible within the viewporu.
LCP
GOOD NEEDS IMPROVEMENT POOR 4 sec 2.5 secπ web.dev/lcp
Measures the time from when a user fjrst interacts with the page until the time when the browser is actually able to respond to that interaction.
FID
GOOD NEEDS IMPROVEMENT POOR 300 ms 100 msπ web.dev/fjd
Measures the sum of all unexpected layout shifus that
lifespan of the page
CLS
GOOD NEEDS IMPROVEMENT POOR 0.25 0.1π web.dev/cls
LCP, FID, CLS are real user measurement (RUM) metrics
Event Timing API β First Input Delay β web.dev/fjd Largest Contentgul Paint API β Largest Contentgul Paint β web.dev/lcp Layout Instability API β Cumulative Layout Shifu β web.dev/cls
Why these metrics? β bit.ly/web-vitals-science Why X threshold and P75? β bit.ly/web-vitals-methodology
We analyzed millions of page impressions to understand how these metrics and thresholds afgect users. We found that when a site meets the above (Core Web Vitals) thresholds, users are
24% less likely to abandon page loads by
leaving the page before fjrst content is painted.
How do Drupal sites do?
Web Vitals:
Measuring
Core Web Vitals
Now in your favorite tools
1.
πbit.ly/crux-tool
2.
π g.co/chromeuxdash
3.
4.
π web.dev/pergormance-scoring
5.
π bit.ly/web-vitals-extension
6.
import {getCLS, getFID, getLCP} from 'web-vitals'; // Measure and log each Core Web Vitals. getCLS(console.log); getFID(console.log); getLCP(console.log)
π bit.ly/speed-demon-tool
Web Vitals:
Improving
Images
β choose smaller sizes or compress them β Image Optimize, squoosh.app β use responsive images β Responsive Image β lazy load β try modules like Lazyload, Blazy
JS & CSS:
β compress β minify β don't use all modules on all pages
β use async & defer
<!-- Old best practice --> <img src="shoe.jpg" width="640" height="360" alt="Shoe"> <!-- Then came responsive design practice --> <img src="shoe.jpg" alt="Shoe"> <style> img { width: 100%; /* or max-width: 100%; */ height: auto; } </style>
<!-- Modern best practice --> <!-- set a 640:360 (i.e a 16:9) aspect ratio --> <img src="shoe.jpg" width="640" height="360" alt="Shoe">
π amp-wp.org
π web.dev/vitals
Thank you!
@benmorss benmorss.com
π web.dev/vitals