每帧仅加载一次代码
概览
此项评估旨在确保任何框架都不会将同一广告代码库脚本加载超过一次。多次添加同一脚本没有必要,而且可能会导致网页性能下降。
建议
移除重复的广告代码库脚本。在某些情况下,重复的脚本可能会在您毫无察觉的情况下从两个不同的位置加载。通过查看网络流量并按框架对请求进行分组,可以检查每个重复脚本的来源。
确定重复脚本的来源
使用 Chrome DevTools 中的“Network”标签页确定哪个框架正在加载重复的脚本。
- 按
Control+Shift+J
或 Command+Option+J
(Mac) 打开开发者工具。
- 前往 Network(网络)标签页。
- 如果过滤栏尚未显示,请点击 Filter
打开过滤器栏,然后选择 JS。
- 打开网络设置
,然后选择按框架分组。
- 请重新加载页面以捕获网络流量。

支持以下广告代码库脚本:
媒体库 |
脚本 |
AdSense |
pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
pagead2.googlesyndication.com/pagead/js/show_ads.js
|
Google 发布商代码 |
googletagservices.com/tag/js/gpt.js
securepubads.g.doubleclick.net/tag/js/gpt.js
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-06-26。
[null,null,["最后更新时间 (UTC):2024-06-26。"],[[["This audit helps improve website performance by ensuring ad tag library scripts are only loaded once per frame."],["Loading duplicate scripts can slow down page load times and negatively impact user experience."],["Chrome DevTools' Network tab, with grouping by frame enabled, can be used to identify the source of duplicate ad tag scripts."],["AdSense and Google Publisher Tag have specific scripts that should be monitored to ensure single loading instances."]]],["The audit identifies duplicate ad tag library scripts, which negatively impact page performance. To resolve this, users should remove the redundant scripts. Utilize Chrome DevTools' Network tab, filtering for JS and grouping requests by frame, to find where duplicates originate. Supported libraries include AdSense (with scripts `pagead2.googlesyndication.com/pagead/js/adsbygoogle.js` and `show_ads.js`) and Google Publisher Tag (`googletagservices.com/tag/js/gpt.js` and `securepubads.g.doubleclick.net/tag/js/gpt.js`). The goal is ensuring each script loads only once.\n"]]