Skip to content

Commit

Permalink
Improve Digital adapter fix: don't send sizes for instream video (#4427)
Browse files Browse the repository at this point in the history
* Bid floor, https, native ad update

* Update the ad server protocol module

* Adding referrer

* Improve Digital support for video

* Improve Digital adapter: video

* adapter version -> 6.0.0

* Improve Digital adapter: don't send sizes for video
  • Loading branch information
jbartek25 authored and msm0504 committed Nov 11, 2019
1 parent 387f1c9 commit a74ac56
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
14 changes: 9 additions & 5 deletions modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes';
const BIDDER_CODE = 'improvedigital';

export const spec = {
version: '6.0.0',
version: '6.0.1',
code: BIDDER_CODE,
aliases: ['id'],
supportedMediaTypes: [BANNER, NATIVE, VIDEO],
Expand Down Expand Up @@ -170,6 +170,12 @@ export const spec = {
}
};

function isInstreamVideo(bid) {
const videoMediaType = utils.deepAccess(bid, 'mediaTypes.video');
const context = utils.deepAccess(bid, 'mediaTypes.video.context');
return bid.mediaType === 'video' || (videoMediaType && context !== 'outstream');
}

function getNormalizedBidRequest(bid) {
let adUnitId = utils.getBidIdParameter('adUnitCode', bid) || null;
let placementId = utils.getBidIdParameter('placementId', bid.params) || null;
Expand All @@ -189,9 +195,7 @@ function getNormalizedBidRequest(bid) {
const bidFloorCur = utils.getBidIdParameter('bidFloorCur', bid.params);

let normalizedBidRequest = {};
const videoMediaType = utils.deepAccess(bid, 'mediaTypes.video');
const context = utils.deepAccess(bid, 'mediaTypes.video.context');
if (bid.mediaType === 'video' || (videoMediaType && context !== 'outstream')) {
if (isInstreamVideo(bid)) {
normalizedBidRequest.adTypes = [ VIDEO ];
}
if (placementId) {
Expand All @@ -209,7 +213,7 @@ function getNormalizedBidRequest(bid) {
normalizedBidRequest.keyValues = keyValues;
}

if (config.getConfig('improvedigital.usePrebidSizes') === true && bid.sizes && bid.sizes.length > 0) {
if (config.getConfig('improvedigital.usePrebidSizes') === true && !isInstreamVideo(bid) && bid.sizes && bid.sizes.length > 0) {
normalizedBidRequest.format = bid.sizes;
} else if (singleSizeFilter && singleSizeFilter.w && singleSizeFilter.h) {
normalizedBidRequest.size = {};
Expand Down
16 changes: 16 additions & 0 deletions test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ describe('Improve Digital Adapter Tests', function () {
expect(params.bid_request.imp[0].ad_types).to.deep.equal(['video']);
});

it('should not set Prebid sizes in bid request for instream video', function () {
const getConfigStub = sinon.stub(config, 'getConfig');
getConfigStub.withArgs('improvedigital.usePrebidSizes').returns(true);
const bidRequest = Object.assign({}, simpleBidRequest);
bidRequest.mediaTypes = {
video: {
context: 'instream',
playerSize: [640, 480]
}
};
const request = spec.buildRequests([bidRequest])[0];
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
expect(params.bid_request.imp[0].banner.format).to.not.exist;
getConfigStub.restore();
});

it('should not set ad type for outstream video', function() {
const bidRequest = Object.assign({}, simpleBidRequest);
bidRequest.mediaTypes = {
Expand Down

0 comments on commit a74ac56

Please sign in to comment.