קוד המודעות שיוצרים בחשבון AdSense הוא לחלוטין אסינכרוני. הוא מאפשר זמן אחזור קצר ברשת ומספק למבקרים באתר חוויית משתמש טובה יותר. לפעמים צריך ליצור קוד יחידת מודעות סינכרוני. למשל, אם אתם משתמשים ב-Google Ad Manager או בשרת מודעות אחר שלא תומך בקוד מודעה אסינכרוני.
הערה: אפשר ליצור קוד מודעה סינכרוני רק בשביל יחידות מודעות בגודל קבוע.
כדי לשנות את הקוד הקיים של יחידות מודעות צריך לבצע את העדכונים הבאים:
קוד אסינכרוני של יחידת מודעות:
<script async src="https://pagead2.googlesyndication.com/
pagead/js/adsbygoogle.js"></script>
<!-- leaderboard -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
data-ad-slot="1234567890"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
pagead/js/adsbygoogle.js"></script>
<!-- leaderboard -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
data-ad-slot="1234567890"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
קוד סינכרוני של יחידת מודעות:
<script type="text/javascript">
google_ad_client = "ca-pub-xxxxxxxxxxxxxxxx";
google_ad_slot = "1234567890";
google_ad_width = 728;
google_ad_height = 90;
</script>
<!-- leaderboard -->
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/
pagead/show_ads.js">
</script>
google_ad_client = "ca-pub-xxxxxxxxxxxxxxxx";
google_ad_slot = "1234567890";
google_ad_width = 728;
google_ad_height = 90;
</script>
<!-- leaderboard -->
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/
pagead/show_ads.js">
</script>
הערה: לא מומלץ לשלב קוד מודעה אסינכרוני וסינכרוני באותו דף אינטרנט.