web_get_pagespeed_report
Web pages read low risk
Part of the Page Speed Agent.
What it does
Run Google PageSpeed Insights (v5) on a landing page and return the report the CRO team used to collect by hand: performance / accessibility / best-practices / SEO scores (0-100); real-user Core Web Vitals from the Chrome UX Report at the 75th percentile — LCP, INP, CLS, FCP, TTFB, each with Google's FAST / AVERAGE / SLOW category and the page-level overall category (plus the origin-level category); field_data.scope says whose numbers they are: 'page', 'origin' (Google had too little data for this page, so they are the whole site's, with a warning) or 'none'; Lighthouse LAB metrics from this run (LCP, FCP, TBT, CLS, Speed Index, Time to Interactive); the ten largest opportunities by estimated savings (Lighthouse 13 insights included: render-blocking requests, unused JavaScript, image delivery, caching...), the ten worst failed diagnostics (lab metrics are not repeated there), contrast_failures (the number of elements failing the colour-contrast check; null when Google did not run it), and what makes the page heavy or slow: page_weight (total bytes, requests, bytes by resource type including third-party), heavy_media (the five largest images and videos), third_parties (the eight costliest third-party scripts by main-thread time, with bytes), long_tasks (how many, and the five longest with their script) and report_url (pagespeed.web.dev for this url and strategy; opening it starts a fresh run, so its numbers can differ). When the URL has too little real-user traffic the field data is 'none' and a warning says the CWV are lab values only. One call per strategy (mobile/desktop). A server error from Google (HTTP 5xx, e.g. a Lighthouse error) is retried once automatically inside the job. NEVER FAILS ON TIME: the analysis runs as a server-side job — when Google is still working after 45 s the tool answers in_progress and the SAME call again returns the result (kept 15 minutes; web_get_page_screenshot reuses it, so the screenshot of an analysed page is instant). Authenticates with SCALIX_PAGESPEED_API_KEY when set, otherwise as the server's own Google identity (the production path; only the anonymous fallback is quota-starved). Returns {success, data:{url, final_url, strategy, analysis_utc, lighthouse_version, performance_score, category_scores, field_data, lab_metrics, opportunities, failed_diagnostics, contrast_failures, page_weight, heavy_media, third_parties, long_tasks, report_url, analysis}, warnings}.
When to use it
Use in every CRO or landing-page audit (see cro_collect_brief) to replace the manual pagespeed.web.dev check, and whenever page speed or Core Web Vitals are in question. For the picture of the page use web_get_page_screenshot; for its content use web_fetch_landing_page.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | Full landing page URL exactly as a visitor opens it (https://...). Public pages only. |
strategy | string | no | mobile (default) or desktop — the emulated device Lighthouse uses. Run both for a CRO audit; mobile is where most paid traffic lands. |
Safeguards
Policy
Read-only; analyses public pages only and stores nothing. Never fabricate or round a score: quote the number, the strategy and the analysis time. When field data is 'none', say the Core Web Vitals are lab values from a single run, not visitor experience.
Reminder
Lab and field numbers differ by design (emulated device vs real users). Pair this report with gads_get_landing_page_performance (Google's own speed_score) and web_fetch_landing_page before drawing a CRO conclusion, and run mobile AND desktop.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
rate_limited | PageSpeed Insights refused the request (quota). | If the server has neither a Google identity (ADC) nor SCALIX_PAGESPEED_API_KEY it used the anonymous quota, which is shared with the whole internet and usually exhausted — give it one; otherwise wait a minute and retry, and raise the PageSpeed Insights quota on the Scalix project if it persists. | yes |
invalid_argument | PageSpeed Insights could not analyse the URL, or strategy is not mobile/desktop. | Check that the URL is public, returns an HTML page and is not behind a login or bot protection; pass strategy=mobile or desktop. | no |
not_configured | PageSpeed Insights rejected the credential (API key, the server's Google identity, or an anonymous request). | Enable the PageSpeed Insights API (pagespeedonline.googleapis.com) on the Scalix project and grant the server identity serviceusage.serviceUsageConsumer (locally: gcloud auth application-default set-quota-project); with a key, check SCALIX_PAGESPEED_API_KEY. The error names the project. | no |
in_progress | Google is still analysing the page (Lighthouse takes 15-120 s, up to about five minutes when its first run fails and Scalix retries it; one tool call waits 45 s). | Call the same tool again with the same url and strategy in about 20 s — the analysis keeps running on the server and its answer is kept 15 minutes. Never write NOT VERIFIED because of in_progress. | yes |
platform_unavailable | Google's analysis failed: twice in a row with a server error (Scalix retried it once automatically; the message quotes Lighthouse's reason, e.g. PAGE_HUNG), no answer within its 150 s ceiling, or the API was unreachable. | After the double server error (is_retryable false), do not call again: write this PageSpeed evidence NOT VERIFIED with the message; PAGE_HUNG or NO_FCP is a finding about the page itself, and the message's pagespeed.web.dev link lets a person check by hand. After a timeout or an unreachable API (is_retryable true), call once more. | yes |
Edge cases
- field_data.source == 'none' is normal for low-traffic pages: CrUX needs a minimum of real Chrome visits; report the lab values as lab values.
- A page behind a login, geo-block or bot protection returns invalid_argument or a near-empty run; say the page could not be analysed rather than guessing.
- Scores vary a few points between runs (network and server variance) — do not treat a 3-point change as a finding.
- final_url is the URL after redirects; if it differs from url, the audited page is the redirect target.
- A page that stops responding in Google's test (Lighthouse PAGE_HUNG) usually fails the same way on every run, often on one strategy only: the tool retries once, then reports it — cite it with the other strategy's long tasks and main-thread time.