pagespeedgoogle-pagespeedgoogle-pagespeed-insights-api

Pagespeed results differ between the api and the web tool


I'm building a tool to test a number of pages on a website using the pagespeed API. It works fine, but if I compare the results from the API to those in the PageSpeed Insights page (pagespeed.web.dev) the API consistently gives a better performance score.

Web tool:

Mobile - 61

Desktop - 79

API:

Mobile - 83

Desktop - 84

I thought it could be to do with the test server's location, but checking the IPs in the site's access log, both IPs resolve to the US.

Any ideas as to why there would be such a big difference between the tests?


Solution

  • There are lots of reasons for Lighthouse variability.

    PageSpeed Insights (both the web version and the API) uses a variety of machines. As far as I'm aware the web site basically makes use of the API so there is no particular reason why one would be faster than the other beyond the usual reasons of variability.

    In fact when I tried a random URL I initally got the opposite (the API is slower). But retrying showed a similar score.

    Some things to try:

    API settings

    Web settings