Skip to content

Commit

Permalink
Update conversant adapter to include ttl and netRevenue (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
pycnvr authored and Matt Kendall committed Nov 8, 2017
1 parent a2b5cfa commit c0a1f45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
18 changes: 10 additions & 8 deletions modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { VIDEO } from 'src/mediaTypes';
const BIDDER_CODE = 'conversant';
const URL = '//media.msg.dotomi.com/s2s/header/24';
const SYNC_URL = '//media.msg.dotomi.com/w/user.sync';
const VERSION = '2.2.0';
const VERSION = '2.2.1';

export const spec = {
code: BIDDER_CODE,
Expand Down Expand Up @@ -75,7 +75,10 @@ export const spec = {
copyOptProperty(bid.params, 'tag_id', imp, 'tagid');

if (isVideoRequest(bid)) {
const video = {format: format};
const video = {
w: format[0].w,
h: format[0].h
};

copyOptProperty(bid.params, 'position', video, 'pos');
copyOptProperty(bid.params, 'mimes', video);
Expand Down Expand Up @@ -141,17 +144,16 @@ export const spec = {
requestId: conversantBid.impid,
currency: serverResponse.cur || 'USD',
cpm: responseCPM,
creativeId: conversantBid.crid || ''
creativeId: conversantBid.crid || '',
ttl: 300,
netRevenue: true
};

if (request.video) {
bid.vastUrl = responseAd;
bid.mediaType = 'video';

if (request.video.format.length >= 1) {
bid.width = request.video.format[0].w;
bid.height = request.video.format[0].h;
}
bid.width = request.video.w;
bid.height = request.video.h;
} else {
bid.ad = responseAd + '<img src="' + responseNurl + '" />';
bid.width = conversantBid.w;
Expand Down
10 changes: 8 additions & 2 deletions test/spec/modules/conversantBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ describe('Conversant adapter tests', function() {
expect(payload.imp[3]).to.not.have.property('tagid');
expect(payload.imp[3]).to.have.property('video');
expect(payload.imp[3].video).to.not.have.property('pos');
expect(payload.imp[3].video).to.have.property('format');
expect(payload.imp[3].video.format).to.deep.equal([{w: 640, h: 480}]);
expect(payload.imp[3].video).to.have.property('w', 640);
expect(payload.imp[3].video).to.have.property('h', 480);
expect(payload.imp[3].video).to.have.property('mimes');
expect(payload.imp[3].video.mimes).to.deep.equal(['video/mp4', 'video/x-flv']);
expect(payload.imp[3].video).to.have.property('protocols');
Expand Down Expand Up @@ -243,6 +243,8 @@ describe('Conversant adapter tests', function() {
expect(bid).to.have.property('width', 300);
expect(bid).to.have.property('height', 250);
expect(bid).to.have.property('ad', 'markup000<img src="notify000" />');
expect(bid).to.have.property('ttl', 300);
expect(bid).to.have.property('netRevenue', true);

// There is no bid001 because cpm is $0

Expand All @@ -254,6 +256,8 @@ describe('Conversant adapter tests', function() {
expect(bid).to.have.property('width', 300);
expect(bid).to.have.property('height', 600);
expect(bid).to.have.property('ad', 'markup002<img src="notify002" />');
expect(bid).to.have.property('ttl', 300);
expect(bid).to.have.property('netRevenue', true);

bid = response[2];
expect(bid).to.have.property('requestId', 'bid003');
Expand All @@ -264,6 +268,8 @@ describe('Conversant adapter tests', function() {
expect(bid).to.have.property('height', 480);
expect(bid).to.have.property('vastUrl', 'markup003');
expect(bid).to.have.property('mediaType', 'video');
expect(bid).to.have.property('ttl', 300);
expect(bid).to.have.property('netRevenue', true);
});

it('Verify handling of bad responses', function() {
Expand Down

0 comments on commit c0a1f45

Please sign in to comment.