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

CadentApertureMX Bid Adapter : update gpid support #11557

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions modules/cadentApertureMXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ export const spec = {
};

// adding gpid support
let gpid = deepAccess(bid, 'ortb2Imp.ext.data.adserver.adslot');
if (!gpid) {
gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
}
let gpid =
deepAccess(bid, 'ortb2Imp.ext.gpid') ||
deepAccess(bid, 'ortb2Imp.ext.data.adserver.adslot') ||
deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');

if (gpid) {
data.ext = {gpid: gpid.toString()};
data.ext = { gpid: gpid.toString() };
}
let typeSpecifics = isVideo ? { video: cadentAdapter.buildVideo(bid) } : { banner: cadentAdapter.buildBanner(bid) };
let bidfloorObj = bidfloor > 0 ? { bidfloor, bidfloorcur: DEFAULT_CUR } : {};
Expand Down
21 changes: 19 additions & 2 deletions test/spec/modules/cadentApertureMXBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,27 @@ describe('cadent_aperture_mx Adapter', function () {
});
});

it('should add gpid to request if present', () => {
it('should add gpid to request if present in ext.gpid', () => {
const gpid = '/12345/my-gpt-tag-0';
let bid = utils.deepClone(bidderRequest.bids[0]);
bid.ortb2Imp = { ext: { gpid, data: { adserver: { adslot: gpid + '1' }, pbadslot: gpid + '2' } } };
let requestWithGPID = spec.buildRequests([bid], bidderRequest);
requestWithGPID = JSON.parse(requestWithGPID.data);
expect(requestWithGPID.imp[0].ext.gpid).to.exist.and.equal(gpid);
});

it('should add gpid to request if present in ext.data.adserver.adslot', () => {
const gpid = '/12345/my-gpt-tag-0';
let bid = utils.deepClone(bidderRequest.bids[0]);
bid.ortb2Imp = { ext: { data: { adserver: { adslot: gpid }, pbadslot: gpid + '1' } } };
let requestWithGPID = spec.buildRequests([bid], bidderRequest);
requestWithGPID = JSON.parse(requestWithGPID.data);
expect(requestWithGPID.imp[0].ext.gpid).to.exist.and.equal(gpid);
});

it('should add gpid to request if present in ext.data.pbadslot', () => {
const gpid = '/12345/my-gpt-tag-0';
let bid = utils.deepClone(bidderRequest.bids[0]);
bid.ortb2Imp = { ext: { data: { adserver: { adslot: gpid } } } };
bid.ortb2Imp = { ext: { data: { pbadslot: gpid } } };
let requestWithGPID = spec.buildRequests([bid], bidderRequest);
requestWithGPID = JSON.parse(requestWithGPID.data);
Expand Down