Skip to content

Commit

Permalink
gpid support for emx
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin committed Nov 16, 2021
1 parent f96690e commit ab1e5c5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/emx_digitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,17 @@ export const spec = {
tagid,
secure
};

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

if (gpid) {
data.ext = {gpid: gpid.toString()};
}

let typeSpecifics = isVideo ? { video: emxAdapter.buildVideo(bid) } : { banner: emxAdapter.buildBanner(bid) };
let bidfloorObj = bidfloor > 0 ? { bidfloor, bidfloorcur: DEFAULT_CUR } : {};
let emxBid = Object.assign(data, typeSpecifics, bidfloorObj);
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/emx_digitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,21 @@ describe('emx_digital Adapter', function () {
});
});

it('should add gpid to request if present', () => {
// inject gpid
const gpid = '/12345/my-gpt-tag-0';
let bid = utils.deepClone(bidderRequest.bids[0]);
bid.ortb2Imp = { ext: { data: { adserver: { adslot: gpid } } } }; // put gpid in both spots
bid.ortb2Imp = { ext: { data: { pbadslot: gpid } } };

// build bid request
let requestWithGPID = spec.buildRequests([bid], bidderRequest);
requestWithGPID = JSON.parse(requestWithGPID.data);

// ensure gpid inside bid request
expect(requestWithGPID.imp[0].ext.gpid).to.exist.and.equal(gpid);
});

describe('interpretResponse', function () {
let bid = {
'bidder': 'emx_digital',
Expand Down

0 comments on commit ab1e5c5

Please sign in to comment.