Skip to content
Open
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
19 changes: 13 additions & 6 deletions libraries/riseUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,7 @@ export function buildBidResponse(adUnit) {
netRevenue: adUnit.netRevenue || true,
nurl: adUnit.nurl,
mediaType: adUnit.mediaType,
meta: {
mediaType: adUnit.mediaType
}
meta: buildBidMeta(adUnit)
};

if (adUnit.mediaType === VIDEO) {
Expand All @@ -352,11 +350,20 @@ export function buildBidResponse(adUnit) {
bidResponse.native = { ortb: adUnit.native };
}

if (adUnit.adomain && adUnit.adomain.length) {
bidResponse.meta.advertiserDomains = adUnit.adomain;
return bidResponse;
}

export function buildBidMeta(adUnit) {
const meta = {
mediaType: adUnit.mediaType,
...(adUnit.meta || {})
};

if (!meta.advertiserDomains && adUnit.adomain && adUnit.adomain.length) {
meta.advertiserDomains = adUnit.adomain;
}

return bidResponse;
return meta;
}

export function generateGeneralParams(generalObject, bidderRequest, adapterVersion) {
Expand Down
45 changes: 45 additions & 0 deletions test/spec/modules/riseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,51 @@ describe('riseAdapter', function () {
const result = spec.interpretResponse({ body: response });
expect(result[2].native).to.eql(expectedNativeResponse.native)
});

it('should include meta fields from server response', function () {
const responseWithMeta = {
bids: [{
cpm: 1.5,
vastXml: '<VAST/>',
width: 640,
height: 480,
requestId: 'test-id',
creativeId: 'cr-1',
nurl: 'http://example.com/win',
mediaType: VIDEO,
meta: {
advertiserDomains: ['example.com'],
primaryCatId: 'IAB1-1',
secondaryCatIds: ['IAB1-2', 'IAB1-3']
}
}]
};
const result = spec.interpretResponse({ body: responseWithMeta });
expect(result[0].meta).to.deep.equal({
mediaType: VIDEO,
advertiserDomains: ['example.com'],
primaryCatId: 'IAB1-1',
secondaryCatIds: ['IAB1-2', 'IAB1-33']
});
});

it('should fall back to adomain for advertiserDomains when meta is absent', function () {
const responseWithAdomain = {
bids: [{
cpm: 1.5,
ad: '<div/>',
width: 300,
height: 250,
requestId: 'test-id',
creativeId: 'cr-1',
nurl: 'http://example.com/win',
mediaType: BANNER,
adomain: ['fallback.com']
}]
};
const result = spec.interpretResponse({ body: responseWithAdomain });
expect(result[0].meta.advertiserDomains).to.deep.equal(['fallback.com']);
});
})

describe('getUserSyncs', function() {
Expand Down
Loading