โหลดแท็กโฆษณาแบบไม่พร้อมกัน
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ภาพรวม
การตรวจสอบนี้ช่วยให้แน่ใจว่าสคริปต์ไลบรารีแท็กโฆษณาโหลดแบบไม่พร้อมกัน
โดยค่าเริ่มต้น การดำเนินการของ JavaScript จะเป็นแบบซิงโครนัส ซึ่งหมายความว่าเมื่อสคริปต์
พบเนื้อหาอื่น ไม่สามารถโหลดจนกว่าจะบันทึกสคริปต์นั้นเสร็จ
ดาวน์โหลด แยกวิเคราะห์ และดำเนินการแล้ว การเลือกใช้การดำเนินการแบบไม่พร้อมกันจะป้องกัน
ซึ่งทำให้เบราว์เซอร์ยังคงสามารถประมวลผลแหล่งข้อมูลอื่นๆ
สคริปต์ที่ระบุจะถูกโหลดในพื้นหลัง วิธีนี้จะช่วยให้หน้าเว็บของคุณปรับเปลี่ยนตามพื้นที่โฆษณา
ขณะที่สคริปต์กำลังโหลด และลดเวลาที่จำเป็นในการโหลด
คอมโพเนนต์
คำแนะนำ
รวมแอตทริบิวต์ที่ไม่พร้อมกันในการกำหนดแท็กสคริปต์ เช่น
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 และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis audit verifies if ad tag library scripts are loaded asynchronously to improve page performance.\u003c/p\u003e\n"],["\u003cp\u003eAsynchronous loading allows the browser to load other content while the script loads in the background, preventing delays and improving user experience.\u003c/p\u003e\n"],["\u003cp\u003eTo enable asynchronous loading, include the \u003ccode\u003easync\u003c/code\u003e attribute within the \u003ccode\u003e<script>\u003c/code\u003e tag when implementing ad tags like AdSense and Google Publisher Tag.\u003c/p\u003e\n"],["\u003cp\u003eSynchronous loading, where the browser waits for the script to fully load before proceeding, can negatively impact page load times and overall performance.\u003c/p\u003e\n"]]],["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,["# Load ad tag asynchronously\n\nOverview\n--------\n\nThis audit ensures ad tag library scripts are loaded asynchronously.\n\nBy default, JavaScript execution is synchronous. This means that once a script\nis encountered, no other content can be loaded until that script has been\ndownloaded, parsed, and executed. Opting into asynchronous execution prevents\nthis, allowing the browser to continue processing other resources while the\nspecified script is loaded in the background. This keeps your page responsive\nwhile scripts are loading and decreses the time necessary to load all critical\ncomponents.\n\nRecommendations\n---------------\n\nInclude the async attribute in the script tag definition. For example:\n\n### AdSense\n\n \u003cscript async src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"\u003e\u003c/script\u003e\n\n### AdSense (auto ads)\n\n \u003cscript async data-ad-client=\"ca-pub-xxxxxxxxxxxxxxxx\" src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"\u003e\u003c/script\u003e\n\n### Google Publisher Tag\n\n \u003cscript async src=\"https://securepubads.g.doubleclick.net/tag/js/gpt.js\"\u003e\u003c/script\u003e\n\nMore information\n----------------\n\nThe following ad tag library scripts are supported:\n\n| Ad Tag Library | Script(s) |\n|----------------------|-------------------------------------------------------------------------------------------------------------|\n| AdSense | `pagead2.googlesyndication.com/pagead/js/adsbygoogle.js` `pagead2.googlesyndication.com/pagead/show_ads.js` |\n| Google Publisher Tag | `googletagservices.com/tag/js/gpt.js` `securepubads.g.doubleclick.net/tag/js/gpt.js` |\n\n[Get Started with Google Publisher Tags](https://support.google.com/admanager/answer/1638622) \n\n[GPT request modes and asynchronous rendering](https://support.google.com/admanager/answer/183282) \n[View audit source](https://github.com/googleads/publisher-ads-lighthouse-plugin/tree/HEAD/lighthouse-plugin-publisher-ads/audits/async-ad-tags.js) [Improve this article](https://github.com/googleads/publisher-ads-lighthouse-plugin/tree/HEAD/docs/audits/async-ad-tags.md) [Report an issue](https://github.com/googleads/publisher-ads-lighthouse-plugin/issues/new?labels=documentation&template=documentation-feedback.md&title=Documentation+feedback%3A+async-ad-tags.md)\n\n\u003cbr /\u003e"]]