我正在浏览google pagespeed并考虑尝试一下。我通过几个教程来了解相同的内容。
在教程中,他们表明每个规则都有一个关联的score
参数。但是,我得到的响应每个规则只有ruleImpact
参数,没有score
参数。
这就是我使用的:
这是我得到的回应(没有显示整个回复,只有前几行) -
{
"kind": "pagespeedonline#result",
"id": "https://www.google.com/",
"responseCode": 200,
"title": "Google",
"score": 99,
"pageStats": {
"numberResources": 11,
"numberHosts": 4,
"totalRequestBytes": "2159",
"numberStaticResources": 9,
"htmlResponseBytes": "114193",
"imageResponseBytes": "46012",
"javascriptResponseBytes": "857355",
"otherResponseBytes": "210",
"numberJsResources": 5
},
"formattedResults": {
"locale": "en_US",
"ruleResults": {
"AvoidLandingPageRedirects": {
"localizedRuleName": "Avoid landing page redirects",
"ruleImpact": 0.0,
"urlBlocks": [
{
"header": {
"format": "Your page has no redirects. Learn more about avoiding landing page redirects.",
"args": [
{
"type": "HYPERLINK",
"value": "https://developers.google.com/speed/docs/insights/AvoidRedirects"
}
]
}
}
]
},
"EnableGzipCompression": {
"localizedRuleName": "Enable compression",
"ruleImpact": 0.0,
"urlBlocks": [
{
"header": {
"format": "You have compression enabled. Learn more about enabling compression.",
"args": [
{
"type": "HYPERLINK",
"value": "https://developers.google.com/speed/docs/insights/EnableCompression"
}
]
}
}
]
},
我做错了吗?
答案 0 :(得分:0)
规则影响是“得分”,可以说具体规则。
实施此规则建议的影响(无界浮点值)将使页面更快。规则之间的影响是可比较的,以确定哪个规则的建议会对更快或更低的页面产生更大或更小的影响。例如,如果启用压缩将节省1MB,而优化图像将节省500kB,启用压缩规则将具有图像优化规则的2倍影响,所有其他条件相同。
这意味着根据所提出的建议,每个规则的影响因规则违规对分数的影响程度而相互影响。