Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-harshad-mane committed Nov 12, 2019
2 parents 870085f + c1aeb2f commit 844ce4e
Show file tree
Hide file tree
Showing 12 changed files with 557 additions and 87 deletions.
122 changes: 61 additions & 61 deletions integrationExamples/gpt/hello_world.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,84 +8,84 @@
-->

<html>
<head>
<script async src="../../build/dev/prebid.js"></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script>
<head>
<script async src="../../build/dev/prebid.js"></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 1000;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]],
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'appnexus',
params: {
placementId: 13144370
}
}]
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]],
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'appnexus',
params: {
placementId: 13144370
}
}]

}];

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>
<script>

</script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
});

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
});
}

setTimeout(function() {
sendAdserverRequest();
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);
</script>
<script>

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>
<body>
<h2>Prebid.js Test</h2>
<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
</script>
</head>

<body>
<h2>Prebid.js Test</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>
</body>
</html>
</script>
</div>
</body>
</html>
118 changes: 118 additions & 0 deletions integrationExamples/gpt/proxistore_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<html>

<head>
<script async src="../../build/dev/prebid.js"></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 1000;

var adUnits = [
{
code: 'div-test-half-page',
mediaTypes: {
banner: {
sizes: [[300, 600]]
}
},
bids: [
{
bidder: 'proxistore',
params: {
website: 'example.com',
language: 'fr'
}
}]
},
{
code: 'rectangle',
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
bids: [{
bidder: 'proxistore',
params: {
website: 'example.com',
language: 'fr'
}
}]
},
{
code: 'leaderboard',
mediaTypes: {
banner: {
sizes: [[970, 250]]
}
},
bids: [{
bidder: 'proxistore',
params: {
website: 'example.com',
language: 'fr'
}
}]
}
];

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

</script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function () {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
});

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

setTimeout(function () {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-test-half-page').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

<body>
<h2>Prebid.js Test</h2>

<h5>Div-1</h5>

<div id='div-test-half-page'>
<script type='text/javascript'>
googletag.cmd.push(function () { googletag.display('div-test-half-page'); });
</script>
</div>
</body>

</html>
7 changes: 4 additions & 3 deletions modules/brightcomBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ function buildRequests(bidReqs, bidderRequest) {
const brightcomImps = [];
const publisherId = utils.getBidIdParameter('publisherId', bidReqs[0].params);
utils._each(bidReqs, function (bid) {
bid.sizes = ((utils.isArray(bid.sizes) && utils.isArray(bid.sizes[0])) ? bid.sizes : [bid.sizes]);
bid.sizes = bid.sizes.filter(size => utils.isArray(size));
const processedSizes = bid.sizes.map(size => ({w: parseInt(size[0], 10), h: parseInt(size[1], 10)}));
let bidSizes = (bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes) || bid.sizes;
bidSizes = ((utils.isArray(bidSizes) && utils.isArray(bidSizes[0])) ? bidSizes : [bidSizes]);
bidSizes = bidSizes.filter(size => utils.isArray(size));
const processedSizes = bidSizes.map(size => ({w: parseInt(size[0], 10), h: parseInt(size[1], 10)}));

const element = document.getElementById(bid.adUnitCode);
const minSize = _getMinSize(processedSizes);
Expand Down
16 changes: 12 additions & 4 deletions modules/brightcomBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,25 @@ Brightcom's adapter integration to the Prebid library.
var adUnits = [
{
code: 'test-leaderboard',
sizes: [[728, 90]],
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
bids: [{
bidder: 'brightcom',
params: {
publisherId: 2141020,
bidFloor: 0.01
publisherId: 2141020,
bidFloor: 0.01
}
}]
}, {
code: 'test-banner',
sizes: [[300, 250]],
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
bids: [{
bidder: 'brightcom',
params: {
Expand Down
7 changes: 4 additions & 3 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,11 @@ const OPEN_RTB_PROTOCOL = {
type: imgTypeId,
w: utils.deepAccess(params, 'sizes.0'),
h: utils.deepAccess(params, 'sizes.1'),
wmin: utils.deepAccess(params, 'aspect_ratios.0.min_width')
wmin: utils.deepAccess(params, 'aspect_ratios.0.min_width'),
hmin: utils.deepAccess(params, 'aspect_ratios.0.min_height')
});
if (!(asset.w || asset.wmin)) {
throw 'invalid img sizes (must provided sizes or aspect_ratios)';
if (!((asset.w && asset.h) || (asset.hmin && asset.wmin))) {
throw 'invalid img sizes (must provide sizes or min_height & min_width if using aspect_ratios)';
}
if (Array.isArray(params.aspect_ratios)) {
// pass aspect_ratios as ext data I guess?
Expand Down
Loading

0 comments on commit 844ce4e

Please sign in to comment.