تبلیغات را از قبل بارگذاری کنید
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Ads Placement API تبلیغات را برای استفاده در فراخوانی adBreak()
دانلود و ذخیره می کند. بهطور پیشفرض از مجموعهای از اکتشافات خودکار برای تعیین بهترین زمان برای دانلود تبلیغات استفاده میکند. با این حال، این اکتشافات ممکن است به این معنی باشد که یک تبلیغ هنوز قبل از اولین قرار دادن در بازی شما بارگذاری نشده است (مانند اولین تماس شما با adBreak()
درست زمانی که بازی شما در حال بارگیری است).
می توانید این رفتار را با استفاده از adConfig()
تنظیم کنید تا فوراً به صورت زیر بارگذاری اولیه تبلیغات را مجبور کنید.
<script async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-123456789"
crossorigin="anonymous">
</script>
<script>
window.adsbygoogle = window.adsbygoogle || [];
var adBreak = adConfig = function(o) {adsbygoogle.push(o);}
adConfig({preloadAdBreaks: 'on'});
</script>
مهم : اگر میخواهید بارگذاری اولیه تبلیغات را اجباری کنید، باید این تماس را قبل از اولین تماس با adBreak()
انجام دهید. هنگامی که مقداری را برای preloadAdBreaks
تنظیم کردید، هرگونه تلاش بعدی برای تغییر آن نادیده گرفته میشود.
برای اطمینان از اینکه تبلیغات در اوایل بازی شما نمایش داده می شود، می توانید:
- با فراخوانی
adConfig({preloadAdBreaks: 'on'})
مطمئن شوید که تبلیغات از قبل بارگیری شده اند. این تضمین می کند که قبل از اولین تماس با adBreak()
یک تبلیغ آماده وجود دارد. -
data-ad-frequency-hint
کاهش دهید تا تبلیغات بیشتر نشان داده شوند.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Ads Placement API downloads and caches ads for use within your game, utilizing heuristics to optimize download timing.\u003c/p\u003e\n"],["\u003cp\u003eYou can force immediate ad preloading by calling \u003ccode\u003eadConfig({preloadAdBreaks: 'on'})\u003c/code\u003e before your first \u003ccode\u003eadBreak()\u003c/code\u003e call.\u003c/p\u003e\n"],["\u003cp\u003eTo ensure early ad display, preload ads and adjust \u003ccode\u003edata-ad-frequency-hint\u003c/code\u003e for increased frequency.\u003c/p\u003e\n"]]],["The Ads Placement API manages ad downloads and caching for `adBreak()` calls. To ensure ads are ready for the initial placement, use `adConfig({preloadAdBreaks: 'on'})` to force immediate preloading before the first `adBreak()` call. This overrides the default automatic heuristics. Setting `preloadAdBreaks` can only happen once, as subsequent changes are ignored. Another method for early ads is to reduce `data-ad-frequency-hint` so ads are shown more often.\n"],null,["# Preload ads\n\nThe Ads Placement API downloads and caches ads for use in `adBreak()` calls.\nBy default it uses a set of automatic heuristics to determine the best times to\ndownload ads. However, these heuristics may mean that an ad has not yet been\nloaded before the very first placement in your game (such as your first call to\n`adBreak()` just as your game is loading).\n\nYou can adjust this behaviour using the `adConfig()` call to force preloading of\nads immediately as follows. \n\n \u003cscript async\n src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=\u003cvar translate=\"no\"\u003eca-pub-123456789\u003c/var\u003e\"\n crossorigin=\"anonymous\"\u003e\n \u003c/script\u003e\n \u003cscript\u003e\n window.adsbygoogle = window.adsbygoogle || [];\n var adBreak = adConfig = function(o) {adsbygoogle.push(o);}\n adConfig({preloadAdBreaks: 'on'});\n \u003c/script\u003e\n\n**Important** : If you want to force preloading of ads, you\nshould make this call before the first call to `adBreak()`. Once\nyou've set a value for `preloadAdBreaks`, any subsequent attempts to\nchange it are ignored.\n\nTo help ensure that ads show early in you game, you can:\n\n1. Make sure that ads are preloaded by calling `adConfig({preloadAdBreaks: 'on'})`. This ensures that there is an ad ready to go before the first call to `adBreak()`.\n2. Reduce the `data-ad-frequency-hint` so that ads show more frequently."]]