Skip to content

Commit 7214c8e

Browse files
Rubicon bid adapter/response media type (#12401)
* Migrate queryString to URLSearchParams for rubiconBidAdapter_spec * rubiconBidAdapter: add support response mediaType * rubiconBidadapter: fix semicolon
1 parent d4f7d81 commit 7214c8e

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

modules/rubiconBidAdapter.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,10 @@ export const spec = {
717717
bid.meta.advertiserDomains = Array.isArray(ad.adomain) ? ad.adomain : [ad.adomain];
718718
}
719719

720+
if (ad.emulated_format) {
721+
bid.meta.mediaType = ad.emulated_format;
722+
}
723+
720724
if (ad.creative_type === VIDEO) {
721725
bid.width = associatedBidRequest.params.video.playerWidth;
722726
bid.height = associatedBidRequest.params.video.playerHeight;

test/spec/modules/rubiconBidAdapter_spec.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3784,6 +3784,71 @@ describe('the rubicon adapter', function () {
37843784
expect(bids[0].cpm).to.be.equal(0);
37853785
});
37863786

3787+
it('should use ads.emulated_format if defined for bid.meta.mediaType', function () {
3788+
let response = {
3789+
'status': 'ok',
3790+
'account_id': 14062,
3791+
'site_id': 70608,
3792+
'zone_id': 530022,
3793+
'size_id': 15,
3794+
'alt_size_ids': [
3795+
43
3796+
],
3797+
'tracking': '',
3798+
'inventory': {},
3799+
'ads': [
3800+
{
3801+
'status': 'ok',
3802+
'impression_id': '153dc240-8229-4604-b8f5-256933b9374c',
3803+
'size_id': '15',
3804+
'ad_id': '6',
3805+
'advertiser': 7,
3806+
'network': 8,
3807+
'creative_id': 'crid-9',
3808+
'type': 'script',
3809+
'script': 'alert(\'foo\')',
3810+
'campaign_id': 10,
3811+
'cpm': 0.811,
3812+
'emulated_format': 'video',
3813+
'targeting': [
3814+
{
3815+
'key': 'rpfl_14062',
3816+
'values': [
3817+
'15_tier_all_test'
3818+
]
3819+
}
3820+
]
3821+
},
3822+
{
3823+
'status': 'ok',
3824+
'impression_id': '153dc240-8229-4604-b8f5-256933b9374d',
3825+
'size_id': '43',
3826+
'ad_id': '7',
3827+
'advertiser': 7,
3828+
'network': 8,
3829+
'creative_id': 'crid-9',
3830+
'type': 'script',
3831+
'script': 'alert(\'foo\')',
3832+
'campaign_id': 10,
3833+
'cpm': 0.911,
3834+
'targeting': [
3835+
{
3836+
'key': 'rpfl_14062',
3837+
'values': [
3838+
'43_tier_all_test'
3839+
]
3840+
}
3841+
]
3842+
}
3843+
]
3844+
};
3845+
let bids = spec.interpretResponse({body: response}, {
3846+
bidRequest: bidderRequest.bids[0]
3847+
});
3848+
expect(bids[0].meta.mediaType).to.equal('banner');
3849+
expect(bids[1].meta.mediaType).to.equal('video');
3850+
});
3851+
37873852
describe('singleRequest enabled', function () {
37883853
it('handles bidRequest of type Array and returns associated adUnits', function () {
37893854
const overrideMap = [];

0 commit comments

Comments
 (0)