Skip to content

Commit

Permalink
Inventory id and schain support for display (#4426)
Browse files Browse the repository at this point in the history
* supporting schain
  • Loading branch information
DeepthiNeeladri authored and Mike Chowla committed Nov 11, 2019
1 parent c586809 commit 406f638
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
38 changes: 20 additions & 18 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory';
const BIDDER_CODE = 'oneVideo';
export const spec = {
code: 'oneVideo',
ENDPOINT: '//ads.adaptv.advertising.com/rtb/openrtb?ext_id=',
ENDPOINT: 'https://ads.adaptv.advertising.com/rtb/openrtb?ext_id=',
SYNC_ENDPOINT1: 'https://cm.g.doubleclick.net/pixel?google_nid=adaptv_dbm&google_cm&google_sc',
SYNC_ENDPOINT2: 'https://pr-bh.ybp.yahoo.com/sync/adaptv_ortb/{combo_uid}',
SYNC_ENDPOINT3: 'https://sync-tm.everesttech.net/upi/pid/m7y5t93k?redir=https%3A%2F%2Fsync.adap.tv%2Fsync%3Ftype%3Dgif%26key%3Dtubemogul%26uid%3D%24%7BUSER_ID%7D',
Expand Down Expand Up @@ -45,7 +45,9 @@ export const spec = {
return bids.map(bid => {
return {
method: 'POST',
url: location.protocol + spec.ENDPOINT + bid.params.pubId,
/** removing adding local protocal since we
* can get cookie data only if we call with https. */
url: spec.ENDPOINT + bid.params.pubId,
data: getRequestData(bid, consentData),
bidRequest: bid
}
Expand Down Expand Up @@ -193,28 +195,12 @@ function getRequestData(bid, consentData) {
if (bid.params.video.placement) {
bidData.imp[0].video.placement = bid.params.video.placement
}
if (bid.params.video.inventoryid) {
bidData.imp[0].ext.inventoryid = bid.params.video.inventoryid
}
if (bid.params.video.rewarded) {
bidData.imp[0].ext.rewarded = bid.params.video.rewarded
}
if (bid.params.site && bid.params.site.id) {
bidData.site.id = bid.params.site.id
}
if (bid.params.video.sid) {
bidData.source = {
ext: {
schain: {
complete: 1,
nodes: [{
sid: bid.params.video.sid,
rid: bidData.id,
}]
}
}
}
}
} else if (bid.params.video.display == 1) {
bidData.imp[0].banner = {
mimes: bid.params.video.mimes,
Expand All @@ -223,6 +209,22 @@ function getRequestData(bid, consentData) {
pos: bid.params.video.position,
};
}
if (bid.params.video.inventoryid) {
bidData.imp[0].ext.inventoryid = bid.params.video.inventoryid
}
if (bid.params.video.sid) {
bidData.source = {
ext: {
schain: {
complete: 1,
nodes: [{
sid: bid.params.video.sid,
rid: bidData.id,
}]
}
}
}
}
if (isConsentRequired(consentData)) {
bidData.regs = {
ext: {
Expand Down
6 changes: 4 additions & 2 deletions test/spec/modules/oneVideoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('OneVideoBidAdapter', function () {
it('should create a POST request for every bid', function () {
const requests = spec.buildRequests([ bidRequest ]);
expect(requests[0].method).to.equal('POST');
expect(requests[0].url).to.equal(location.protocol + spec.ENDPOINT + bidRequest.params.pubId);
expect(requests[0].url).to.equal(spec.ENDPOINT + bidRequest.params.pubId);
});

it('should attach the bid request object', function () {
Expand Down Expand Up @@ -240,7 +240,8 @@ describe('OneVideoBidAdapter', function () {
position: 1,
delivery: [2],
playbackmethod: [1, 5],
placement: 123,
placement: 1,
inventoryid: 123,
sid: 134,
display: 1
},
Expand All @@ -261,6 +262,7 @@ describe('OneVideoBidAdapter', function () {
expect(data.imp[0].banner.w).to.equal(width);
expect(data.imp[0].banner.h).to.equal(height);
expect(data.imp[0].banner.pos).to.equal(position);
expect(data.imp[0].ext.inventoryid).to.equal(bidRequest.params.video.inventoryid);
expect(data.imp[0].banner.mimes).to.equal(bidRequest.params.video.mimes);
});
it('should send video object when display is other than 1', function () {
Expand Down

0 comments on commit 406f638

Please sign in to comment.