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

前提条件
实现
请确保横幅广告视图的定义尺寸与您希望用户在常规(已收起)横幅广告状态下看到的尺寸一致。在广告请求中添加 extras 参数,将 collapsible
作为键,并将广告的展示位置作为值。
可收起的展示位置用于定义展开区域如何锚定到横幅广告。
Placement 值
|
行为 |
预期用例 |
top |
展开式广告的顶部与收起式广告的顶部对齐。 |
广告位于屏幕顶部。 |
bottom |
展开的广告底部与收起的广告底部对齐。 |
广告位于屏幕底部。 |
如果所加载的广告是可收起的横幅广告,则该横幅广告在放置到视图层次结构中后,会立即显示可收起的叠加层。
private void LoadBannerAd()
{
var bannerView = new BannerView(_adUnitId, AdSize.Banner, AdPosition.Bottom);
var adRequest = new AdRequest();
// Create an extra parameter that aligns the bottom of
// the expanded ad to the bottom of the bannerView.
adRequest.Extras.Add("collapsible", "bottom");
bannerView.LoadAd(adRequest);
}
广告刷新行为
对于在 Ad Manager 网页界面中为横幅广告配置自动刷新的应用,当为横幅广告位请求折叠式横幅广告时,后续的广告刷新不会再请求折叠式横幅广告。这是因为,在每次刷新时都显示折叠式横幅广告可能会对用户体验产生负面影响。
如果您想在会话中的稍晚时间再加载一个折叠式横幅广告,您可以使用包含 collapsible 参数的请求手动加载广告。
检查已加载的广告是否可收起
非可折叠式横幅广告可以针对可折叠式横幅广告请求返回,以最大限度地提升广告效果。调用 isCollapsible
以检查上次加载的横幅是否可收起。如果请求无法加载且上一个横幅可收起,则 API 会返回 true。
_bannerView.OnBannerAdLoaded += () =>
{
Debug.Log(_bannerView.IsCollapsible()
? "Banner is collapsible."
: "Banner is not collapsible.");
};
折叠式横幅广告仅适用于 Google 需求来源。通过中介投放的广告会显示为常规的不可收起的横幅广告。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-25。
[null,null,["最后更新时间 (UTC):2025-02-25。"],[[["Collapsible banner ads, initially larger overlays, collapse to the requested banner size, enhancing smaller anchored ad performance."],["To implement, define your banner view's collapsed size and include an extra parameter in the ad request, specifying placement (`top` or `bottom`)."],["While auto-refresh is configured, subsequent refreshes won't request collapsible banners to maintain user experience; manual loading is needed."],["Use `isCollapsible` to verify if the loaded banner is indeed collapsible, helpful when requests fail."],["During the beta period, collapsible banners are exclusive to Google demand, with mediated ads appearing as standard banners."]]],["Collapsible banner ads display as a large overlay initially, then collapse to the standard banner size. To enable this, include an \"extras\" parameter with \"collapsible\" as the key and the placement (\"top\" or \"bottom\") as the value in the ad request. Refreshed ads in automated cases will not be collapsible. To load a new collapsible banner, make a manual request with the \"collapsible\" parameter. To confirm if a loaded banner is collapsible, check using `isCollapsible`. Collapsible ads are only supported for Google demand.\n"]]