Automate page performance audits using the PageSpeed Insights API
domain: core-web-vitals · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Enable the PageSpeed Insights API in a Google Cloud project and generate credentials for server-to-server calls
Call GET https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed with the target URL and a strategy parameter (mobile or desktop)
Parse both the lighthouseResult (lab data) and loadingExperience/originLoadingExperience (field CrUX data) sections — they answer different questions
Schedule recurring calls (e.g., nightly per key template/URL) and store results to trend Core Web Vitals and Lighthouse scores over time
Stay within the default quota of 25,000 queries/day (400 per 100 seconds), or request a quota increase before scaling to large URL sets
Known gotchas
Lab data (Lighthouse) and field data (CrUX, in loadingExperience) can disagree significantly — a good lab score doesn't guarantee good real-user Core Web Vitals
loadingExperience is only populated when the URL has enough real-user CrUX traffic; low-traffic pages return no field data and you must fall back to origin-level data
Quota increases aren't guaranteed to be approved — design batch jobs to back off/retry rather than assuming unlimited scale
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?