Skip to content
Web Performance

Measuring Largest Contentful Paint in the Field

Theo Marsh
1 min read
1,170
Cover photo for “Measuring Largest Contentful Paint in the Field”

Lab scores are a guess. Field data is the truth, and collecting it takes fewer lines than you might think.

Reading work aloud is the cheapest editing tool there is. Your ear catches rhythm problems that your eye skips over, especially in long sentences.

We schedule unstructured time on purpose. Some of our best ideas started as an afternoon with no plan and a stack of old magazines.

lcp.js
new PerformanceObserver((list) => {
  const entries = list.getEntries();
  const last = entries[entries.length - 1];
  navigator.sendBeacon('/rum', JSON.stringify({
    metric: 'LCP',
    value: Math.round(last.startTime),
    element: last.element?.tagName,
  }));
}).observe({ type: 'largest-contentful-paint', buffered: true });
JavaScript UTF-8·LF·9 lines

Reading work aloud is the cheapest editing tool there is. Your ear catches rhythm problems that your eye skips over, especially in long sentences.

4
Continue reading

Related posts

All posts
Conversation

Comments · 4

Posting as guest · Sign in
  1. Lena Novak ·

    The quote at the end made my day. Sharing this with the whole team.

    1. Theo Marsh Author ·

      Portra 400 for most of them, and one roll of HP5 for the evening shots.

  2. Maya Lindqvist ·

    Would love a follow-up post on how you organise all of this afterwards.

  3. Maya Lindqvist ·

    Such a clear explanation. I finally understand why our pages felt sluggish on mobile.