-
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
Yahoo bid adapter: User sync pixels, consent signals update #10028
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,37 @@ function extractUserSyncUrls(syncOptions, pixels) { | |
return userSyncObjects; | ||
} | ||
|
||
/** | ||
* @param {string} url | ||
* @param {object} consentData | ||
* @param {object} consentData.gpp | ||
* @param {string} consentData.gpp.gppConsent | ||
* @param {array} consentData.gpp.applicableSections | ||
* @param {object} consentData.gdpr | ||
* @param {object} consentData.gdpr.consentString | ||
* @param {object} consentData.gdpr.gdprApplies | ||
* @param {string} consentData.uspConsent | ||
*/ | ||
function updateConsentQueryParams(url, consentData) { | ||
const parameterMap = { | ||
'gdpr_consent': consentData.gdpr.consentString, | ||
'gdpr': consentData.gdpr.gdprApplies ? '1' : '0', | ||
'us_privacy': consentData.uspConsent, | ||
'gpp': consentData.gpp.gppString, | ||
'gpp_sid': consentData.gpp.applicableSections ? consentData.gpp.applicableSections.join(',') : '' | ||
} | ||
|
||
const existingUrl = new URL(url); | ||
const params = existingUrl.searchParams; | ||
|
||
for (const [key, value] of Object.entries(parameterMap)) { | ||
params.set(key, value); | ||
} | ||
|
||
existingUrl.search = params.toString(); | ||
return existingUrl.toString(); | ||
}; | ||
|
||
function getSupportedEids(bid) { | ||
if (isArray(deepAccess(bid, 'userIdAsEids'))) { | ||
return bid.userIdAsEids.filter(eid => { | ||
|
@@ -244,7 +275,9 @@ function generateOpenRtbObject(bidderRequest, bid) { | |
regs: { | ||
ext: { | ||
'us_privacy': bidderRequest.uspConsent ? bidderRequest.uspConsent : '', | ||
gdpr: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? 1 : 0 | ||
gdpr: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? 1 : 0, | ||
gpp: bidderRequest.gppConsent.gppString, | ||
gpp_sid: bidderRequest.gppConsent.applicableSections | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, I work for Magnite and during version testing between 7.50.0 and 7.54.0 we noticed many of our pubs had This is the only PR for the bid adapter during that time and I think it might point to this spot here The object For example on one of our publisher sites we see it throws the following error: An easy fix for this is to change this to be like so: gpp: bidderRequest.gppConsent?.gppString,
gpp_sid: bidderRequest.gppConsent?.applicableSections Let me know if this makes sense. I tested it using Chrome Overrides and can see bid requests going out now: CC @patmmccann |
||
} | ||
}, | ||
source: { | ||
|
@@ -518,6 +551,7 @@ function createRenderer(bidderRequest, bidResponse) { | |
} | ||
return renderer; | ||
} | ||
|
||
/* Utility functions */ | ||
|
||
export const spec = { | ||
|
@@ -634,11 +668,19 @@ export const spec = { | |
return response; | ||
}, | ||
|
||
getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) { | ||
getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) { | ||
const bidResponse = !isEmpty(serverResponses) && serverResponses[0].body; | ||
|
||
if (bidResponse && bidResponse.ext && bidResponse.ext.pixels) { | ||
return extractUserSyncUrls(syncOptions, bidResponse.ext.pixels); | ||
const userSyncObjects = extractUserSyncUrls(syncOptions, bidResponse.ext.pixels); | ||
userSyncObjects.forEach(userSyncObject => { | ||
userSyncObject.url = updateConsentQueryParams(userSyncObject.url, { | ||
gpp: gppConsent, | ||
gdpr: gdprConsent, | ||
uspConsent: uspConsent | ||
}); | ||
}); | ||
return userSyncObjects; | ||
} | ||
|
||
return []; | ||
|
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 here as well I think you need to add safe checks because thee gdpr, gpp and uspConent objects might be undefined or null
Something like that, (not tested)