折叠式横幅广告

折叠式横幅广告最初作为较大的叠加层展示,带有一个按钮,可用于将其收起为最初请求的横幅广告尺寸。折叠式横幅广告旨在提升锚定广告(原本尺寸较小)的效果。本指南介绍了如何为现有横幅广告展示位置启用折叠式横幅广告。

前提条件

实施步骤

请务必为横幅广告视图定义您希望用户在常规(折叠)横幅广告状态下看到的尺寸。在广告请求中添加一个 extras 参数,并将 collapsible 作为键,将广告的展示位置作为值。

折叠式展示位置定义了展开区域如何锚定到横幅广告。

Placement 行为 预期用例
top 展开后的广告的顶部与折叠的广告的顶部对齐。 广告位于屏幕顶部。
bottom 展开后广告的底部与展开前广告的底部对齐。 广告位于屏幕底部。

如果加载的广告是折叠式横幅广告,则横幅广告在放入视图层次结构后会立即显示可折叠式叠加层。

Swift

func loadBannerAd() {
   bannerView.adUnitID = "ca-app-pub-3940256099942544/8388050270"
   bannerView.rootViewController = self
   let viewWidth = FRAME_WIDTH
   bannerView.adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)

   let request = GADRequest()

   // Create an extra parameter that aligns the bottom of the expanded ad to
   // the bottom of the bannerView.
   let extras = GADExtras()
   extras.additionalParameters = ["collapsible" : "bottom"]
   request.register(extras)

   bannerView.load(request)
 }

Objective-C

- (void)loadBannerAd {
  self.bannerView.adUnitID = @"ca-app-pub-3940256099942544/8388050270";
  CGFloat viewWidth = FRAME_WIDTH;
  self.bannerView.adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth);

  GADRequest *request = [GADRequest request];

  // Create an extra parameter that aligns the bottom of the expanded ad to the
  // bottom of the bannerView.
  GADExtras *extras = [[GADExtras alloc] init];
  extras.additionalParameters = @{@"collapsible" : @"bottom"};
  [request registerAdNetworkExtras:extras];

  [self.bannerView loadRequest:request];
}

广告刷新行为

对于在AdMob 网页界面中为横幅广告配置自动刷新的应用,当针对横幅广告位请求折叠式横幅广告时,后续的广告刷新将不会请求折叠式横幅广告。这是因为,在每次刷新时显示折叠式横幅广告,可能会对用户体验产生负面影响。

如果您想稍后在此会话中加载另一个折叠式横幅广告,可以通过包含可折叠参数的请求手动调用 load()

中介

在测试期间,折叠式横幅广告仅面向 Google 需求提供。通过中介投放的广告会以正常的不可折叠横幅广告的形式显示。

广告投放行为

为了最大限度地提升横幅广告的效果,不支持更大尺寸的折叠式叠加层的广告可能会返回一些折叠式横幅广告请求,并立即以常规横幅尺寸呈现。