โหลดแท็กโฆษณาแบบไม่พร้อมกัน
ภาพรวม
การตรวจสอบนี้ช่วยให้แน่ใจว่าสคริปต์ไลบรารีแท็กโฆษณามีการโหลดแบบไม่พร้อมกัน
โดยค่าเริ่มต้นแล้ว การทํางานของ 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 Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-10-15 UTC
[null,null,["อัปเดตล่าสุด 2024-10-15 UTC"],[[["This audit verifies if ad tag library scripts are loaded asynchronously to improve page performance."],["Asynchronous loading allows the browser to load other content while the script loads in the background, preventing delays and improving user experience."],["To enable asynchronous loading, include the `async` attribute within the `\u003cscript\u003e` tag when implementing ad tags like AdSense and Google Publisher Tag."],["Synchronous loading, where the browser waits for the script to fully load before proceeding, can negatively impact page load times and overall performance."]]],["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"]]