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 Adapter: add support for video.plcmt #9978

Merged
merged 19 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions modules/freewheel-sspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export const spec = {
var timeInMillis = new Date().getTime();
var keyCode = hashcode(zone + '' + timeInMillis);
var bidfloor = getBidFloor(currentBidRequest, config);
var format = currentBidRequest.params.format;

var requestParams = {
reqType: 'AdsSetup',
Expand Down Expand Up @@ -435,10 +436,17 @@ export const spec = {

// 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;
var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : '';
var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : null;
var videoPlcmt = currentBidRequest.mediaTypes.video.plcmt ? currentBidRequest.mediaTypes.video.plcmt : null;

if (format == 'inbanner') {
videoPlacement = 2;
videoContext = 'In-Banner';
}
requestParams.video_context = videoContext;
requestParams.video_placement = videoPlacement;
requestParams.video_plcmt = videoPlcmt;
}

return {
Expand Down
7 changes: 5 additions & 2 deletions test/spec/modules/freewheel-sspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ 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);
expect(payload.video_context).to.equal(''); ;
expect(payload.video_placement).to.equal(null);
expect(payload.video_plcmt).to.equal(null);
});

it('should add parameters to the tag', () => {
Expand Down Expand Up @@ -367,6 +368,7 @@ describe('freewheelSSP BidAdapter Test', () => {
'video': {
'context': 'outstream',
'placement': 2,
'plcmt': 3,
'playerSize': [300, 600],
}
},
Expand All @@ -382,6 +384,7 @@ describe('freewheelSSP BidAdapter Test', () => {
const payload = request[0].data;
expect(payload.video_context).to.equal('outstream'); ;
expect(payload.video_placement).to.equal(2);
expect(payload.video_plcmt).to.equal(3);
});
})

Expand Down