PageSpeed审查和优化

Aja*_*ana 11 google-pagespeed google-tag-manager

我使用google pagespeed insight分析了我的网页速度,并获得了以下建议.任何人都可以帮助我实现它.

Leverage browser caching
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
Leverage browser caching for the following cacheable resources:
http://www.googletagmanager.com/gtm.js?id=GTM-TVSKP6 (16.2 minutes)
Run Code Online (Sandbox Code Playgroud)

Eik*_*rff 19

您不能(您不能控制Google服务器,因此您无法代表他们设置http标头).

而且,你不想.Google已经为gtm脚本设置了缓存控制标头:

Cache-Control:private,max-age = 931

"私有"意味着http响应仅供单个用户使用,不应以允许许多用户(即代理服务器)访问的方式进行缓存.最长期限是文档到期前的最长期限,必须从服务器重新提取.在任何情况下,您可能都不想弄乱这些设置,因为通常您希望对标记容器所做的任何更改都会快速传播给您的用户.

无论如何,Google pagespeed更像是一个指南.设置http标头是一种过度优化,可能对某些高流量网站有意义,但大多数网站都有其他更简单的问题,可以而且应该先解决.