Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Extra features of PageSpeed Insights API

In this article, I would like to share three features of PageSpeed Insights (PSI), that is not easy to find in the official documentation. I discovered them while hacking on the Lighthouse plugin and integrating PSI to

For a context, PSI is a simple yet powerful API by Google, that audits your page using Lighthouse and provides real-world users' data from Chrome UX Report (CrUX).

1. Audit many categories with one request

By default, PSI API returns only performance category. It's possible to pass ?category argument multiple times and get a report with many Lighthouse categories using one request (available categories: performance, accessibility, best-practices, seo, pwa).

curl -i ""

2. Get Chrome UX Report data immediately

By default, PSI API triggers Lighthouse audit and it takes 10 to 20 seconds to get results.

If you just need CrUX data, like in the case of the field-performance plugin. Add origin: prefix before the actual URL and get origin-level results immediately:

curl -i ""

To get url-level data, prefix with url:

curl -i ""

3. View real Lighthouse report

PSI provides a clean UI with field and lab performance data. But sometimes it's useful to see actual Lighthouse report, share, or export it.

Pass "?psiurl" argument to Lighthouse Viewer and it will fetch the PSI API and display the data in a default Lighthouse format.

Example link

Display PageSpeed Insights results using Lighthouse Viewer

I'm sure that there's more useful functionality, that is not easy to find in the official documentation. Share your tips in the comments or on Twitter @alekseykulikov_.

Copy link

staabm commented Oct 9, 2019

would be great if you could list all supported values for the categories parameter

Copy link

alekseykulikov commented Oct 9, 2019

@staabm, just added them: performance, accessibility, best-practices, seo, pwa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment