For the same url, Google's PageSpeed Insights gives different scores on Mobile and Desktop. I am trying to understand how to differentiate the device level data while using the PageSpeed Insights API call. Or does the PageSpeed Insights API call give results at an overall level? Can someone please help me with it?
Asked
Active
Viewed 438 times
1 Answers
0
The strategy
parameter of the PSI API is used to differentiate between desktop and mobile results. Note that when the parameter is omitted, STRATEGY_UNSPECIFIED
defaults to desktop.
The PSI API docs have an API explorer that lets you run queries and see the results in a web UI. Here are a couple of examples:
{
"url": "https://www.example.com/",
"strategy": "DESKTOP"
}
{
"url": "https://www.example.com/",
"strategy": "MOBILE"
}
If you only have the PSI API results and want to know whether it relates to desktop or mobile data, you can look at the the lhr.lighthouseResult.configSettings.formFactor
property, which will be 'desktop'
or 'mobile'
(where the response object is the value lhr
).
See the ConfigSettings
docs for more info on the formFactor
field and other metadata about the results.

Rick Viscomi
- 8,180
- 4
- 35
- 50