Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Quaccia authored and Jason Quaccia committed Sep 29, 2022
1 parent 7bbc251 commit de6864b
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 129 deletions.
138 changes: 10 additions & 128 deletions integrationExamples/gpt/prebidServer_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,150 +32,37 @@
})();

pbjs.que.push(function() {
var adUnits= [
{
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
// floors: {
// currency: 'JPY',
// schema: {
// delimiter: '|',
// fields: [ 'mediaType', 'size' ]
// },
// values: {
// 'banner|300x250': 1.10,
// 'banner|*': 2.10,
// '*|*': 3.10
// }
// },
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
},
{
bidder: 'pubmatic',
params: {
publisherId: '156276', // required
adSlot: 'pubmatic_test', // required
}
},
{
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816
}
}
]
},
{
code: 'div-gpt-ad-1460505748561-1',
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
// floors: {
// currency: 'EUR',
// schema: {
// delimiter: '|',
// fields: [ 'mediaType', 'size' ]
// },
// values: {
// 'banner|300x250': 0.10,
// 'banner|*': 1.10,
// '*|*': 2.10
// }
// },
ortb2Imp: {
ext: {
prebid: {
floors: {
floorMinCur: 'USD',
floorMin: 1
}
}
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
},
{
bidder: 'pubmatic',
params: {
publisherId: '156276', // required
adSlot: 'pubmatic_test', // required
}
},
{
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816
}
}
]
}
];
}];

pbjs.setConfig({
bidderTimeout: 3000,
s2sConfig : {
accountId : '1',
enabled : true, //default value set to false
defaultVendor: 'appnexus',
bidders : ['appnexus', 'pubmatic', 'rubicon'],
bidders : ['appnexus'],
timeout : 1000, //default value is 1000
adapter : 'prebidServer', //if we have any other s2s adapter, default value is s2s
extPrebid: {
floors: {
enabled: true
}
}
},
floors: {
// enforcement: {
// floorDeals: true,
// bidAdjustment: true
// },
data: { // default if endpoint doesn't return in time
currency: 'JPY',
schema: {
fields: ['mediaType', 'size']
},
values: {
'banner|600x500': 6.5,
'*|300x250': 3.3,
'*|video': 3.5,
'banner|*': 2,
}
}
},
// floors: {},
"currency": {
"adServerCurrency": "USD",
"granularityMultiplier": 108,
"defaultRates": {
"USD": { "JPY": 144 }
}
},
debug: true
}
});

pbjs.addAdUnits(adUnits);

pbjs.requestBids({
bidsBackHandler: function(bidResponses) {
initAdserver();
Expand All @@ -186,8 +73,7 @@

<script>
googletag.cmd.push(function() {
googletag.defineSlot('/19968336/header-bid-tag-0', [[728, 90]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
googletag.defineSlot('/19968336/header-bid-tag-1', [[300, 250]], 'div-gpt-ad-1460505748561-1').addService(googletag.pubads());
var rightSlot = googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());

pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
Expand All @@ -204,14 +90,10 @@ <h2>Prebid.js S2S Example</h2>

<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
<div id='div-gpt-ad-1460505748561-1'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-1'); });
</script>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
</body>
</html>

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,80 @@ describe('S2S Adapter', function () {
expect(parsedRequestBody.cur).to.deep.equal(['JPY']);
});

it('should correctly set the floorMin key when multiple bids with various bidfloors exist', function () {
const s2sConfig = Object.assign({}, CONFIG, {
extPrebid: {
floors: {
enabled: true
}
},
bidders: ['b1', 'b2']
});

const bidderRequests = [
{
...BID_REQUESTS[0],
bidderCode: 'b1',
bids: [{
bidder: 'b1',
bidId: 1,
getFloor: () => ({
currency: 'US',
floor: 1.23
})
}]
},
{
...BID_REQUESTS[0],
bidderCode: 'b2',
bids: [{
bidder: 'b2',
bidId: 2,
getFloor: () => ({
currency: 'EUR',
floor: 3.21
})
}],
}
];

const adUnits = [
{
code: 'au1',
transactionId: 't1',
mediaTypes: {
banner: {sizes: [1, 1]}
},
bids: [{bidder: 'b1', bid_id: 1}]
},
{
code: 'au2',
transactionId: 't2',
bids: [{bidder: 'b2', bid_id: 2}],
mediaTypes: {
banner: {sizes: [1, 1]}
}
}
];

const _config = {
s2sConfig: s2sConfig,
};

const s2sBidRequest = utils.deepClone(REQUEST);
s2sBidRequest.s2sConfig = s2sConfig;
s2sBidRequest.ad_units = adUnits;
config.setConfig(_config);

adapter.callBids(s2sBidRequest, bidderRequests, addBidResponse, done, ajax);
const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.imp[0].bidfloor).to.equal(1.23);
expect(requestBid.imp[1].bidfloor).to.equal(3.21);

// first imp floorCur should be set
expect(requestBid.ext.prebid.floors).to.deep.equal({ enabled: true, floorMin: 1.23, floorMinCur: 'US' });
});

it('should correctly set the floorMin key when multiple bids with various bidfloors exist and ortb2Imp contains the lowest floorMin', function () {
const s2sConfig = Object.assign({}, CONFIG, {
extPrebid: {
Expand Down

0 comments on commit de6864b

Please sign in to comment.