0Pricing
Next.js 15 Fullstack Web Apps · Pelajaran

Core Web Vitals dan Pemantauan

Pahami LCP, INP, dan CLS, ukur semuanya pada pengguna nyata, lalu gunakan fitur Next.js dan alat observabilitas agar aplikasi produksi Anda tetap cepat.

Core Web Vitals dan Pemantauan adalah pelajaran Next.js 15 Fullstack Web Apps gratis di CoddyKit. Ini adalah pelajaran 4 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Next.js 15 Fullstack Web Apps, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Next.js 15 Fullstack Web Apps mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

What Are Core Web Vitals

Core Web Vitals are Google's user-centric performance metrics that influence both UX and SEO ranking. The three current metrics are:

  • LCP — Largest Contentful Paint (loading)
  • INP — Interaction to Next Paint (responsiveness)
  • CLS — Cumulative Layout Shift (visual stability)

LCP: Loading Speed

LCP measures when the largest visible element (often a hero image or heading) finishes rendering. Aim for under 2.5s. Improve it with image optimization, priority loading, and server rendering.

import Image from 'next/image';

<Image src="/hero.jpg" alt="Hero" width={1200} height={600} priority />

INP: Responsiveness

INP replaced FID. It measures the latency of user interactions across the whole visit. Aim for under 200ms. Long JavaScript tasks on the main thread hurt INP most.

CLS: Visual Stability

CLS quantifies unexpected layout shifts. Aim for under 0.1. Always set explicit width and height on images and reserve space for ads and embeds.

Lab vs Field Data

Lab data comes from a controlled run (Lighthouse). Field data (RUM) comes from real users on real devices. Field data is the source of truth for ranking; lab data is great for debugging.

Reporting with useReportWebVitals

Next.js exposes useReportWebVitals to collect real-user metrics and send them to your analytics endpoint.

'use client';
import { useReportWebVitals } from 'next/web-vitals';

export function Vitals() {
  useReportWebVitals((metric) => {
    navigator.sendBeacon('/api/vitals', JSON.stringify(metric));
  });
  return null;
}

Bucketing a Metric

Classify a metric value into good / needs-improvement / poor. Pure logic you can run anywhere.

function rateLCP(ms) {
  if (ms <= 2500) return 'good';
  if (ms <= 4000) return 'needs-improvement';
  return 'poor';
}
console.log(rateLCP(1800));
console.log(rateLCP(3200));
console.log(rateLCP(5000));

Reducing Main-Thread Work

To improve INP, ship less JavaScript and defer non-critical work. Use dynamic imports to code-split heavy client components.

import dynamic from 'next/dynamic';

const Chart = dynamic(() => import('./Chart'), { ssr: false });

Server Components Help

React Server Components render on the server and send no JavaScript to the client for that part of the tree, directly reducing bundle size and improving INP and LCP.

Production Monitoring Tools

Set up continuous observability:

  • Vercel Speed Insights for built-in RUM.
  • Vercel Analytics for traffic.
  • Sentry / OpenTelemetry for errors and traces.

Alert when a metric regresses past its threshold.

Set a Performance Budget

Define budgets (e.g. LCP < 2.5s, JS < 170KB) and enforce them in CI so regressions fail the build before they reach users.

Quick Check

Which Core Web Vital measures the responsiveness of user interactions, and what is its target?

Recap

You learned to keep production fast:

  • LCP (loading), INP (responsiveness), and CLS (stability) with their targets.
  • The difference between lab and field data.
  • Collecting RUM with useReportWebVitals.
  • Reducing JS via code splitting and Server Components, plus monitoring and budgets.

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Core Web Vitals dan Pemantauan” gratis?

Ya — teks lengkap “Core Web Vitals dan Pemantauan” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Next.js 15 Fullstack Web Apps, upgrade ke CoddyKit PRO. Kursus Next.js 15 Fullstack Web Apps mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Core Web Vitals dan Pemantauan”?

Pahami LCP, INP, dan CLS, ukur semuanya pada pengguna nyata, lalu gunakan fitur Next.js dan alat observabilitas agar aplikasi produksi Anda tetap cepat. Kamu berlatih Next.js 15 Fullstack Web Apps dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Next.js 15 Fullstack Web Apps?

Tidak diperlukan pengalaman sebelumnya. Next.js 15 Fullstack Web Apps di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 4 dari 4.

Berapa lama pelajaran “Core Web Vitals dan Pemantauan” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Next.js 15 Fullstack Web Apps ini?

Ya. Setiap pelajaran Next.js 15 Fullstack Web Apps menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Menerapkan ke Vercel dan Netlify
  2. Optimasi Gambar dan Font
  3. Analisis Bundel dan Audit Kinerja
  4. Core Web Vitals dan Pemantauan
← Kembali ke Next.js 15 Fullstack Web Apps