-
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 7: remove support for legacy FPD #8372
Changes from 3 commits
1ddc350
5a05b19
2c02945
6c12156
c3f07cd
d5f3768
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 |
---|---|---|
|
@@ -431,6 +431,10 @@ function newOrtbBidRequest(bidRequest, bidderRequest, currentImps) { | |
deepSetValue(data, 'source.ext.schain', bidRequest.schain); | ||
} | ||
|
||
// TODO: getConfig('fpd.context') should not have worked even with legacy FPD support - 'fpd' gets translated | ||
// into 'ortb2' by `setConfig` | ||
// Unclear what the intent was here - maybe `const {context: siteData, user: userData} = getLegacyFpd(config.getConfig('ortb2'))` ? | ||
// (with PB7 `config.getConfig('ortb2')` should be replaced by `bidderRequest.ortb2`) | ||
const siteData = Object.assign({}, bidRequest.params.inventory, config.getConfig('fpd.context')); | ||
const userData = Object.assign({}, bidRequest.params.visitor, config.getConfig('fpd.user')); | ||
|
||
|
@@ -453,6 +457,8 @@ function newOrtbBidRequest(bidRequest, bidderRequest, currentImps) { | |
deepSetValue(data, 'ext.prebid.bidderconfig.0', bidderData); | ||
} | ||
|
||
// TODO: bidRequest.fpd is not the right place for pbadslot - who's filling that in, if anyone? | ||
// is this meant to be bidRequest.ortb2Imp.ext.data.pbadslot? | ||
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. @adxpremium fyi 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. @dgirardi : it feels safe to assume, largely based on the inability of @adxpremium to add sufficient coverage on their adapter in the outstanding pr, that this is indeed not working correctly and that inmar is the only user of getLegacyFPD |
||
const pbAdSlot = deepAccess(bidRequest, 'fpd.context.pbAdSlot'); | ||
if (typeof pbAdSlot === 'string' && pbAdSlot) { | ||
deepSetValue(data.imp[0].ext, 'context.data.adslot', pbAdSlot); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {deepAccess, mergeDeep} from '../utils.js'; | ||
|
||
/** | ||
* Returns backwards compatible FPD data for modules | ||
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. my only thought here is if it turns out only one adapter is using, eg inmar, would it be better to put this in the inmar adapter itself? 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. yes, that would avoid extra weight for anyone who's not using inmar. I'll update if it turns out that luponmedia does not need the legacy conversion logic. Ideally, inmar would also drop the old format eventually. |
||
*/ | ||
export function getLegacyFpd(ortb2) { | ||
if (typeof ortb2 !== 'object') return; | ||
|
||
let duplicate = {}; | ||
|
||
Object.keys(ortb2).forEach((type) => { | ||
let prop = (type === 'site') ? 'context' : type; | ||
duplicate[prop] = (prop === 'context' || prop === 'user') ? Object.keys(ortb2[type]).filter(key => key !== 'data').reduce((result, key) => { | ||
if (key === 'ext') { | ||
mergeDeep(result, ortb2[type][key]); | ||
} else { | ||
mergeDeep(result, {[key]: ortb2[type][key]}); | ||
} | ||
|
||
return result; | ||
}, {}) : ortb2[type]; | ||
}); | ||
|
||
return duplicate; | ||
} | ||
|
||
/** | ||
* Returns backwards compatible FPD data for modules | ||
*/ | ||
export function getLegacyImpFpd(ortb2Imp) { | ||
if (typeof ortb2Imp !== 'object') return; | ||
|
||
let duplicate = {}; | ||
|
||
if (deepAccess(ortb2Imp, 'ext.data')) { | ||
Object.keys(ortb2Imp.ext.data).forEach((key) => { | ||
if (key === 'pbadslot') { | ||
mergeDeep(duplicate, {context: {pbAdSlot: ortb2Imp.ext.data[key]}}); | ||
} else if (key === 'adserver') { | ||
mergeDeep(duplicate, {context: {adServer: ortb2Imp.ext.data[key]}}); | ||
} else { | ||
mergeDeep(duplicate, {context: {data: {[key]: ortb2Imp.ext.data[key]}}}); | ||
} | ||
}); | ||
} | ||
|
||
return duplicate; | ||
} |
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.
@zandree-owneriq we welcome your feedback on if you still need the data formatted this way or if you would prefer the newer ortb2 formatting?