Skip to content

Commit

Permalink
Implemented schain support for prebid and updated documentation examp…
Browse files Browse the repository at this point in the history
…les for prebid3.0
  • Loading branch information
Rajkumar Natarajan committed Feb 11, 2020
1 parent c99c78f commit 778cae3
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 3 deletions.
9 changes: 9 additions & 0 deletions modules/synacormediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export const spec = {
},
imp: []
};

if (bidderRequest.bids !== undefined && bidderRequest.bids[0] !== undefined) {
const schain = bidderRequest.bids[0].schain;
if (schain !== undefined) {
openRtbBidRequest.source = {};
openRtbBidRequest.source.ext = { schain };
}
}

let seatId = null;

validBidReqs.forEach((bid, i) => {
Expand Down
8 changes: 5 additions & 3 deletions modules/synacormediaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ https://track.technoratimedia.com/openrtb/tags?ID=%%PATTERN:hb_cache_id_synacorm
```
var adUnits = [{
code: 'test-div',
sizes: [
[300, 250]
],
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
bids: [{
bidder: "synacormedia",
params: {
Expand Down
92 changes: 92 additions & 0 deletions test/spec/modules/synacormediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,98 @@ describe('synacormediaBidAdapter ', function () {
});
});

describe('Bid Requests with schain object ', function() {
let validBidReq = {
bidder: 'synacormedia',
params: {
seatId: 'prebid',
placementId: 'demo1',
pos: 1,
video: {}
},
renderer: {
url: '../syncOutstreamPlayer.js'
},
mediaTypes: {
video: {
playerSize: [[300, 250]],
context: 'outstream'
}
},
adUnitCode: 'div-1',
transactionId: '0869f34e-090b-4b20-84ee-46ff41405a39',
sizes: [[300, 250]],
bidId: '22b3a2268d9f0e',
bidderRequestId: '1d195910597e13',
auctionId: '3375d336-2aea-4ee7-804c-6d26b621ad20',
src: 'client',
bidRequestsCount: 1,
bidderRequestsCount: 1,
bidderWinsCount: 0
};
let bidderRequest = {
refererInfo: {
referer: 'http://localhost:9999/'
},
bidderCode: 'synacormedia',
auctionId: 'f8a75621-d672-4cbb-9275-3db7d74fb110',
bidderRequestId: '16d438671bfbec',
bids: [
{
bidder: 'synacormedia',
params: {
seatId: 'prebid',
placementId: 'demo1',
pos: 1,
video: {}
},
renderer: {
url: '../syncOutstreamPlayer.js'
},
mediaTypes: {
video: {
playerSize: [[300, 250]],
context: 'outstream'
}
},
adUnitCode: 'div-1',
sizes: [[300, 250]],
bidId: '211c0236bb8f4e',
bidderRequestId: '16d438671bfbec',
auctionId: 'f8a75621-d672-4cbb-9275-3db7d74fb110',
src: 'client',
bidRequestsCount: 1,
bidderRequestsCount: 1,
bidderWinsCount: 0,
schain: {
ver: '1.0',
complete: 1,
nodes: [
{
asi: 'indirectseller.com',
sid: '00001',
hp: 1
}
]
}
}
],
auctionStart: 1580310345205,
timeout: 1000,
start: 1580310345211
};

it('should return valid bid request with schain object', function () {
let req = spec.buildRequests([validBidReq], bidderRequest);
expect(req).to.have.property('method', 'POST');
expect(req).to.have.property('url');
expect(req.url).to.contain('//prebid.technoratimedia.com/openrtb/bids/prebid?src=$$REPO_AND_VERSION$$');
expect(req.data).to.have.property('source');
expect(req.data.source).to.have.property('ext');
expect(req.data.source.ext).to.have.property('schain');
});
});

describe('interpretResponse', function () {
let bidResponse = {
id: '10865933907263896~9998~0',
Expand Down

0 comments on commit 778cae3

Please sign in to comment.