Functions

Pages Router Web Vitals reporting

Report browser performance metrics from an appropriate Pages Router component, often the custom app. Keep the callback stable and minimize recorded fields. Framework-specific metrics and their units are version-dependent. Example context: isolated Next.js 16.x candidate; snippet is partial unless it defines a complete convention file. Lifecycle: documented. Expected behavior / verification: Mount the reporter once in a synthetic browser fixture; check actual metric names and repeated navigation behavior. No analytics service is contacted. Source: https://nextjs.org/docs/pages/api-reference/functions/use-report-web-vitals Exact installed signature, typecheck and framework execution not run.

Formal Syntax & Structure

nextjs syntaxnextjs
useReportWebVitals(callback) from next/web-vitals

Working Example

Example Snippetnextjs
import { useReportWebVitals } from 'next/web-vitals'; const report=(metric:{name:string,value:number})=>console.info(metric.name,metric.value); export function Metrics(){useReportWebVitals(report);return null}
Next.js Reference