首页 > 解决方案 > 设置 Google pagespeed 洞察力以忽略 URL

问题描述

我正在调查某个网站以进行页面速度分析。该页面包含各种插件和第三方js文件。所以,我想找出其中哪一个导致 google pagespeed 得分下降。一种方法是手动删除第三方代码,然后检查 pagespeed 分数,但是,我无权访问代码库。我不能使用任何其他工具(例如 GTMetrix)进行分析,因为我们的基准是通过使用 google pagespeed 洞察力设置的。

所以,我想知道是否有办法在分析谷歌页面速度洞察中的页面时阻止某个 URL。GTmetrix 有一个忽略 URL 选项,它在获取页面分数时忽略某个 URL。Google pagespeed 洞察是否有类似的功能?

标签: pagespeedgoogle-pagespeedpagespeed-insights

解决方案


Although this isn't possible via the Page Speed Insights (PSI) website or PSI API you can use the audits tab in Google Chrome to achieve this (which uses lighthouse the engine that powers PSI).

Open developer tools, go to the network tab, reload the page to get all the loaded assets.

Right-click on the item you want to exclude from your test and choose 'Block Request URL' from the right click context menu.

Now go to the audits tab and run a performance test.

This way you can systematically rule out poorly behaving scripts from 3rd parties etc. without having to keep fiddling with the source of the page.

Don't forget to switch off blocking (there is a tab at the bottom of the developer tools window that will appear for this called 'Request Blocking') after you have run your tests or you may spend 45 minutes debugging a website that worked fine like I once did!!


推荐阅读