Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeWheel SSP Bid Adapter: support video context and placement #9792

Merged
merged 12 commits into from
Apr 11, 2023
8 changes: 8 additions & 0 deletions modules/freewheel-sspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,14 @@ export const spec = {
requestParams.playerSize = playerSize[0] + 'x' + playerSize[1];
}

// Add video context and placement in requestParams
if (currentBidRequest.mediaTypes.video) {
var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : 'instream';
var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : 1;
requestParams.video_context = videoContext;
requestParams.video_placement = videoPlacement;
}

return {
method: 'GET',
url: FREEWHEEL_ADSSETUP,
Expand Down
37 changes: 37 additions & 0 deletions test/spec/modules/freewheel-sspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ describe('freewheelSSP BidAdapter Test', () => {
}
];

it('should return context and placement with default values', () => {
const request = spec.buildRequests(bidRequests);
const payload = request[0].data;
expect(payload.video_context).to.equal('instream'); ;
expect(payload.video_placement).to.equal(1);
});

it('should add parameters to the tag', () => {
const request = spec.buildRequests(bidRequests);
const payload = request[0].data;
Expand Down Expand Up @@ -319,6 +326,36 @@ describe('freewheelSSP BidAdapter Test', () => {
});
})

describe('buildRequestsForVideoWithContextAndPlacement', () => {
let bidRequests = [
{
'bidder': 'freewheel-ssp',
'params': {
'zoneId': '277225'
},
'adUnitCode': 'adunit-code',
'mediaTypes': {
'video': {
'context': 'outstream',
'placement': 2,
'playerSize': [300, 600],
}
},
'sizes': [[300, 250], [300, 600]],
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
}
];

it('should return input context and placement', () => {
const request = spec.buildRequests(bidRequests);
const payload = request[0].data;
expect(payload.video_context).to.equal('outstream'); ;
expect(payload.video_placement).to.equal(2);
});
})

describe('interpretResponseForBanner', () => {
let bidRequests = [
{
Expand Down