-
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
Prebid Server: fixes User ID support, also adds OpenRTB 'cur' property #3884
Prebid Server: fixes User ID support, also adds OpenRTB 'cur' property #3884
Conversation
5de59ce
to
4bf46ee
Compare
30c24ec
to
ee98402
Compare
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.
Hi @idettman
Thanks for putting these changes together; it overall looks good. There are some thoughts/questions I had at some areas which I noted down below.
Important note however - I ran into an issue while testing the prebidServer adapter. Can you take a look into it?
// pass user id values from the User ID Module if enabled | ||
const userId = utils.deepAccess(bidRequests, '0.bids.0.userId'); | ||
if (!utils.isEmpty(userId)) { | ||
Object.assign(request.user.ext.tpid, userId); |
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.
Not sure if this error is caused by this logic, but when I loaded the prebidServer_example.html
without any cookies - I got a 400 Bad Request
from the ORTB request.
The error was:
Invalid request: request.user.ext object is not valid: json: cannot unmarshal object into Go struct field ExtUser.tpid of type []openrtb_ext.ExtUserTpID
Inside the request object, the user
field had the following:
"user":{"ext":{"tpid":{}}}
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.
@jsnellbaker - can you paste the ORTB request here? Would like try it against PBS-Go and PBS-Java.
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.
@bretg sure, please see below:
{"id":"348d5124-3a91-41a3-8715-66f8eee2ef1b","source":{"tid":"348d5124-3a91-41a3-8715-66f8eee2ef1b"},"tmax":1000,"imp":[{"id":"div-gpt-ad-1460505748561-0","ext":{"appnexus":{"use_pmt_rule":false,"placement_id":13144370}},"banner":{"format":[{"w":300,"h":250}]}}],"test":1,"ext":{"prebid":{"targeting":{"includewinners":true,"includebidderkeys":false}}},"site":{"publisher":{"id":"1"},"page":"http://test.localhost:9999/integrationExamples/gpt/prebidServer_example.html?pbjs_debug=true"},"device":{"w":1680,"h":291},"user":{"ext":{"tpid":{}}}}
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.
You're right - PBS-Java gives this error: Invalid request format: request.user.ext.tpid[0].source missing required field: "source"
. Removing "tpid":{}
clears it up.
@idettman - please check this case -- if the tpid object is empty, we can't send it or PBS chokes. Thanks.
request.ext.prebid = Object.assign(request.ext.prebid, _s2sConfig.extPrebid); | ||
} | ||
|
||
_appendSiteAppDevice(request); | ||
|
||
const digiTrust = _getDigiTrustQueryParams(); | ||
if (digiTrust) { | ||
request.user = { ext: { digitrust: digiTrust } }; | ||
if (!request.user || !request.user.ext) { | ||
request.user = { ext: { digitrust: digiTrust } }; |
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.
Just to clarify on something, if there was a case where request.user
existed but request.user.ext
didn't - this logic would overwrite the previous value(s) under the user
object. In looking at the surrounding logic/code, I don't think this would be an issue - but wanted to raise it just to be sure.
If there is a doubt, perhaps this could be moved a bit lower (around were we're checking for user.tpid
)?
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.
Yeah the possibility of a user obj with properties being overwritten was real, I like the idea of moving the block down
} else { | ||
request.user.ext = { consent: consentString }; | ||
request.user = { ext: { consent: consentString } }; |
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.
Given the series of nested object assignments we're using in this part of the file, would it make sense to create a new utils
function similar to deepAccess
where it will go through the object chain provided and try to assign the value to the deepest level that exists? This would help simplify some of the code around here.
Ready for re-review |
Sorry Isaac, but the user.ext.tpid part of the PR needs to be deferred due to #3900. |
Type of change
Description of change
Fix: User ID Module support in Prebid Server Adapter
View
userId
diffAdded: OpenRTB property
cur
View
cur
diffOther information
Prebid.js issue #3627