-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate bid.adId uniquely instead of using bidRequest.bidId #3440
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one comment that we might want to address. Otherwise LGTM.
var _bidSrc = (bidRequest && bidRequest.src) || 'client'; | ||
var _statusCode = statusCode || 0; | ||
|
||
this.bidderCode = (bidRequest && bidRequest.bidder) || ''; | ||
this.width = 0; | ||
this.height = 0; | ||
this.statusMessage = _getStatus(); | ||
this.adId = _bidId; | ||
this.adId = utils.getUniqueIdentifierStr(); | ||
this.requestId = bidRequest && bidRequest.bidId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback regarding the currency
file. I pushed an update for that reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.adId
is generated inbidfactory.js
. Previously it was directly copied from thebidRequest.bidId
and if that wasn't available a new string was generated.The new logic is:
bid.adId
bidRequest.bidId
is set to thebid.requestId
Reason for change
The reason for this change is to help allow multiple bid responses be associated to the same bid object. When the
bid.adId
was 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.bids
object. While the rest of core would support this type of association, thebid.adId
would be copied into the multiplebid
response 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.requestId
is meant to be the tie between thebid
response object and thebidRequest.bids
object. Thebid.requestId
is a typically populated from adapter files when they're creating the initialbid
object (ie when they're reading their adserver's bid response). So thebid.requestId
we're setting in thebidfactory.js
is 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.requestId
is the lookup field.The change in the
getBidRequest()
function is to prevent some false positive results for the unit tests; anundefined
id
value would match the innersome
check if one of those sub-fields (egbid_id
) didn't exist in the sample/test request object.