بنرهای تطبیقی لنگردار
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
بنرهای تطبیقی نسل بعدی تبلیغات ریسپانسیو هستند که با بهینه سازی اندازه تبلیغات برای هر دستگاه، عملکرد را به حداکثر میرسانند. بنرهای تطبیقی با بهبود بنرهای هوشمند، که فقط از ارتفاع ثابت پشتیبانی میکنند، به شما امکان میدهند پهنای آگهی را مشخص کنید و از آن برای تعیین اندازه بهینه آگهی استفاده کنید.
برای انتخاب بهترین اندازه تبلیغات، بنرهای تطبیقی به جای ارتفاع ثابت از نسبت ابعاد ثابت استفاده می کنند. این منجر به تبلیغات بنری می شود که بخش ثابت تری از صفحه نمایش را در سراسر دستگاه ها اشغال می کند و فرصت هایی را برای بهبود عملکرد فراهم می کند.
هنگام کار با بنرهای تطبیقی، توجه داشته باشید که آنها همیشه یک اندازه ثابت برای یک دستگاه و عرض معین برمی گردند. هنگامی که طرحبندی خود را روی یک دستگاه مشخص آزمایش کردید، میتوانید مطمئن باشید که اندازه تبلیغ تغییر نخواهد کرد. با این حال، اندازه خلاقیت بنر ممکن است در دستگاههای مختلف تغییر کند. در نتیجه، توصیه میشود مطمئن شوید که طرحبندی شما میتواند تغییرات ارتفاع آگهی را در خود جای دهد. در موارد نادر، ممکن است اندازه کامل تطبیقی پر نشود و به جای آن یک خلاقیت با اندازه استاندارد در این شکاف متمرکز شود.
زمان استفاده از بنرهای تطبیقی
بنرهای تطبیقی به گونه ای طراحی شده اند که جایگزینی برای اندازه بنر استاندارد صنعتی 320x50 و همچنین فرمت بنر هوشمندی باشند که جایگزین آنها می شود.
این اندازه بنرها معمولاً به عنوان بنرهای لنگردار استفاده می شوند که معمولاً در بالا یا پایین صفحه قفل می شوند. برای چنین بنرهای لنگردار، نسبت ابعاد هنگام استفاده از بنرهای تطبیقی مشابه تبلیغات استاندارد 320x50 خواهد بود، همانطور که در این تصاویر مشاهده می شود:
 بنر 320x50 |  بنر هوشمند |  بنر تطبیقی |
یک بنر تطبیقی از اندازه صفحه نمایش موجود بهتر استفاده می کند. علاوه بر این، در مقایسه با یک بنر هوشمند، یک بنر تطبیقی انتخاب بهتری است زیرا:
از عرض ارائه شده به جای عرض تمام صفحه استفاده می کند و به شما امکان می دهد مناطق امن را در نظر بگیرید.
به جای داشتن ارتفاع ثابت در دستگاههای با اندازههای مختلف، ارتفاع بهینهای را برای دستگاه خاص انتخاب میکند و اثرات تکه تکه شدن دستگاه را کاهش میدهد.
یادداشت های اجرایی
هنگام اجرای بنرهای تطبیقی در برنامه خود، نکات زیر را در نظر داشته باشید:
شما باید عرض نمایی که آگهی در آن قرار می گیرد را بدانید، و این باید عرض دستگاه و مناطق امن قابل اجرا را در نظر بگیرد .
هنگامی که تبلیغات کوچکتر ارائه میشوند که فضای تبلیغات را پر نمیکنند، پسزمینه نمایش تبلیغات شما مبهم باشد تا با خطمشیهای AdMob مطابقت داشته باشد.
مطمئن شوید که از آخرین نسخه Google Mobile Ads C++ SDK استفاده میکنید. برای میانجیگری، از آخرین نسخه هر آداپتور میانجی استفاده کنید.
اندازههای بنر تطبیقی به گونهای طراحی شدهاند که هنگام استفاده از عرض کامل موجود، بهترین عملکرد را داشته باشند. در بیشتر موارد، این عرض تمام صفحه نمایش دستگاه در حال استفاده خواهد بود. حتماً مناطق امن قابل اجرا را در نظر بگیرید.
Google Mobile Ads C++ SDK یک ارتفاع تبلیغات بهینه شده برای عرض معین را در firebase::gma::AdSize
برمی گرداند.
سه روش برای دریافت اندازه آگهی برای بنرهای تطبیقی وجود دارد - یکی برای افقی، یکی برای عمودی و دیگری برای جهت گیری فعلی در زمان اجرا.
اندازه ای که برای یک عرض معین در یک دستگاه معین بازگردانده می شود همیشه یکسان خواهد بود، از این رو هنگامی که طرح بندی خود را در دستگاه مشخصی آزمایش کردید، می توانید مطمئن باشید که اندازه تبلیغ تغییر نخواهد کرد.
ارتفاع بنر لنگر هرگز از 15 درصد ارتفاع دستگاه بیشتر و از 50 نقطه کمتر نیست.
شروع سریع
برای پیاده سازی یک بنر لنگر تطبیقی ساده مراحل زیر را دنبال کنید.
اندازه تبلیغات بنری تطبیقی دریافت کنید. اندازه ای که دریافت می کنید برای درخواست بنر تطبیقی شما استفاده می شود. برای دریافت اندازه آگهی تطبیقی، مطمئن شوید که:
عرض دستگاه مورد استفاده را دریافت کنید، یا اگر نمی خواهید از تمام عرض صفحه استفاده کنید، عرض خود را تنظیم کنید.
از روشهای استاتیک مناسب در کلاس AdSize
، مانند GetCurrentOrientationAnchoredAdaptiveBannerAdSize(uint32_t width)
استفاده کنید تا یک شی AdSize
تطبیقی برای جهت انتخابی دریافت کنید.
با AdSize
تطبیقی که ایجاد کرده اید، Initialize()
در AdView
فراخوانی کنید.
یک مثال کامل در زیر آمده است.
یک شی AdRequest
ایجاد کنید و بنر خود را با استفاده از متد loadAd()
در نمای آگهی آماده شده خود بارگذاری کنید، درست مانند درخواست بنر معمولی.
کد نمونه
در اینجا یک نمونه از AdView
است که یک بنر تطبیقی بارگیری می کند:
// Determine view width in pixels based on your app's current width on the
// device's screen. This process will vary depending on which windowing toolkit
// you're using.
firebase::gma::AdSize adaptive_ad_size =
AdSize::GetCurrentOrientationAnchoredAdaptiveBannerAdSize(view_width);
// my_ad_parent is a reference to an iOS UIView or an Android Activity.
// This is the parent UIView or Activity of the banner view.
firebase::gma::AdParent ad_parent =
static_cast<firebase::gma::AdParent>(my_ad_parent);
firebase::Future<void> result =
ad_view->Initialize(ad_parent, kBannerAdUnit, adaptive_ad_size);
در اینجا، تابع GetCurrentOrientationAnchoredAdaptiveBannerAdSize(uint32_t width)
برای بدست آوردن اندازه یک بنر در یک موقعیت لنگر برای جهت رابط فعلی استفاده می شود. برای از قبل بارگذاری یک بنر لنگر در یک جهت معین، از تابع مربوطه از GetPortraitAnchoredAdaptiveBannerAdSize(uint32_t width)
و GetLandscapeAnchoredAdaptiveBannerAdSize(uint32_t width)
استفاده کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-09-02 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-02 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eAdaptive banners optimize ad size for each device, improving performance by using fixed aspect ratios for a consistent screen presence.\u003c/p\u003e\n"],["\u003cp\u003eThey are drop-in replacements for standard 320x50 banners and smart banners, best used as anchored banners (top or bottom of the screen).\u003c/p\u003e\n"],["\u003cp\u003eAdaptive banners offer advantages over smart banners by utilizing provided width for safe areas and adjusting height for optimal display on various devices.\u003c/p\u003e\n"],["\u003cp\u003eImplementation requires knowing the ad view's width (considering device width and safe areas), using an opaque background, and the latest Google Mobile Ads C++ SDK.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can obtain the adaptive banner size using \u003ccode\u003eAdSize\u003c/code\u003e class methods, considering device width and orientation, to initialize and load the ad view.\u003c/p\u003e\n"]]],["Adaptive banners optimize ad size per device using fixed aspect ratios instead of fixed heights, improving performance and screen usage compared to smart banners. Key actions include determining the ad view width, accounting for safe areas, and using `AdSize` methods (e.g., `GetCurrentOrientationAnchoredAdaptiveBannerAdSize`) to get the optimal ad size for a specific orientation. Developers should ensure opaque ad view backgrounds and use the latest SDK. The returned ad size remains consistent on a given device but may differ across devices.\n"],null,["# Anchored adaptive banners\n\nAdaptive banners are the next generation of responsive ads, maximizing\nperformance by optimizing ad size for each device. Improving on smart banners,\nwhich only supported fixed heights, adaptive banners let you specify the\nad-width and use this to determine the optimal ad size.\n\nTo pick the best ad size, adaptive banners use fixed aspect ratios instead of\nfixed heights. This results in banner ads that occupy a more consistent portion\nof the screen across devices and provide opportunities for improved performance.\n\nWhen working with adaptive banners, note that they will always return a\nconstant size for a given device and width. Once you've tested your layout on a\ngiven device, you can be sure that the ad size will not change. However, the\nsize of the banner creative may change across different devices. Consequently,\nit is recommended to ensure your layout can accommodate variances in ad height.\nIn rare cases, the full adaptive size may not be filled and a standard size\ncreative will be centered in this slot instead.\n\nWhen to use adaptive banners\n----------------------------\n\nAdaptive banners are designed to be a drop-in replacement for the industry\nstandard 320x50 banner size, as well as the smart banner format they supersede.\n\nThese banner sizes are commonly used as anchored banners, which are usually\nlocked to the top or bottom of the screen. For such anchored banners, the aspect\nratio when using adaptive banners will be similar to that of a standard 320x50\nad, as can be seen in these screenshots:\n\n|---------------|--------------|-----------------|\n| 320x50 banner | Smart banner | Adaptive banner |\n\nAn adaptive banner makes better use of the available screen size. Additionally,\ncompared to a smart banner, an adaptive banner is a better choice because:\n\n- It uses a provided width rather than full screen width, enabling you to\n account for safe areas.\n\n- It selects an optimal height for the specific device, rather than having a\n constant height across different sized devices, mitigating the effects of\n device fragmentation.\n\nImplementation notes\n--------------------\n\nWhen implementing adaptive banners in your app, keep the following points in\nmind:\n\n- You must know the width of the view that the ad will be placed in, *and this\n should take into account the device width and any safe areas that are\n applicable*.\n\n- Ensure that your ad view background is opaque to be compliant with AdMob\n policies when smaller ad sizes serve that do not fill the ad slot.\n\n- Ensure you are using the latest version of the Google Mobile Ads C++ SDK. For\n mediation, use the latest version of each mediation adapter.\n\n- The adaptive banner sizes are designed to work best when using the full\n available width. In most cases, this will be the full width of the screen of\n the device in use. Be sure to take into account applicable safe areas.\n\n- The Google Mobile Ads C++ SDK returns an optimized ad height for the given\n width in a `firebase::gma::AdSize`.\n\n- There are three methods to get an ad size for adaptive banners---one for\n landscape, one for portrait, and one for the current orientation at the time\n of execution.\n\n- The size returned for a given width on a given device will always be the same,\n hence once you've tested your layout on a given device, you can be sure that\n the ad size will not change.\n\n- Anchored banner height is never larger than 15% of the device's height and\n never smaller than 50 points.\n\nQuick start\n-----------\n\nFollow the steps below to implement a simple adaptive anchor banner.\n\n1. Get an adaptive banner ad size. The size you get will be used to request\n your adaptive banner. To get the adaptive ad size, make sure that you:\n\n 1. Get the width of the device in use, or set your own width if you don't\n want to use the full width of the screen.\n\n 2. Use the appropriate static methods on the `AdSize` class, such as\n `GetCurrentOrientationAnchoredAdaptiveBannerAdSize(uint32_t width)` to\n get an adaptive `AdSize` object for the chosen orientation.\n\n 3. Invoke `Initialize()` on the `AdView` with the adaptive `AdSize` you've\n created.\n\n A full example is included below.\n2. Create an `AdRequest` object and load your banner using the `loadAd()`\n method on your prepared ad view, just like you would with a normal banner\n request.\n\nSample code\n-----------\n\nHere's an example of an `AdView` that will load an adaptive banner: \n\n // Determine view width in pixels based on your app's current width on the\n // device's screen. This process will vary depending on which windowing toolkit\n // you're using.\n\n firebase::gma::AdSize adaptive_ad_size =\n AdSize::GetCurrentOrientationAnchoredAdaptiveBannerAdSize(view_width);\n\n // my_ad_parent is a reference to an iOS UIView or an Android Activity.\n // This is the parent UIView or Activity of the banner view.\n firebase::gma::AdParent ad_parent =\n static_cast\u003cfirebase::gma::AdParent\u003e(my_ad_parent);\n firebase::Future\u003cvoid\u003e result =\n ad_view-\u003eInitialize(ad_parent, kBannerAdUnit, adaptive_ad_size);\n\nHere, the function\n`GetCurrentOrientationAnchoredAdaptiveBannerAdSize(uint32_t width)` is used to\nget the size for a banner in an anchored position for the current interface\norientation. For pre-loading an anchored banner in a given orientation, use the\nrelevant function from `GetPortraitAnchoredAdaptiveBannerAdSize(uint32_t width)`\nand `GetLandscapeAnchoredAdaptiveBannerAdSize(uint32_t width)`."]]