How to get the mobile and desktop API path in page speed insights?

317 views Asked by At

Hi i just want to ask if there's seperated API in pagespeed insight in performance score? Because i only seeing this path to consume in performance score and i don't know if it's for desktop or mobile

lighthouseResult.categories.performance.score
1

There are 1 answers

0
Ayush Walekar On

To determine the strategy from result, we can refer to lighthouseResult.emulatedFormFactor

By default it runs for DESKTOP. To make it run for MOBILE, there exists a query param strategy

Here's sample request for strategy=MOBILE

curl \
  'https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?url=https%3A%2F%2Fexample.com&strategy=MOBILE&key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --compressed

Reference: here