I'm trying the Google v5 API page speed insight but i don't find the SCORE inside the JSON result.
This is the api https://www.googleapis.com/pagespeedonline/v5/runPagespeed
In the v4 there is a ruleGroups.SPEED.score that contains an integer with the score.
Where i can find the score inside the v5?
Performance score This score is determined by running Lighthouse to collect and analyze diagnostic information about the page. A score of 90 or above is considered good. 50 to 90 is a score that needs improvement, and below 50 is considered poor.
If you open up and run Google PageSpeed Insights through the Audit tab in Chrome Developer Tools, there is a button in the left part of the panel that will allow you to download the report as a JSON file. Save this answer. Show activity on this post.
What's the difference or, better said, “the differences” between these two audit tools provided by Google? PageSpeed Insights measures the performance metric only, whereas Lighthouse audits other aspects of a website, as well (SEO, accessibility, progressive web app, etc.)
It is json.lighthouseResult.categories.performance.score as described by Jeroen.
You can return all possible audit categories using the following example:
https://www.google.com/
lighthouseResult/categories/*/score
*
is a wildcardno
Desktop
Performance
Progressive Web App (PWA)
Best practices
Accessibility
SEO
{YOUR_API_KEY}
https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https%3A%2F%2Fstackoverflow.com%2F&fields=lighthouseResult%2Fcategories%2F*%2Fscore&prettyPrint=false&strategy=desktop&category=performance&category=pwa&category=best-practices&category=accessibility&category=seo&key={YOUR_API_KEY}
{
"lighthouseResult": {
"categories": {
"performance": {
"score":0.99
},
"accessibility": {
"score":0.7
},
"best-practices": {
"score":0.77
},
"seo": {
"score":0.9
},
"pwa": {
"score":0.56
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With