页面速度API-区分移动和桌面

发布于 2025-01-30 15:52:58 字数 167 浏览 3 评论 0原文

对于同一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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断肠人 2025-02-06 15:52:58

PSI API的参数用于区分桌面和移动结果。请注意,省略参数时,stragity_unspecified默认为桌面。

PSI API文档具有一个API资源管理器,可让您在Web UI中运行查询并查看结果。以下是几个示例:

desktop

{
  "url": "https://www.example.com/",
  "strategy": "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“>移动:

{
  "url": "https://www.example.com/",
  "strategy": "MOBILE"
}

如果您只有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:

{
  "url": "https://www.example.com/",
  "strategy": "DESKTOP"
}

Mobile:

{
  "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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文