0

When opening Pagespeed UI and running a URL, the top section with the core web vitals pretty much appears instantly. In my current use case, I am only interested in that part, and not the Lighthouse diagnostics below (that take several seconds to load).

But when calling the API, I cannot find a way to exclude the lighthouseResults (to boost performance). I did play with category, but couldn't find a way to speed things up (no matter which category I choose, it's between 15-20s per url).

Reference:

https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https%3A%2F%2Fdevelopers.google.com

So, is there a way to only get the web vitals section? (in the response, that corresponds to loadingExperience and originLoadingExperience)

Note: in the end, I am trying to use the googleapis library in node/TS, but could also implement the API directly.

thanks!

Pinguin Dirk
  • 1,433
  • 11
  • 18

1 Answers1

1

You’re looking for the Chrome User Experience (CrUX) API rather than the PageSpeed Insights API. More details here: https://developer.chrome.com/docs/crux/api/

The CrUX data is a simple retrieval of field data that is precalculated based on previous 28-days usage in Chrome. So it is quick to return.

The rest of PageSpeed Insights is a live test of the site as it is now, using Lighthouse. This takes time to complete, but does mean it will update if you push out changes.

The PSI API returns both, but the CrUX data is also available in a lighter, much quicker, separate API.

Barry Pollard
  • 40,655
  • 7
  • 76
  • 92
  • thanks for the link - I'll check against my requirements if it's got all the data I need. Much appreciated - (will keep the question open a bit longer if you don't mind) – Pinguin Dirk Jan 27 '23 at 12:34
  • so we've checked and for our use case, the CrUX API is very useful. Thanks @Barry – Pinguin Dirk Feb 08 '23 at 14:01