Memuat tag iklan secara asinkron
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Ringkasan
Audit ini memastikan skrip library tag iklan dimuat secara asinkron.
Secara default, eksekusi JavaScript dilakukan secara sinkron. Ini berarti bahwa setelah skrip
ditemukan, tidak ada konten lain yang dapat dimuat hingga skrip itu
diunduh, diuraikan, dan dieksekusi. Memilih untuk menjalankan eksekusi asinkron akan mencegah
ini, memungkinkan browser untuk terus memproses resource lain sementara
skrip yang ditentukan dimuat di latar belakang. Hal ini membuat halaman Anda tetap responsif
saat skrip dimuat dan mengurangi waktu yang diperlukan untuk memuat semua hal penting
komponen.
Rekomendasi
Sertakan atribut asinkron dalam definisi tag skrip. Contoh:
AdSense
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
AdSense (iklan Otomatis)
<script async data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Tag Google Publisher
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
Skrip library tag iklan berikut didukung:
Library Tag Iklan |
Skrip |
AdSense |
pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
pagead2.googlesyndication.com/pagead/show_ads.js
|
Tag Google Publisher |
googletagservices.com/tag/js/gpt.js
securepubads.g.doubleclick.net/tag/js/gpt.js
|
Memulai Tag Google Publisher
Rendering asinkron dan mode permintaan GPT
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-25 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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,[]]