非同步載入廣告代碼
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
總覽
這項稽核可確保系統以非同步方式載入廣告代碼程式庫指令碼。
根據預設,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 請求模式和非同步顯示模式
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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"]]