Skip to content

Commit

Permalink
Smartx Bid Adapter: Add meta.advertiserDomains support (prebid#6547)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylinar authored and marc_tappx committed Apr 13, 2021
1 parent 955c472 commit 927496e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/smartxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const spec = {
}

const language = navigator.language ? 'language' : 'userLanguage';

const device = {
h: screen.height,
w: screen.width,
Expand All @@ -157,8 +158,11 @@ export const spec = {
make: navigator.vendor ? navigator.vendor : '',
ua: navigator.userAgent
};

const at = utils.getBidIdParameter('at', bid.params) || 2;

const cur = utils.getBidIdParameter('cur', bid.params) || ['EUR'];

const requestPayload = {
id: utils.generateUUID(),
imp: smartxReq,
Expand All @@ -176,6 +180,7 @@ export const spec = {
at: at,
cur: cur
};

const userExt = {};

// Add GDPR flag and consent string
Expand Down Expand Up @@ -271,6 +276,7 @@ export const spec = {
serverResponseBody.cur = pmb.currency;
}
});

const bid = {
requestId: currentBidRequest.bidId,
currency: serverResponseBody.cur || 'USD',
Expand All @@ -284,7 +290,14 @@ export const spec = {
width: smartxBid.w,
height: smartxBid.h
};

bid.meta = bid.meta || {};
if (smartxBid && smartxBid.adomain && smartxBid.adomain.length > 0) {
bid.meta.advertiserDomains = smartxBid.adomain;
}

const context = utils.deepAccess(currentBidRequest, 'mediaTypes.video.context');

if (context === 'outstream') {
const playersize = utils.deepAccess(currentBidRequest, 'mediaTypes.video.playerSize');
const renderer = Renderer.install({
Expand Down
2 changes: 2 additions & 0 deletions test/spec/modules/smartxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ describe('The smartx adapter', function () {
expect(responses).to.be.an('array').with.length(2);
expect(bidderRequestObj).to.be.an('Object');
expect(bidderRequestObj.bidRequest.bids).to.be.an('array').with.length(2);
expect(responses[0].meta.advertiserDomains[0]).to.equal('abc.com');
expect(responses[0].requestId).to.equal(123);
expect(responses[0].currency).to.equal('USD');
expect(responses[0].cpm).to.equal(12);
Expand All @@ -432,6 +433,7 @@ describe('The smartx adapter', function () {
expect(responses[0].mediaType).to.equal('video');
expect(responses[0].width).to.equal(400);
expect(responses[0].height).to.equal(300);
expect(responses[1].meta.advertiserDomains[0]).to.equal('def.com');
expect(responses[1].requestId).to.equal(124);
expect(responses[1].currency).to.equal('USD');
expect(responses[1].cpm).to.equal(13);
Expand Down

0 comments on commit 927496e

Please sign in to comment.