קוד המודעות שאתם יוצרים בחשבון 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>
הערה: לא מומלץ לשלב קוד מודעות אסינכרוני וסינכרוני באותו דף אינטרנט.