{
 "kind": "tool",
 "slug": "web-vitals",
 "path": "tools/web-vitals/",
 "name": "Web Vitals",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Logging, monitoring and analytics",
   "tools/observability-analytics/"
  ]
 ],
 "lead": "Measure Core Web Vitals and other key performance metrics in JavaScript.",
 "chips": [
  {
   "label": "Logging, monitoring and analytics",
   "path": "tools/observability-analytics/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install web-vitals"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/GoogleChrome/web-vitals"
  },
  {
   "label": "Website",
   "href": "https://github.com/GoogleChrome/web-vitals#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "Apache-2.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/GoogleChrome/web-vitals"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 12, 2026",
   "note": "",
   "src": "https://github.com/GoogleChrome/web-vitals"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "47 projects",
   "status": "info",
   "sub": "#15 of 121 in its category",
   "note": "Dependency in 47 public GitHub projects set up for AI coding agents that we scanned (0.8%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://developer.chrome.com/docs/crux/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Web Vitals does",
   "parts": [
    {
     "t": "prose",
     "text": "web-vitals is Google Chrome's own field-measurement library: it reports CLS, INP and LCP from real users in a way the README says \"accurately matches\" how Chrome measures them and reports them to Google tools, and you can load it late without losing data."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Web Vitals popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "76",
       "of": "/ 100",
       "l": "Gid Score, #172 overall"
      },
      {
       "n": "92.1M",
       "l": "downloads a week, npm"
      },
      {
       "n": "8,700",
       "l": "GitHub stars"
      },
      {
       "n": "47",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Web Vitals is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "Web Vitals is a dependency in 47 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.0% of the 4,867 JavaScript/TypeScript ones), #15 of 121 in logging, monitoring and analytics.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 311; those are left out of every share on this page.",
      "The most used alternative in our scan is Vercel Speed Insights (109 projects).",
      "Projects that use it most often also use Testing Library (85.1%), React (89.4%), Vite (66.0%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "26 projects, 1.1%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "26 projects, 0.8%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "19 projects, 0.6%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "6 projects, 2.2%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "5 projects, 1.1%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 85.1% of its projects",
       "v": "Testing Library",
       "path": "tools/testing-library/"
      },
      {
       "l": "In 89.4% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 66.0% of its projects",
       "v": "Vite",
       "path": "tools/vite/"
      },
      {
       "l": "In 59.6% of its projects",
       "v": "Playwright (JavaScript)",
       "path": "tools/playwright-test/"
      },
      {
       "l": "In 48.9% of its projects",
       "v": "jsdom",
       "path": "tools/jsdom/"
      },
      {
       "l": "In 42.6% of its projects",
       "v": "date-fns",
       "path": "tools/date-fns/"
      },
      {
       "l": "In 55.3% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 34.0% of its projects",
       "v": "React Router",
       "path": "tools/react-router-dom/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Web Vitals in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Numbers line up with Google's own tools",
       "v": "The README says the library measures each metric the way Chrome does and the way it is reported to CrUX, PageSpeed Insights and Search Console's Speed Report."
      },
      {
       "l": "Can be loaded late without missing data",
       "v": "The library uses the <code>buffered</code> flag on <code>PerformanceObserver</code>, so it still sees performance entries from before it loaded. The README recommends deferring it until other user-impacting code has loaded."
      },
      {
       "l": "An attribution build that explains bad scores",
       "v": "Change the import to <code>web-vitals/attribution</code> and each metric object gets an extra <code>attribution</code> property with diagnostic details. The README says this build is about 1.5K (brotli'd) larger and recommends it only if you use those features."
      },
      {
       "l": "Deltas for analytics backends that can't overwrite",
       "v": "Each report carries an <code>id</code> and a <code>delta</code>. If your analytics provider cannot update a value it has already received, you send deltas and sum them by ID."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Some values arrive late",
       "v": "Some metrics wait until the user interacts, switches tabs, or the page starts to unload. CLS and INP are reported again when the page becomes hidden. All metrics are reported again after a back/forward cache restore."
      },
      {
       "l": "Some callbacks never fire",
       "v": "INP is missing if the user never interacts with the page. CLS, FCP and LCP are missing if the page loaded in the background. Expect gaps in your data."
      },
      {
       "l": "Call each function once per page",
       "v": "Each <code>on*</code> call creates a <code>PerformanceObserver</code> and listeners that stay for the life of the page. The README warns that repeated calls can increase memory overhead."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Report only the delta of each change"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Js",
       "code": "import {onCLS, onINP, onLCP} from 'web-vitals';\n\nfunction logDelta({name, id, delta}) {\n  console.log(`${name} matching ID ${id} changed by ${delta}`);\n}\n\nonCLS(logDelta);\nonINP(logDelta);\nonLCP(logDelta);"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Web Vitals",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Packages around it",
       "items": [
        "@testing-library: Component testing",
        "react-scripts: Create React App tooling",
        "react: UI library",
        "react-router-dom: Client-side routing",
        "@emotion: CSS-in-JS styling",
        "axios: HTTP client"
       ]
      },
      {
       "title": "More in Logging, monitoring and analytics",
       "path": "tools/observability-analytics/",
       "items": [
        {
         "text": "Vercel Analytics",
         "path": "tools/vercel-analytics/"
        },
        {
         "text": "psutil",
         "path": "tools/psutil/"
        },
        {
         "text": "Sentry for Next.js",
         "path": "tools/sentry-nextjs/"
        },
        {
         "text": "OpenTelemetry",
         "path": "tools/opentelemetry/"
        },
        {
         "text": "Pino",
         "path": "tools/pino/"
        },
        {
         "text": "structlog",
         "path": "tools/structlog/"
        },
        {
         "text": "PostHog JS",
         "path": "tools/posthog-js/"
        },
        {
         "text": "Loguru",
         "path": "tools/loguru/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Web Vitals",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 76",
        "92.1M/wk"
       ]
      },
      {
       "name": "Vercel Speed Insights",
       "why": "Measure web performance metrics and get recommendations for improvement.",
       "path": "tools/vercel-speed-insights/",
       "facts": [
        "Apache-2.0",
        "Gid 55",
        "7.3M/wk"
       ]
      }
     ],
     "more": "Compare Web Vitals with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install web-vitals"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Web Vitals\n- Install with `npm install web-vitals` and import from the package. The README calls npm the recommended way. If you must use a script tag, self-host the built files rather than relying on unpkg, jsDelivr or cdnjs.\n- Defer loading the library until after other user-impacting code. The `buffered` flag means early entries are not lost.\n- Call each of `onCLS()`, `onINP()`, `onLCP()` once per page load. Repeated calls add `PerformanceObserver` instances and listeners for the life of the page.\n- Import from `web-vitals/attribution` only when the code actually reads the `attribution` property. It adds about 1.5K brotli'd.\n- For analytics backends that cannot overwrite a sent value, send `delta` and group by `id`. A back/forward cache restore produces a new `id`.\n- Do not enable `reportAllChanges` in production. The README says it is for debugging.\n- Do not assume callbacks fire immediately, or at all. With `reportSoftNavs`, use the `navigationURL` property instead of the current URL.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm web-vitals"
  ],
  [
   "Category",
   "Logging, monitoring and analytics"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "6.2.3, October 5, 2026"
  ],
  [
   "On GitHub since",
   "March 2020"
  ],
  [
   "Gid Score",
   "76.3"
  ],
  [
   "Rank in category",
   "#15 of 121"
  ],
  [
   "GitHub",
   "GoogleChrome/web-vitals"
  ],
  [
   "Last change",
   "Nov 12, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/googlechrome.png"
}