Skip to content

Commit

Permalink
Change ext.data to ext.prebid
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 committed Apr 1, 2021
1 parent 7a54747 commit 7b01ac8
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,23 +613,16 @@ const OPEN_RTB_PROTOCOL = {
return acc;
}, {});

// set a stored request id
const storedrequestId = utils.deepAccess(adUnit, 'pbs.storedImp')
if (storedrequestId) {
const id = typeof storedrequestId === 'string' ? storedrequestId : adUnit.code;
utils.deepSetValue(ext, 'prebid.storedrequest.id', id);
}

const imp = { id: adUnit.code, ext, secure: s2sConfig.secure };

const ortb2 = {...utils.deepAccess(adUnit, 'ortb2Imp.ext.data')};
const ortb2 = {...utils.deepAccess(adUnit, 'ortb2Imp.ext.prebid')};
Object.keys(ortb2).forEach(prop => {
/**
* Prebid AdSlot
* @type {(string|undefined)}
*/
if (prop === 'pbadslot') {
if (typeof ortb2[prop] === 'string' && ortb2[prop]) utils.deepSetValue(imp, 'ext.data.pbadslot', ortb2[prop]);
if (typeof ortb2[prop] === 'string' && ortb2[prop]) utils.deepSetValue(imp, 'ext.prebid.pbadslot', ortb2[prop]);
} else if (prop === 'adserver') {
/**
* Copy GAM AdUnit and Name to imp
Expand All @@ -638,11 +631,11 @@ const OPEN_RTB_PROTOCOL = {
/** @type {(string|undefined)} */
const value = utils.deepAccess(ortb2, `adserver.${name}`);
if (typeof value === 'string' && value) {
utils.deepSetValue(imp, `ext.data.adserver.${name.toLowerCase()}`, value);
utils.deepSetValue(imp, `ext.prebid.adserver.${name.toLowerCase()}`, value);
}
});
} else {
utils.deepSetValue(imp, `ext.data.${prop}`, ortb2[prop]);
utils.deepSetValue(imp, `ext.prebid.${prop}`, ortb2[prop]);
}
});

Expand Down

0 comments on commit 7b01ac8

Please sign in to comment.