异步加载广告代码
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
概览
此项审核旨在确保异步加载广告代码库脚本。
默认情况下,JavaScript 执行是同步的。也就是说,脚本
则在该脚本完成之前,不能加载其他内容。
已下载、解析和执行。选择启用异步执行可防止
这样,浏览器在
指定的脚本在后台加载。这样网页就能快速响应
并缩短加载所有关键词所需的时间
组件。
建议
在脚本代码定义中添加 async 属性。例如:
AdSense
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
AdSense(自动广告)
<script async data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Google 发布商代码
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
支持以下广告代码库脚本:
广告代码库 |
脚本 |
AdSense |
pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
pagead2.googlesyndication.com/pagead/show_ads.js
|
Google 发布商代码 |
googletagservices.com/tag/js/gpt.js
securepubads.g.doubleclick.net/tag/js/gpt.js
|
Google 发布商代码使用入门
GPT 请求模式和异步呈现
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],["To optimize page load times, ad tag library scripts should load asynchronously. This is achieved by including the `async` attribute within the `\u003cscript\u003e` tag. Asynchronous loading allows the browser to continue loading other page content while the script downloads and executes in the background. Supported ad tag libraries include AdSense and Google Publisher Tag, with specific script URLs like `pagead2.googlesyndication.com/pagead/js/adsbygoogle.js` and `securepubads.g.doubleclick.net/tag/js/gpt.js` needing the `async` attribute.\n"],null,[]]