Skip to content

Commit

Permalink
Rubicon bid adapter/response media type (prebid#12401)
Browse files Browse the repository at this point in the history
* Migrate queryString to URLSearchParams for rubiconBidAdapter_spec

* rubiconBidAdapter: add support response mediaType

* rubiconBidadapter: fix semicolon
  • Loading branch information
apukh-magnite authored Nov 4, 2024
1 parent d4f7d81 commit 7214c8e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,10 @@ export const spec = {
bid.meta.advertiserDomains = Array.isArray(ad.adomain) ? ad.adomain : [ad.adomain];
}

if (ad.emulated_format) {
bid.meta.mediaType = ad.emulated_format;
}

if (ad.creative_type === VIDEO) {
bid.width = associatedBidRequest.params.video.playerWidth;
bid.height = associatedBidRequest.params.video.playerHeight;
Expand Down
65 changes: 65 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3784,6 +3784,71 @@ describe('the rubicon adapter', function () {
expect(bids[0].cpm).to.be.equal(0);
});

it('should use ads.emulated_format if defined for bid.meta.mediaType', function () {
let response = {
'status': 'ok',
'account_id': 14062,
'site_id': 70608,
'zone_id': 530022,
'size_id': 15,
'alt_size_ids': [
43
],
'tracking': '',
'inventory': {},
'ads': [
{
'status': 'ok',
'impression_id': '153dc240-8229-4604-b8f5-256933b9374c',
'size_id': '15',
'ad_id': '6',
'advertiser': 7,
'network': 8,
'creative_id': 'crid-9',
'type': 'script',
'script': 'alert(\'foo\')',
'campaign_id': 10,
'cpm': 0.811,
'emulated_format': 'video',
'targeting': [
{
'key': 'rpfl_14062',
'values': [
'15_tier_all_test'
]
}
]
},
{
'status': 'ok',
'impression_id': '153dc240-8229-4604-b8f5-256933b9374d',
'size_id': '43',
'ad_id': '7',
'advertiser': 7,
'network': 8,
'creative_id': 'crid-9',
'type': 'script',
'script': 'alert(\'foo\')',
'campaign_id': 10,
'cpm': 0.911,
'targeting': [
{
'key': 'rpfl_14062',
'values': [
'43_tier_all_test'
]
}
]
}
]
};
let bids = spec.interpretResponse({body: response}, {
bidRequest: bidderRequest.bids[0]
});
expect(bids[0].meta.mediaType).to.equal('banner');
expect(bids[1].meta.mediaType).to.equal('video');
});

describe('singleRequest enabled', function () {
it('handles bidRequest of type Array and returns associated adUnits', function () {
const overrideMap = [];
Expand Down

0 comments on commit 7214c8e

Please sign in to comment.