diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js
index 61074985597..4ee2226395b 100644
--- a/modules/improvedigitalBidAdapter.js
+++ b/modules/improvedigitalBidAdapter.js
@@ -1,15 +1,15 @@
import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';
import { config } from '../src/config';
-import { BANNER, NATIVE } from '../src/mediaTypes';
+import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes';
const BIDDER_CODE = 'improvedigital';
export const spec = {
- version: '5.3.0',
+ version: '6.0.0',
code: BIDDER_CODE,
aliases: ['id'],
- supportedMediaTypes: [BANNER, NATIVE],
+ supportedMediaTypes: [BANNER, NATIVE, VIDEO],
/**
* Determines whether or not the given bid request is valid.
@@ -87,6 +87,9 @@ export const spec = {
bid.native.impressionTrackers.unshift(bidObject.nurl);
}
bid.mediaType = NATIVE;
+ } else if (bidObject.ad_type && bidObject.ad_type === 'video') {
+ bid.vastXml = bidObject.adm;
+ bid.mediaType = VIDEO;
} else {
// Banner
let nurl = '';
@@ -186,6 +189,11 @@ 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')) {
+ normalizedBidRequest.adTypes = [ VIDEO ];
+ }
if (placementId) {
normalizedBidRequest.placementId = placementId;
} else {
diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js
index 2bff6fba5bc..2d9d51c0d68 100644
--- a/test/spec/modules/improvedigitalBidAdapter_spec.js
+++ b/test/spec/modules/improvedigitalBidAdapter_spec.js
@@ -193,6 +193,38 @@ describe('Improve Digital Adapter Tests', function () {
expect(params.bid_request.referrer).to.equal('https://blah.com/test.html');
});
+ it('should add ad type for instream video', function () {
+ let bidRequest = Object.assign({}, simpleBidRequest);
+ bidRequest.mediaType = 'video';
+ let request = spec.buildRequests([bidRequest])[0];
+ let params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
+ expect(params.bid_request.imp[0].ad_types).to.deep.equal(['video']);
+
+ bidRequest = Object.assign({}, simpleBidRequest);
+ bidRequest.mediaTypes = {
+ video: {
+ context: 'instream',
+ playerSize: [640, 480]
+ }
+ };
+ request = spec.buildRequests([bidRequest])[0];
+ params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
+ expect(params.bid_request.imp[0].ad_types).to.deep.equal(['video']);
+ });
+
+ it('should not set ad type for outstream video', function() {
+ const bidRequest = Object.assign({}, simpleBidRequest);
+ bidRequest.mediaTypes = {
+ video: {
+ context: 'outstream',
+ 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].ad_types).to.not.exist;
+ });
+
it('should add schain', function () {
const schain = '{"ver":"1.0","complete":1,"nodes":[{"asi":"headerlift.com","sid":"xyz","hp":1}]}';
const bidRequest = Object.assign({}, simpleBidRequest);
@@ -456,6 +488,34 @@ describe('Improve Digital Adapter Tests', function () {
}
};
+ const serverResponseVideo = {
+ 'body': {
+ 'id': '687a06c541d8d1',
+ 'site_id': 191642,
+ 'bid': [
+ {
+ 'isNet': false,
+ 'id': '33e9500b21129f',
+ 'advid': '5279',
+ 'price': 1.45888594164456,
+ 'nurl': 'http://ice.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=',
+ 'h': 290,
+ 'pid': 1053688,
+ 'sync': [
+ 'http://link1',
+ 'http://link2'
+ ],
+ 'crid': '422031',
+ 'w': 600,
+ 'cid': '99006',
+ 'adm': '',
+ 'ad_type': 'video'
+ }
+ ],
+ 'debug': ''
+ }
+ };
+
const nativeEventtrackers = [
{
event: 1,
@@ -552,6 +612,22 @@ describe('Improve Digital Adapter Tests', function () {
}
];
+ let expectedBidVideo = [
+ {
+ 'vastXml': '',
+ 'adId': '33e9500b21129f',
+ 'creativeId': '422031',
+ 'cpm': 1.45888594164456,
+ 'currency': 'USD',
+ 'height': 290,
+ 'mediaType': 'video',
+ 'netRevenue': false,
+ 'requestId': '33e9500b21129f',
+ 'ttl': 300,
+ 'width': 600
+ }
+ ];
+
it('should return a well-formed bid', function () {
const bids = spec.interpretResponse(serverResponse);
expect(bids).to.deep.equal(expectedBid);
@@ -667,6 +743,12 @@ describe('Improve Digital Adapter Tests', function () {
delete bids[0].ortbNative;
expect(bids).to.deep.equal(expectedBids);
});
+
+ // Video
+ it('should return a well-formed video bid', function () {
+ const bids = spec.interpretResponse(serverResponseVideo);
+ expect(bids).to.deep.equal(expectedBidVideo);
+ });
});
describe('getUserSyncs', function () {