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 Average mobile web page load on 3G DrupalCon
40% of mobile connections worldwide are 2G
6
DrupalCon
DrupalCon
🔘 bit.ly/web-vitals DrupalCon
DrupalCon
htups://webmasters.googleblog.com/2020/05/evaluating-page-experience.html
Top stories Top stories carousel will be open ● to all pages , provided they meet the Google News Guidelines Page experience will become a ● ranking factor AMP pages will be linked to, ● if available
Web Vitals: What are they? DrupalCon
Pillars of UX Essential metrics for a healthy site Loading Interactivity Visual Stability Is it happening? Is it responsive? Is it stable? contentbazaar.co/20160314/pi-way contentbazaar.co/20160314/pi-way contentbazaar.co/20160314/pi-way Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco DrupalCon
Core Web Vitals (Visual Stability) (Loading) (Interactivity) CLS LCP FID Cumulative Layout Shifu Largest Contentgul Paint First Input Delay NEEDS NEEDS NEEDS GOOD POOR GOOD POOR GOOD POOR IMPROVEMENT IMPROVEMENT IMPROVEMENT 2.5 sec 4.0 sec 100 ms 300 ms 0.1 0.25 75%
DrupalCon
🔘 web.dev/lcp LCP NEEDS GOOD POOR IMPROVEMENT 2.5 sec 4 sec Measures the render time of the largest content element (image or block of text) visible within the viewporu. DrupalCon
🔘 web.dev/fjd FID NEEDS GOOD POOR IMPROVEMENT 100 ms 300 ms 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. DrupalCon
🔘 web.dev/cls CLS NEEDS GOOD POOR IMPROVEMENT 0.1 0.25 Measures the sum of all unexpected layout shifus that occur throughout the lifespan of the page DrupalCon
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 DrupalCon
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. Chromium blog: The Science Behind Web Vitals DrupalCon
How do Drupal sites do? DrupalCon
DrupalCon
Web Vitals: Measuring DrupalCon
DrupalCon
Core Web Vitals Now in your favorite tools
1. DrupalCon
DrupalCon
2. 🔘 bit.ly/crux-tool DrupalCon
🔘 g.co/chromeuxdash DrupalCon
3.
4. DrupalCon
DrupalCon
🔘 web.dev/pergormance-scoring 5. DrupalCon
DrupalCon
🔘 bit.ly/web-vitals-extension 6. DrupalCon
import {getCLS, getFID, getLCP} from 'web-vitals'; // Measure and log each Core Web Vitals. getCLS(console.log); getFID(console.log); getLCP(console.log)
DrupalCon
🔘 bit.ly/speed-demon-tool DrupalCon
Web Vitals: Improving DrupalCon
DrupalCon
DrupalCon
Images Make them smaller ● choose smaller sizes or compress them ○ Image Optimize, squoosh.app ■ use responsive images ○ Responsive Image ■ lazy load ○ try modules like Lazyload, Blazy ■ DrupalCon
JS & CSS: Less, smaller ● compress ○ minify ○ don't use all modules on all pages ○ Load them later ● use async & defer ○ DrupalCon
DrupalCon
DrupalCon
DrupalCon
<!-- 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> DrupalCon
<!-- Modern best practice --> <!-- set a 640:360 (i.e a 16:9) aspect ratio --> <img src="shoe.jpg" width="640" height="360" alt="Shoe"> DrupalCon
DrupalCon
🔘 amp-wp.org DrupalCon
DrupalCon
🔘 web.dev/vitals DrupalCon
Thank you! @benmorss benmorss.com
🔘 web.dev/vitals
Recommend
More recommend