Skip to content

Commit

Permalink
kueezRtb Bid Adapter: Add support for passing metaData object from se…
Browse files Browse the repository at this point in the history
…rver response. (#9815)
  • Loading branch information
saar120 authored Apr 17, 2023
1 parent 2b355bd commit 66a9476
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/kueezRtbBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function interpretResponse(serverResponse, request) {

try {
results.forEach(result => {
const {creativeId, ad, price, exp, width, height, currency, advertiserDomains, mediaType = BANNER} = result;
const {creativeId, ad, price, exp, width, height, currency, metaData, advertiserDomains, mediaType = BANNER} = result;
if (!ad || !price) {
return;
}
Expand All @@ -218,11 +218,20 @@ function interpretResponse(serverResponse, request) {
currency: currency || CURRENCY,
netRevenue: true,
ttl: exp || TTL_SECONDS,
meta: {
advertiserDomains: advertiserDomains || []
}
};

if (metaData) {
Object.assign(response, {
meta: metaData
})
} else {
Object.assign(response, {
meta: {
advertiserDomains: advertiserDomains || []
}
})
}

if (mediaType === BANNER) {
Object.assign(response, {
ad: ad,
Expand Down
13 changes: 13 additions & 0 deletions test/spec/modules/kueezRtbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,19 @@ describe('KueezRtbBidAdapter', function () {
});
});

it('should get meta from response metaData', function () {
const serverResponse = utils.deepClone(SERVER_RESPONSE);
serverResponse.body.results[0].metaData = {
advertiserDomains: ['kueezrtb.com'],
agencyName: 'Agency Name',
};
const responses = adapter.interpretResponse(serverResponse, REQUEST);
expect(responses[0].meta).to.deep.equal({
advertiserDomains: ['kueezrtb.com'],
agencyName: 'Agency Name'
});
});

it('should return an array of interpreted video responses', function () {
const responses = adapter.interpretResponse(VIDEO_SERVER_RESPONSE, REQUEST);
expect(responses).to.have.length(1);
Expand Down

0 comments on commit 66a9476

Please sign in to comment.