-
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
gptPreAuction: fix bug where adServer object are not set in case of twin ad unit #10330
gptPreAuction: fix bug where adServer object are not set in case of twin ad unit #10330
Conversation
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.
LGTM. The code you moved around is quite clunky IMO, I have a suggestion to improve it.
Unfortunately I can't figure out how to add import {deepSetValue} from '../src/utils.js';
to the GH suggestion.
modules/gptPreAuction.js
Outdated
adUnitMap[matchingAdUnitCode].forEach((adUnit) => { | ||
adUnit.ortb2Imp = adUnit.ortb2Imp || {}; | ||
adUnit.ortb2Imp.ext = adUnit.ortb2Imp.ext || {}; | ||
adUnit.ortb2Imp.ext.data = adUnit.ortb2Imp.ext.data || {}; | ||
|
||
const context = adUnit.ortb2Imp.ext.data; | ||
context.adserver = context.adserver || {}; | ||
context.adserver.name = 'gam'; | ||
context.adserver.adslot = sanitizeSlotPath(slot.getAdUnitPath()); | ||
}); |
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.
adUnitMap[matchingAdUnitCode].forEach((adUnit) => { | |
adUnit.ortb2Imp = adUnit.ortb2Imp || {}; | |
adUnit.ortb2Imp.ext = adUnit.ortb2Imp.ext || {}; | |
adUnit.ortb2Imp.ext.data = adUnit.ortb2Imp.ext.data || {}; | |
const context = adUnit.ortb2Imp.ext.data; | |
context.adserver = context.adserver || {}; | |
context.adserver.name = 'gam'; | |
context.adserver.adslot = sanitizeSlotPath(slot.getAdUnitPath()); | |
}); | |
if (matchingAdUnitCode) { | |
const adserver = { | |
name: 'gam', | |
adslot: sanitizeSlotPath(slot.getAdUnitPath()) | |
}; | |
adUnitMap[matchingAdUnitCode].forEach((adUnit) => { | |
deepSetValue(adUnit, 'ortb2Imp.ext.data.adserver', Object.assign({}, adUnit.ortb2Imp?.ext?.data?.adserver, adserver)); | |
}); | |
} |
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.
@dgirardi
Thanks for review and suggestion.
I can't figure out how to add import {deepSetValue} from '../src/utils.js'; to the GH suggestion
me too.
so I fixed and committed it in local machine.
Type of change
Description of change
Fix bug where adServer object are not set in case of twin ad unit.