Skip to content

Commit

Permalink
Adf Bid Adapter: set vastUrl (prebid#11243)
Browse files Browse the repository at this point in the history
* Set vastUrl on adfBidAdapter if bidResponse has nurl

* mistype
  • Loading branch information
Pupis authored Mar 20, 2024
1 parent 91512b9 commit b1d4679
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/adfBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,14 @@ export const spec = {
ortb: bidResponse.native
};
} else {
result[ mediaType === VIDEO ? 'vastXml' : 'ad' ] = bidResponse.adm;
if (mediaType === VIDEO) {
result.vastXml = bidResponse.adm;
if (bidResponse.nurl) {
result.vastUrl = bidResponse.nurl;
}
} else {
result.ad = bidResponse.adm;
}
}

if (!bid.renderer && mediaType === VIDEO && deepAccess(bid, 'mediaTypes.video.context') === 'outstream') {
Expand Down
26 changes: 26 additions & 0 deletions test/spec/modules/adfBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,32 @@ describe('Adf adapter', function () {
assert.equal(bids[0].meta.mediaType, 'video');
});

it('should set vastUrl if nurl is present in response', function () {
let vastUrl = 'http://url.to/vast'
let serverResponse = {
body: {
seatbid: [{
bid: [{ impid: '1', adm: '<vast>', nurl: vastUrl, ext: { prebid: { type: 'video' } } }]
}]
}
};
let bidRequest = {
data: {},
bids: [
{
bidId: 'bidId1',
params: { mid: 1000 }
}
]
};

bids = spec.interpretResponse(serverResponse, bidRequest);
assert.equal(bids.length, 1);
assert.equal(bids[0].vastUrl, vastUrl);
assert.equal(bids[0].mediaType, 'video');
assert.equal(bids[0].meta.mediaType, 'video');
});

it('should add renderer for outstream bids', function () {
let serverResponse = {
body: {
Expand Down

0 comments on commit b1d4679

Please sign in to comment.