避免會阻擋轉譯的資源
總覽
這項稽核會找出延遲載入廣告代碼程式庫的資源 (尤其是指令碼和樣式表)。這些都是在廣告代碼程式庫開始載入之前所要求及收到的資源。減少在代碼載入前要求的資源數量,可加快廣告載入速度。
建議
這項稽核的詳細資料包含會導致代碼延遲載入的所有指令碼和樣式表清單。目標是盡可能減少接近 0 的項目數量。以下提供幾個訣竅:
- 提早在網頁的
<head>
中載入廣告代碼程式庫。
- 將核心功能所需的指令碼和樣式表直接嵌入 HTML。
- 使用
async
或 defer
屬性標示非重要指令碼。
- 根據媒體查詢將樣式區分為不同的檔案,並使用
media
屬性只在需要時載入樣式。
系統支援下列廣告代碼程式庫指令碼:
媒體庫 |
指令碼 |
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
|
禁止轉譯資源
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-06-26 (世界標準時間)。
[null,null,["上次更新時間:2024-06-26 (世界標準時間)。"],[[["This audit helps identify scripts and stylesheets that slow down the loading of ad tags by being requested before them."],["Reducing the number of these resources loaded prior to ad tags can significantly improve ad loading speed."],["Optimization strategies include loading ad tags earlier, inlining critical resources, using `async` or `defer` for non-critical scripts, and separating stylesheets by media query."],["Supported ad tag libraries include AdSense and Google Publisher Tag, with specific script URLs for identification."]]],["The audit identifies scripts and stylesheets that delay ad tag library loading. To improve ad loading speed, reduce the number of resources requested before tag loading. Key actions include loading ad tag libraries earlier, inlining critical scripts/stylesheets, marking non-critical scripts with `async` or `defer`, and using the `media` attribute for conditional stylesheet loading. Supported ad tag libraries include AdSense and Google Publisher Tag, each with specific script URLs. The goal is to have minimal or zero items on this list.\n"]]