Skip to content

Commit

Permalink
33across bid adapter: Add adomain support (#6719)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosfelix authored May 6, 2021
1 parent 87ff2b8 commit ed20b83
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
8 changes: 8 additions & 0 deletions modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ function interpretResponse(serverResponse, bidRequest) {

// All this assumes that only one bid is ever returned by ttx
function _createBidResponse(response) {
const isADomainPresent =
response.seatbid[0].bid[0].adomain && response.seatbid[0].bid[0].adomain.length;
const bid = {
requestId: response.id,
bidderCode: BIDDER_CODE,
Expand All @@ -582,6 +584,12 @@ function _createBidResponse(response) {
netRevenue: true
}

if (isADomainPresent) {
bid.meta = {
advertiserDomains: response.seatbid[0].bid[0].adomain
};
}

if (bid.mediaType === VIDEO) {
const vastType = utils.deepAccess(response.seatbid[0].bid[0], 'ext.ttx.vastType', 'xml');

Expand Down
56 changes: 52 additions & 4 deletions test/spec/modules/33acrossBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,8 @@ describe('33acrossBidAdapter:', function () {
crid: 1,
h: 250,
w: 300,
price: 0.0938
price: 0.0938,
adomain: ['advertiserdomain.com']
}]
}
]
Expand All @@ -1430,7 +1431,10 @@ describe('33acrossBidAdapter:', function () {
creativeId: 1,
mediaType: 'banner',
currency: 'USD',
netRevenue: true
netRevenue: true,
meta: {
advertiserDomains: ['advertiserdomain.com']
}
};

expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal([bidResponse]);
Expand All @@ -1456,7 +1460,8 @@ describe('33acrossBidAdapter:', function () {
crid: 1,
h: 250,
w: 300,
price: 0.0938
price: 0.0938,
adomain: ['advertiserdomain.com']
}]
}
]
Expand All @@ -1473,11 +1478,54 @@ describe('33acrossBidAdapter:', function () {
mediaType: 'video',
currency: 'USD',
netRevenue: true,
vastXml: videoBid
vastXml: videoBid,
meta: {
advertiserDomains: ['advertiserdomain.com']
}
};

expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal([bidResponse]);
});

context('when the list of advertiser domains for block list checking is empty', function() {
it('doesn\'t include the empty list in the interpreted response', function() {
const serverResponse = {
cur: 'USD',
ext: {},
id: 'b1',
seatbid: [
{
bid: [{
id: '1',
adm: '<html><h3>I am an ad</h3></html>',
crid: 1,
h: 250,
w: 300,
price: 0.0938,
adomain: [] // Empty list
}]
}
]
};

// Bid response below doesn't contain meta.advertiserDomains
const bidResponse = {
requestId: 'b1',
bidderCode: BIDDER_CODE,
cpm: 0.0938,
width: 300,
height: 250,
ad: '<html><h3>I am an ad</h3></html>',
ttl: 60,
creativeId: 1,
mediaType: 'banner',
currency: 'USD',
netRevenue: true
};

expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal([bidResponse]);
});
});
});

context('when no bids are returned', function() {
Expand Down

0 comments on commit ed20b83

Please sign in to comment.