generate bid.adId uniquely instead of using bidRequest.bidId#3440
generate bid.adId uniquely instead of using bidRequest.bidId#3440jsnellbaker merged 5 commits intomasterfrom
Conversation
harpere
left a comment
There was a problem hiding this comment.
one comment that we might want to address. Otherwise LGTM.
| this.statusMessage = _getStatus(); | ||
| this.adId = _bidId; | ||
| this.adId = utils.getUniqueIdentifierStr(); | ||
| this.requestId = bidRequest && bidRequest.bidId; |
There was a problem hiding this comment.
I noticed that the currency file calls bidfactory.createBid() when conversions fail. There might be some (minor) repercussions since the adId will no longer be maintained in the new bid. Might want to at least change this line in the currency module, from bidId: bid.adId to bidId: bid.requestId to maintain the requestId - though that isn't maintained currently.
There was a problem hiding this comment.
Thanks for the feedback regarding the currency file. I pushed an update for that reference.
jaiminpanchal27
left a comment
There was a problem hiding this comment.
LGTM.
Just one thought, we need to make sure that we only accept multiple bid responses for longform mediaType.
|
As an update in regards to previous comment - based on some internal discussion, we will not be limiting this to only adpod (formerly longform) video mediaTypes. A 1:1 relationship between request.bids and the bid responses was not a strictly enforced requirement from the code-perspective; so we're not going enforce it now as part of this change. |
Type of change
Description of change
This PR modifies the manner in which
bid.adIdis generated inbidfactory.js. Previously it was directly copied from thebidRequest.bidIdand if that wasn't available a new string was generated.The new logic is:
bid.adIdbidRequest.bidIdis set to thebid.requestIdReason for change
The reason for this change is to help allow multiple bid responses be associated to the same bid object. When the
bid.adIdwas set equal to thebidRequest.bidId, it implied a 1:1 relationship between the two objects. Given some of the upcoming changes related to #3379, we want prebid be able to support having multiple bid responses associated to a singlebidRequest.bidsobject. While the rest of core would support this type of association, thebid.adIdwould be copied into the multiplebidresponse objects, which would cause issues when trying to render the bid (as it would grab the first bid that matched rather than the bid that won). By generating unique strings, it addresses this problem.Additional context/information
The
bid.requestIdis meant to be the tie between thebidresponse object and thebidRequest.bidsobject. Thebid.requestIdis a typically populated from adapter files when they're creating the initialbidobject (ie when they're reading their adserver's bid response). So thebid.requestIdwe're setting in thebidfactory.jsis meant to be a back-up in the rare case some adapters don't set the value (like inserverbidServerBidAdapter.js).The changes to the function calls for
getBidRequest()are to line up with the above logic thatbid.requestIdis the lookup field.The change in the
getBidRequest()function is to prevent some false positive results for the unit tests; anundefinedidvalue would match the innersomecheck if one of those sub-fields (egbid_id) didn't exist in the sample/test request object.