页面速度API-区分移动和桌面
对于同一URL,Google的PagesPeed Insights在移动和桌面上给出了不同的分数。我试图了解如何在使用PagesPeed Insights API呼叫的同时区分设备级别的数据。 还是PagesSpeed Insights API呼叫会在总体上给出结果? 有人可以帮我吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PSI API的参数用于区分桌面和移动结果。请注意,省略参数时,
stragity_unspecified
默认为桌面。PSI API文档具有一个API资源管理器,可让您在Web UI中运行查询并查看结果。以下是几个示例:
desktop
“ https://develvemers.google.com/speed/docs/insights/rest/rest/v5/pagespeedapi/runpagespeed?apix_params =; 22%2C%22Strategy%22%3A%22Mobile%22%7D& apix = true#策略“ rel =” nofollow noreferrer“>移动:
如果您只有PSI API结果,并且想知道它是否相关到桌面或移动数据,您可以查看
lhr.lighthouseresult.configsettings.formfactor
属性,该属性将为'desktop'
'''移动'(其中响应对象是值lhr
)。请参阅文档有关
formFactor
字段和其他元数据的更多信息。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:
Desktop:
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 valuelhr
).See the
ConfigSettings
docs for more info on theformFactor
field and other metadata about the results.