Skip to content
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

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

katsuo5
Copy link
Contributor

@katsuo5 katsuo5 commented Aug 8, 2023

Type of change

  • Bugfix

Description of change

Fix bug where adServer object are not set in case of twin ad unit.

Copy link
Collaborator

@dgirardi dgirardi left a 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.

Comment on lines 29 to 38
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());
});
Copy link
Collaborator

@dgirardi dgirardi Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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));
});
}

Copy link
Contributor Author

@katsuo5 katsuo5 Aug 22, 2023

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.

@katsuo5 katsuo5 requested a review from dgirardi August 22, 2023 09:06
@ChrisHuie ChrisHuie assigned ChrisHuie and unassigned harpere Aug 29, 2023
@ChrisHuie ChrisHuie merged commit 0138111 into prebid:master Aug 29, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants