Collapsible banner ads

Collapsible banner ads are banner ads that are initially presented as a larger overlay, with a button to collapse them to the originally requested banner size. Collapsible banner ads are intended to improve performance of anchored ads that are otherwise a smaller size. This guide shows how to turn on collapsible banner ads for existing banner placements.

Prerequisites

Implementation

Make sure your banner view is defined with the size you would like users to see in the regular (collapsed) banner state. Include an extras parameter in the ad request with collapsible as the key and the placement of the ad as the value.

The collapsible placement defines how the expanded region anchors to the banner ad.

Placement value Behavior Intended use case
top The top of the expanded ad aligns to the top of the collapsed ad. The ad is placed at the top of the screen.
bottom The bottom of the expanded ad aligns to the bottom of the collapsed ad. The ad is placed at the bottom of the screen.

If the loaded ad is a collapsible banner, the banner shows the collapsible overlay immediately once it's placed in the view hierarchy.

Java

private void loadBannerAd() {
  adView = new AdView(this);
  adView.setAdUnitId("ca-app-pub-3940256099942544/2014213617")

  AdSize adSize = getAdSize();
  adView.setAdSize(adSize);
  // Create an extra parameter that aligns the bottom of the expanded ad to
  // the bottom of the bannerView.
  Bundle extras = new Bundle();
  extras.putString("collapsible", "bottom");

  AdRequest adRequest = new AdRequest.Builder()
      .addNetworkExtrasBundle(AdMobAdapter.class, extras)
     .build();

  adView.loadAd(adRequest);
}

Kotlin

private fun loadBanner() {adView = AdView(this);
  adView.adUnitId = "ca-app-pub-3940256099942544/2014213617"

  adView.setAdSize(adSize)

  // Create an extra parameter that aligns the bottom of the expanded ad to
  // the bottom of the bannerView.
  val extras = Bundle()
  extras.putString("collapsible", "bottom")

  val adRequest = AdRequest.Builder()
    .addNetworkExtrasBundle(AdMobAdapter::class.java, extras)
    .build()

  adView.loadAd(adRequest)
}

Ads refreshing behavior

Refreshing collapsible banner ads to show up every 30 to 120 seconds might be too frequent, leading to a frustrating user experience. For apps that configure auto-refresh in the Ad Manager web interface, we recommend showing only the first ad request as collapsible, and the subsequent refreshed banner ads in that slot at the size of the original request. To do this, pass a UUID as a collapsible_request_id to the ad request:

extras.putString("collapsible_request_id", UUID.randomUUID().toString());

If you want to load another collapsible banner ad later in the session, you can call loadAd() manually with a request containing the collapsible parameter.

Mediation

Collapsible banner ads are only available for Google demand during the beta period. Ads served through mediation show as normal, non-collapsible banner ads.

Ads serving behavior

To maximize performance of your banner ads, ads that don't support a larger-size collapsible overlay could return some collapsible banner requests and render immediately in the regular banner size.