Skip to content

feat(rendering): expose winning creative size on BannerView - #1007

Open
nsp37 wants to merge 1 commit into
prebid:masterfrom
nsp37:feat/bannerview-expose-won-size
Open

nsp37 wants to merge 1 commit into
prebid:masterfrom
nsp37:feat/bannerview-expose-won-size

Conversation

@nsp37

@nsp37 nsp37 commented Sep 8, 2026

Copy link
Copy Markdown

Fixes #1006.

Problem

The rendering BannerView gives consumers no way to learn which requested size actually won. BannerViewListener.onAdLoaded(BannerView) carries no size and there's no getter for the rendered creative's dimensions. For a multi-size rendering placement (multiple sizes on one BannerView via addAdditionalSizes(...), e.g. 300x250 + 320x50) the host must reserve the bounding box of all requested sizes and, when a smaller creative wins, has no signal to shrink the slot — leaving whitespace. iOS already exposes this via bannerView(_:didReceiveAdWithAdSize:).

Change

Two non-breaking public getters on BannerView:

  • getCreativeWidth() → winning bid width in dp (0 on no-fill)
  • getCreativeHeight() → winning bid height in dp (0 on no-fill)

They delegate to the already-populated bidResponse.getWinningBid() (the same value displayPrebidView() uses to size the child via getWinningBidWidthHeightPairDips). onAdLoaded fires after bidResponse is set, so the value is available at callback time. Getters rather than a new listener method, so no existing implementer breaks.

On the ad-server (GAM) win path the served view owns its size, so these reflect the Prebid winning bid — which is exactly the pure-rendering case this targets.

Notes

  • No behavior change for existing consumers; purely additive read API.
  • iOS parity with didReceiveAdWithAdSize.

Developed with AI assistance.

Add getCreativeWidth()/getCreativeHeight() so consumers can learn which
requested size won inside BannerViewListener.onAdLoaded(BannerView). For a
multi-size rendering placement (e.g. 300x250 + 320x50) the host otherwise
must reserve the bounding box and cannot shrink to the rendered creative.
Non-breaking getters sourced from the already-populated bidResponse winning
bid (dp; 0 on no-fill). iOS already surfaces this via
bannerView(_:didReceiveAdWithAdSize:). Fixes prebid#1006.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rendering BannerView does not expose the winning creative size (multi-size slots can't shrink to the rendered creative)

1 participant