forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag '8.26.0' into update-prebid-8.26.0
- Loading branch information
Showing
213 changed files
with
16,659 additions
and
4,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[ | ||
"NATIVE", | ||
"VIDEO" | ||
"VIDEO", | ||
"UID2_CSTG" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Prebid.js Banner Example</title> | ||
<!-- Prebid.js --> | ||
<!-- <script async src="prebid.js"></script> --> | ||
<script async src="../../build/dev/prebid.js"></script> | ||
<!-- Google Publisher Tag --> | ||
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script> | ||
<script> | ||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
const customConfigObject = { | ||
"buckets": [{ | ||
"max": 40, | ||
"increment": 0.5 | ||
}] | ||
}; | ||
// Prebid Banner Ad Unit | ||
var adUnits = [ | ||
{ | ||
// Banner adUnit | ||
code: 'banner-div-0', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]], | ||
battr: [] | ||
} | ||
}, | ||
bids: [{ | ||
bidder: 'tpmn', | ||
params: { | ||
inventoryId: 2, | ||
bidFloor: 0.1, | ||
} | ||
}] | ||
}, | ||
{ | ||
// Video adUnit | ||
code: 'video-div-1', | ||
mediaTypes: { | ||
video: { | ||
context: 'outstream', | ||
playerSize: [640, 480], | ||
mimes: ['video/mp4'], | ||
//playbackmethod: [2, 4, 6], | ||
api: [1, 2, 4, 6], | ||
protocols: [3, 4, 7, 8, 10], | ||
placement: 1, | ||
minduration: 0, | ||
maxduration: 60, | ||
startdelay: 0, | ||
skip: 1 | ||
}, | ||
}, | ||
bids: [{ | ||
bidder: 'tpmn', | ||
params: { | ||
inventoryId: 2, | ||
bidFloor: 2.0, | ||
} | ||
}], | ||
renderer: { | ||
options: { | ||
adText : "TPMN Ad", | ||
disableCollapse : true | ||
} | ||
} | ||
} | ||
]; | ||
</script> | ||
<script> | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function () { | ||
googletag.pubads().disableInitialLoad(); | ||
}); | ||
|
||
pbjs.que.push(function () { | ||
pbjs.setConfig({ | ||
debug: true, | ||
enableSendAllBids: false, | ||
priceGranularity: customConfigObject, | ||
userSync: { | ||
userIds: [{ | ||
name: "pubCommonId", | ||
storage: { | ||
name: "pubcid", | ||
type: "cookie", | ||
days: 30 | ||
} | ||
},{ | ||
name: "unifiedId", | ||
storage: { | ||
type: "cookie", | ||
name: "unifiedid", | ||
expires: 60 | ||
} | ||
}], | ||
userIdAsEids: true | ||
} | ||
}); | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.requestBids({ bidsBackHandler: sendAdServerRequest }); | ||
}); | ||
|
||
function sendAdServerRequest() { | ||
if (pbjs.adserverRequestSent) return; | ||
|
||
//Google Ad Server Use Banner | ||
googletag.cmd.push(() => { | ||
googletag | ||
.defineSlot('/19968336/header-bid-tag-0', [300, 250], 'banner-div-0') | ||
.addService(googletag.pubads()); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
|
||
//Direct Rendering Video | ||
var highestCpmBids = pbjs.getHighestCpmBids('video-div-1'); | ||
console.log("highestCpmBids", highestCpmBids); | ||
if (highestCpmBids.length) { | ||
var doc = document.getElementById('video-div-1'); | ||
console.log("highestCpmBids[0].adId", highestCpmBids[0].adId); | ||
pbjs.renderAd(doc, highestCpmBids[0].adId); | ||
} | ||
|
||
// googletag.cmd.push(() => { | ||
// googletag | ||
// .defineSlot('/19968336/header-bid-tag-0', [640, 480], 'video-div-1') | ||
// .addService(googletag.pubads()); | ||
// googletag.pubads().enableSingleRequest(); | ||
// googletag.enableServices(); | ||
// }); | ||
|
||
googletag.cmd.push(function () { | ||
pbjs.que.push(function () { | ||
const adUnitCodes = adUnits.map(adUnit => adUnit.code); | ||
pbjs.setTargetingForGPTAsync(adUnitCodes); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
</script> | ||
|
||
</head> | ||
<body> | ||
<h2>Prebid.js TPMN Banner Example</h2> | ||
<div id='banner-div-0'> | ||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.display('banner-div-0'); | ||
}); | ||
</script> | ||
</div> | ||
<br> | ||
<h2>Prebid.js TPMN Video Example</h2> | ||
<div id='video-div-1' style="width: 640px; height: 480px;"> | ||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.display('video-div-1'); | ||
}); | ||
</script> | ||
</div> | ||
<br> | ||
<div id="targeting-keys"></div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<!-- | ||
This page runs an auction for 2 adunits, simply displaying the results | ||
rather than sending targeting to an ad server. | ||
Notes: | ||
- this approach assumes that the adunit.code is the div name. There | ||
are many other ways to match the adunit to the div. | ||
- this approach won't work for refreshed adunits. For that scenario | ||
you'll need to be more surgical about what's passed into the bidsbackhandler. | ||
- there's not a separate failsafe timeout here. Since there's no call to | ||
an ad server waiting impatiently, Prebid's the only ad game in town and its | ||
timeout is sufficient. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<script> | ||
var adUnits = [ | ||
{ | ||
// Banner adUnit | ||
code: 'banner-div-0', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]], | ||
battr: [] | ||
} | ||
}, | ||
bids: [{ | ||
bidder: 'tpmn', | ||
params: { | ||
inventoryId: 2, | ||
bidFloor: 0.1, | ||
} | ||
}] | ||
}, | ||
{ | ||
// Video adUnit | ||
code: 'video-div-1', | ||
mediaTypes: { | ||
video: { | ||
context: 'outstream', | ||
playerSize: [640, 480], | ||
mimes: ['video/mp4'], | ||
playbackmethod: [2, 4, 6], | ||
api: [1, 2, 4, 6], | ||
protocols: [3, 4, 7, 8, 10], | ||
placement: 1, | ||
minduration: 0, | ||
maxduration: 60, | ||
startdelay: 0, | ||
skip: 1 | ||
}, | ||
}, | ||
bids: [{ | ||
bidder: 'tpmn', | ||
params: { | ||
inventoryId: 2, | ||
bidFloor: 2.0, | ||
} | ||
}], | ||
renderer: { | ||
options: { | ||
adText : "TPMN Ad", | ||
disableCollapse : true | ||
} | ||
} | ||
} | ||
]; | ||
|
||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
</script> | ||
<script async src="../../build/dev/prebid.js"></script> | ||
|
||
<script> | ||
pbjs.que.push(function() { | ||
pbjs.addAdUnits(adUnits); | ||
}); | ||
|
||
// you could instead pass an array of adUnits | ||
// to getHighestCpmBids() if desired | ||
function renderAllAdUnits() { | ||
var winners=pbjs.getHighestCpmBids(); | ||
for (var i = 0; i < winners.length; i++) { | ||
renderOne(winners[i]); | ||
} | ||
} | ||
|
||
function renderOne(winningBid) { | ||
if (winningBid && winningBid.adId) { | ||
var div = document.getElementById(winningBid.adUnitCode); | ||
if (div) { | ||
let iframe = document.createElement('iframe'); | ||
iframe.frameBorder = '0'; | ||
div.appendChild(iframe); | ||
var iframeDoc = iframe.contentWindow.document; | ||
pbjs.renderAd(iframeDoc, winningBid.adId); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<script> | ||
pbjs.que.push(function() { | ||
pbjs.requestBids({ | ||
timeout: 2000, | ||
bidsBackHandler: renderAllAdUnits | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h2>Ad Serverless Test Page</h2> | ||
|
||
<div id='banner-div-0'></div> | ||
<br/> | ||
<div id='video-div-1' style="width: 640px; height: 480px;"></div> | ||
</body> | ||
</html> |
Oops, something went wrong.