Repository navigation
Surface winning-bid economics on the original (GAM) API - #1035
Merged
mdanylov-sigma merged 1 commit intoOct 28, 2026
Merged
Conversation
On the original API, Prebid exposes only the bucketed hb_pb keyword. BidInfo now also carries the exact price, currency, creative id and ad id of the bid whose targeting was attached, and the response-level request id. The new AdUnit.fetchDemandBidInfo(adObject, listener) applies the targeting keywords to the ad object like fetchDemand(adObject, listener), but returns the full BidInfo. Bid.hasPrice() tells a missing price apart from 0, so BidInfo.getPrice() is null rather than 0.0 when the bid has no price. BidResponse reads a missing cur or id as "", and BidInfo reports both as null: the SDK forwards cur as sent and does not apply the ORTB default. Android counterpart of prebid/prebid-mobile-ios#1321. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
YuriyVelichkoPI
approved these changes
Oct 28, 2026
YuriyVelichkoPI
left a comment
Contributor
There was a problem hiding this comment.
LGTM with follow up for 4.0
prebid/prebid-mobile-ios#1423
This was referenced Oct 29, 2026
mdanylov-sigma
added a commit
that referenced
this pull request
Nov 14, 2026
- AdUnit kept the previous response until the next network callback, so a fetch that failed validation (no network, empty account id) returned the earlier response's keywords, price and request id with the failure code. fetchDemand now clears it first. - BidInfo.getRequestId documented the id as set whenever a response was received, but NO_BIDS and NO_CACHED_BIDS are reported without the response, including a parsed one that filterOutUncachedBids emptied. The doc now states it is set for SUCCESS and null otherwise. Follow-up to #1035. The native double cache save this branch also fixed landed on master with #1047. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mdanylov-sigma
added a commit
that referenced
this pull request
Nov 30, 2026
- AdUnit kept the previous response until the next network callback, so a fetch that failed validation (no network, empty account id) returned the earlier response's keywords, price and request id with the failure code. fetchDemand now clears it first. - BidInfo.getRequestId documented the id as set whenever a response was received, but NO_BIDS and NO_CACHED_BIDS are reported without the response, including a parsed one that filterOutUncachedBids emptied. The doc now states it is set for SUCCESS and null otherwise. Follow-up to #1035. The native double cache save this branch also fixed landed on master with #1047. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mdanylov-sigma
added a commit
that referenced
this pull request
Nov 30, 2026
- AdUnit kept the previous response until the next network callback, so a fetch that failed validation (no network, empty account id) returned the earlier response's keywords, price and request id with the failure code. fetchDemand now clears it first. - BidInfo.getRequestId documented the id as set whenever a response was received, but NO_BIDS and NO_CACHED_BIDS are reported without the response, including a parsed one that filterOutUncachedBids emptied. The doc now states it is set for SUCCESS and null otherwise. Follow-up to #1035. The native double cache save this branch also fixed landed on master with #1047. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Android counterpart of prebid/prebid-mobile-ios#1321.
Summary
On the original (GAM) API, Prebid exposes only the bucketed
hb_pbkeyword. This adds a way to read the exact economics of the bid whose targeting was attached, without switching to the Rendering API or running a second auction. Purely additive: no existing public API changes.BidInfo: new getters, set inBidInfo.create()from the bid response:getPrice(): the bid's exact net price (ORTBBid.price), as aDouble.getCurrency(): the response'scur, forwarded as sent.nullwhen the response omits it; the SDK does not substitute the ORTB default.getCreativeId(): the creative id (crid).getAdId(): the ad id (adid).getRequestId(): the ORTBBidResponse.id, the per-request UUID the SDK generates. It's response-level.getPrice(),getCurrency(),getCreativeId()andgetAdId()describe the bid whose targeting was attached to the ad object, and arenullunless a bid was designated. Anullprice does not mean a zero-price win. WhenisTopBidFiltered()istrue, they describe the promoted cached runner-up.AdUnit.fetchDemandBidInfo(Object adObject, OnFetchDemandResult listener): likefetchDemand(adObject, listener), it applies the targeting keywords toadObject, but returns the fullBidInfo.PrebidAdUnitalready returns aBidInfo, so its users get the new fields without a new method.Bid.hasPrice(): whether the bid JSON had a numericprice.Bid.getPrice()is unchanged and still returns 0 for a missing price.Notes for reviewers
pricerather thancpm,requestIdrather thanauctionId, and no"USD"fallback. The iOS PR is still in review; if its API changes again, I'll update this one to match.fetchDemandoverload: next tofetchDemand(Object, OnCompleteListener), an overloadfetchDemand(Object, OnFetchDemandResult)makes existing calls such asfetchDemand(adObject, resultCode -> ...)fail with "reference to fetchDemand is ambiguous", because an implicitly typed lambda fits both interfaces (checked with javac). It would also breakPrebidAdUnit, which passes anOnCompleteListenerImpl, a class that implements both interfaces.fetchDemand(adObject, OnCompleteListener)does not forward to the new method. On iOS that kept the main-queue dispatch in one place; on Android it would addBidInfo.create()'s native caching to every existingNativeAdUnitcall.priceas adouble, so3.14comes back as exactly3.14. TheFloatnarrowing the iOS PR had to avoid does not exist here.BidResponsereads a missingcuroridas"".BidInforeports both asnull, matching iOS.BidResponse.getCur()andgetId()are unchanged.NativeAdUnit,fetchDemandBidInfocaches the winning bid twice: once inNativeAdUnit's bid listener and once inBidInfo.create(). The ad object ends up with the second cache id, which is the oneBidInfo.getNativeCacheId()reports. The existingfetchDemand(OnFetchDemandResult)already caches twice the same way; I left that as is.Test plan
BidInfoTest: 7 new tests, parsing a response from JSON text with distinctcrid,adidand responseid. Exact3.14price;"EUR"forwarded as sent; missingcurgivesnull, not""; missing price givesnull, not0.0; a response with bids but no designated winner givesnullbid fields and the response's request id; a promoted runner-up (filterOutUncachedBids) reports its own price0.10; no response gives allnull.AdUnitTest(new):fetchDemandBidInfopasses the ad object through and returns the economics on success, returns the result code without economics on error, saves theBidInfonative cache id to aNativeAdUnitad object, and does nothing with anulllistener.BidInfo.create()mutated (price read withouthasPrice(), rawcur,cridandadidswapped), 4 of the new tests fail, one for each mutation.:PrebidMobile-core:testDebugUnitTest: 1469 tests, 1 failure:MraidInternalBrowserActionTest.handleInternalBrowserActionFollowUrlSuccessAndIsMraid_StartActionViewActivity, which also fails on master (it expects no intent flags in debug builds, but the debug unit-test build getsFLAG_ACTIVITY_NEW_TASK).:PrebidMobile-admobAdapters:testDebugUnitTest: 54 tests, 0 failures.:PrebidMobile-maxAdapters:testDebugUnitTest: 122 tests, 0 failures.🤖 Generated with Claude Code