טעינת תג מודעה באופן אסינכרוני
סקירה כללית
הביקורת הזו מבטיחה שהסקריפטים של ספריית תגי המודעות נטענים באופן אסינכרוני.
כברירת מחדל, ביצוע 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 Publisher
<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 Publisher Tag |
googletagservices.com/tag/js/gpt.js
securepubads.g.doubleclick.net/tag/js/gpt.js
|
תחילת העבודה עם Google Publisher Tags
מצבי בקשה של GPT ורינדור אסינכרוני
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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"]]