Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Each call runs a fresh Lighthouse audit of the live page, so it takes seconds to tens of seconds; the answer is large (every audit’s details under lighthouseResult).
- Lab data is lighthouseResult; field data from real Chrome users is loadingExperience (the URL) and originLoadingExperience (the whole origin), present only when Chrome has enough traffic for it. Google says this field data will leave the API: use the Chrome UX Report API for it.
- Lighthouse category scores are 0 to 1 (multiply by 100 for the score PageSpeed shows).
Endpoints
Audit a page with Lighthouse
- Asks for PERFORMANCE alone unless category names more; send each category as its own category value.