-
Notifications
You must be signed in to change notification settings - Fork 753
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
Make user.ext.prebid.buyeruids bidder name case insensitive #3152
Conversation
@bsardo We need this PR to go out with PBS 2.0. Can you please help me understand me why this PR is marked blocked and if there is something pending from my side |
Hi @Sonali-More-Xandr. We originally blocked this because we thought it conflicted with #3107 and we wanted to see that merged first, but on second look it appears that was a mistake so I'll remove the label. |
@@ -49,6 +49,7 @@ func TestGoodAmpRequests(t *testing.T) { | |||
"imp-with-stored-resp.json", | |||
"gdpr-no-consentstring.json", | |||
"gdpr.json", | |||
"aliased-buyeruids-case-insensitive.json", |
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 see that you have two test case files that you added for this PR. Would it mean that it also needs to be added in this function?
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.
Good catch! Added it in 07427d6
"ext": { | ||
"prebid": { | ||
"bidder": { | ||
"YahooAds": { |
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.
Also add a test case for the request that has an alias in the request.ext.prebid.aliases
field.
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.
Added in b43a4cf
…with case sensitive bidder name
endpoints/openrtb2/auction.go
Outdated
normalizedCoreBidder, _ := openrtb_ext.NormalizeBidderName(bidderName) | ||
coreBidder := normalizedCoreBidder.String() | ||
if _, ok := deps.bidderMap[coreBidder]; !ok { |
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.
Nitpick: in this PR here https://github.com/prebid/prebid-server/pull/3187/files#diff-785f5ab5ebde657757f3b3c34bf30a939782678d61bf1ea43f844c4f22a012d9R155:~:text=normalizeBidderName%20%20%20%20%20%20%20normalizeBidderName @SyntaxNode introduced a new function in endpoint deps.
This validation function already has deps. Could you please pull latest changes from main branch and call normalize bidder name through the normalizedCoreBidder, _ := deps.normalizeBidderName(bidderName)
. With this change code will be more consistent.
Other than this looks good, local testing looks good too.
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.
Thank you, Veronika! Updated it in 49a8d0e
Sonali, thank you for your updates! Here is a desired behavior. "ext": {
"prebid": {
"bidder": {
"APPnexus": {
"placementId": 1
},
"appNEXUS": {
"placementId": 2
},
"amx": {}
}
}
} We also have this config in user.ext.prebid.buyerids: "user": {
"id": "userId",
"ext": {
"prebid": {
"buyeruids": {
"APPnexUS": "12345"
}
}
}
} in this case "buyeruids": {"APPnexUS": "12345"} should be applied to both "APPnexus" and "appNEXUS", because we need to support case-insesitive comparisons, not case sensitive as it is now. In order to fix this, add next change on top of existing ones in this PR: utils.go -> func prepareUser should be changed to this: func prepareUser(req *openrtb2.BidRequest, givenBidder, syncerKey string, explicitBuyerUIDs map[string]string, usersyncs IdFetcher) bool {
cookieId, hadCookie, _ := usersyncs.GetUID(syncerKey)
buyerIdSet := false
for bidderName, id := range explicitBuyerUIDs {
if strings.EqualFold(bidderName, givenBidder) {
req.User = copyWithBuyerUID(req.User, id)
buyerIdSet = true
break
}
}
if !buyerIdSet && hadCookie {
req.User = copyWithBuyerUID(req.User, cookieId)
}
return hadCookie
} Also I would like you to add a test that explicitly tests what data goes to what bidder. Put this test in |
master code
suggested code #3152 (comment)
Thanks @VeronikaSolovei9 for above suggestion. But something to note is this will change increase time complexity of prebid-server/exchange/utils.go Lines 331 to 364 in 1944dbb
How about preparing lowercase key map from lowerCaseExplicitBuyerUIDs = ... code to have lower case bidder name keys from explicitBuyerUIDs map
for bidder, imps := range impsByBidder {
coreBidder := resolveBidder(bidder, aliases)
reqCopy := *req.BidRequest
reqCopy.Imp = imps
sChainWriter.Write(&reqCopy, bidder)
...
if hadSync := prepareUser(&reqCopy, bidder, syncerKey, explicitBuyerUIDs, auctionRequest.UserSyncs); !hadSync && req.BidRequest.App == nil {
...
func prepareUser(req *openrtb2.BidRequest, givenBidder, syncerKey string, lowerCaseExplicitBuyerUIDs map[string]string, usersyncs IdFetcher) bool {
cookieId, hadCookie, _ := usersyncs.GetUID(syncerKey)
if id, ok := lowerCaseExplicitBuyerUIDs [strings.ToLower(givenBidder)]; ok {
req.User = copyWithBuyerUID(req.User, id)
} else if hadCookie {
req.User = copyWithBuyerUID(req.User, cookieId)
}
return hadCookie
} |
Sure, if this gives the same result! As long as attached test passes and data is returned as expected. |
We need to handle case insensitivity for user.ext.prebid.buyeruids biddernames. This PR updates the biddername look up to use the normalized names for buyeruids.BIDDER.
partially resolves #2400