Understanding Core Web Vitals
What Are Core Web Vitals?
Core Web Vitals are Google's metrics for measuring real-world user experience on websites. They directly impact your SEO rankings and user satisfaction.
The Three Core Metrics
| Metric | Full Name | What It Measures | Good Score |
|---|---|---|---|
| LCP | Largest Contentful Paint | Loading performance | < 2.5s |
| INP | Interaction to Next Paint | Interactivity | < 200ms |
| CLS | Cumulative Layout Shift | Visual stability | < 0.1 |
Largest Contentful Paint (LCP)
LCP measures when the largest visible element finishes loading. This is usually:
- Hero images
- Large text blocks
- Video thumbnails
Common LCP Issues
- Slow server response โ TTFB over 600ms
- Render-blocking resources โ CSS/JS blocking paint
- Slow resource load times โ Large images, fonts
- Client-side rendering โ JavaScript-dependent content
Quick LCP Wins
<!-- Preload critical images -->
<link rel="preload" as="image" href="hero.webp" fetchpriority="high">
<!-- Preconnect to origins -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://cdn.example.com">Interaction to Next Paint (INP)
INP replaced FID in 2024. It measures ALL interactions, not just the first:
- Clicks
- Key presses
- Taps
Common INP Issues
- Heavy JavaScript execution โ Long tasks blocking main thread
- Too many event listeners โ Inefficient handlers
- Large DOM size โ Slow DOM operations
- Third-party scripts โ Analytics, chat widgets
Quick INP Wins
// Use passive event listeners
document.addEventListener('scroll', handler, { passive: true });
// Debounce expensive operations
function debounce(fn, delay) {
let timeout;
return (...args) => {
clearTimeout(timeout);
timeout = setTimeout(() => fn(...args), delay);
};
}Cumulative Layout Shift (CLS)
CLS measures unexpected layout shifts during page load.
Common CLS Causes
- Images without dimensions โ No width/height
- Ads and embeds โ Dynamic content insertion
- Web fonts โ FOUT/FOIT causing reflow
- Dynamic content โ JavaScript-inserted elements
Quick CLS Wins
<!-- Always set image dimensions -->
<img src="photo.jpg" width="800" height="600" alt="Photo">
<!-- Or use aspect-ratio CSS -->
<style>
.hero-image {
aspect-ratio: 16 / 9;
width: 100%;
height: auto;
}
</style>Measuring Core Web Vitals
Lab Tools (Development)
| Tool | Use For |
|---|---|
| Lighthouse | Manual audits in DevTools |
| PageSpeed Insights | Detailed recommendations |
| WebPageTest | Waterfall analysis |
Field Tools (Real Users)
| Tool | Use For |
|---|---|
| Chrome UX Report (CrUX) | Aggregated real user data |
| Search Console | Your site's field data |
| web-vitals.js | Custom monitoring |
Using Lighthouse
# Install CLI
npm install -g lighthouse
# Run audit
lighthouse https://example.com --view
# Mobile + Desktop
lighthouse https://example.com --preset=desktop --view
lighthouse https://example.com --form-factor=mobile --view
Lab vs Field Data: Lab tests are consistent but may not reflect real user experience. Field data shows actual performance but varies by user device/network. Both matter!
WordPress-Specific Performance Issues
Common WordPress performance problems:
| Issue | Impact | Solution |
|---|---|---|
| Too many plugins | Slow load, bloat | Audit and remove |
| Heavy theme | Large CSS/JS | Choose lightweight theme |
| No caching | Server strain | Add caching plugin |
| Unoptimized images | Slow LCP | Compress and resize |
| Database bloat | Slow queries | Cleanup and optimize |
Next Steps
In the next lesson, we'll implement caching strategies at multiple levels.
๐ฏ Lesson Complete! You understand Core Web Vitals and how to measure them.