Charger le tag d'emplacement publicitaire de manière asynchrone
Présentation
Cet audit permet de charger les scripts de bibliothèque de tags d'emplacement publicitaire de manière asynchrone.
Par défaut, l'exécution JavaScript est synchrone. Cela signifie que lorsqu'un script est détecté, aucun autre contenu ne peut être chargé tant que ce script n'a pas été téléchargé, analysé et exécuté. L'activation de l'exécution asynchrone empêche
ce qui permet au navigateur de continuer à traiter d'autres ressources
script spécifié est chargé en arrière-plan. Cela permet à votre page de rester responsive
pendant le chargement des scripts et réduit le temps nécessaire au chargement de toutes les
composants.
Recommandations
Incluez l'attribut "async" dans la définition du tag de script. Exemple :
AdSense
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
AdSense (annonces automatiques)
<script async data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Tag Google Publisher Tag
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
Les scripts de bibliothèque de tags d'emplacement publicitaire suivants sont acceptés :
Bibliothèque de tags d'emplacement publicitaire |
Script(s) |
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
|
Premiers pas avec les tags Google Publisher Tag
Modes de demande avec GPT et affichage asynchrone
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/10/15 (UTC).
[null,null,["Dernière mise à jour le 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"]]