Skip to content

Commit

Permalink
Merge tag '8.26.0' into update-prebid-8.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
toshi17 committed Dec 4, 2023
2 parents a4791e2 + 5202784 commit 1df7b71
Show file tree
Hide file tree
Showing 213 changed files with 16,659 additions and 4,304 deletions.
1 change: 0 additions & 1 deletion PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Follow steps above for general review process. In addition, please verify the fo
- Adapters that accept a floor parameter must also support the [floors module](https://docs.prebid.org/dev-docs/modules/floors.html) -- look for a call to the `getFloor()` function.
- Adapters cannot accept an schain parameter. Rather, they must look for the schain parameter at bidRequest.schain.
- The bidderRequest.refererInfo.referer must be checked in addition to any bidder-specific parameter.
- If they're getting the COPPA flag, it must come from config.getConfig('coppa');
- Page position must come from bidrequest.mediaTypes.banner.pos or bidrequest.mediaTypes.video.pos
- Global OpenRTB fields should come from [getConfig('ortb2');](https://docs.prebid.org/dev-docs/publisher-api-reference/setConfig.html#setConfig-fpd):
- bcat, battr, badv
Expand Down
3 changes: 2 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"NATIVE",
"VIDEO"
"VIDEO",
"UID2_CSTG"
]
27 changes: 22 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ function makeWebpackPkg(extraConfig = {}) {
}
}

function buildCreative() {
return gulp.src(['**/*'])
.pipe(webpackStream(require('./webpack.creative.js')))
.pipe(gulp.dest('build/creative'))
}

function updateCreativeExample(cb) {
const CREATIVE_EXAMPLE = 'integrationExamples/gpt/x-domain/creative.html';
const root = require('node-html-parser').parse(fs.readFileSync(CREATIVE_EXAMPLE));
root.querySelectorAll('script')[0].textContent = fs.readFileSync('build/creative/creative.js')
fs.writeFileSync(CREATIVE_EXAMPLE, root.toString())
cb();
}

function getModulesListToAddInBanner(modules) {
if (!modules || modules.length === helpers.getModuleNames().length) {
return 'All available modules for this version.'
Expand Down Expand Up @@ -405,6 +419,7 @@ function watchTaskMaker(options = {}) {
return function watch(done) {
var mainWatcher = gulp.watch([
'src/**/*.js',
'libraries/**/*.js',
'modules/**/*.js',
].concat(options.alsoWatch));

Expand All @@ -415,8 +430,8 @@ function watchTaskMaker(options = {}) {
}
}

const watch = watchTaskMaker({alsoWatch: ['test/**/*.js'], task: () => gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test))});
const watchFast = watchTaskMaker({livereload: false, task: () => gulp.series('build-bundle-dev')});
const watch = watchTaskMaker({alsoWatch: ['test/**/*.js'], task: () => gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test, buildCreative))});
const watchFast = watchTaskMaker({livereload: false, task: () => gulp.parallel('build-bundle-dev', buildCreative)});

// support tasks
gulp.task(lint);
Expand Down Expand Up @@ -447,21 +462,23 @@ gulp.task('build-bundle-verbose', gulp.series(makeWebpackPkg({
}
}), gulpBundle.bind(null, false)));

gulp.task('build-creative', gulp.series(buildCreative, updateCreativeExample));

// public tasks (dependencies are needed for each task since they can be ran on their own)
gulp.task('test-only', test);
gulp.task('test-all-features-disabled', testTaskMaker({disableFeatures: require('./features.json'), oneBrowser: 'chrome', watch: false}));
gulp.task('test', gulp.series(clean, lint, gulp.series('test-all-features-disabled', 'test-only')));
gulp.task('test', gulp.series(clean, lint, gulp.parallel('build-creative', gulp.series('test-all-features-disabled', 'test-only'))));

gulp.task('test-coverage', gulp.series(clean, testCoverage));
gulp.task(viewCoverage);

gulp.task('coveralls', gulp.series('test-coverage', coveralls));

gulp.task('build', gulp.series(clean, 'build-bundle-prod'));
gulp.task('build', gulp.series(clean, 'build-bundle-prod', 'build-creative'));
gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));

gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', buildCreative, watchFast)));
gulp.task('serve-prod', gulp.series(clean, gulp.parallel('build-bundle-prod', startLocalServer)));
gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true}))));
gulp.task('serve-e2e', gulp.series(clean, 'build-bundle-prod', gulp.parallel(() => startIntegServer(), startLocalServer)));
Expand Down
168 changes: 168 additions & 0 deletions integrationExamples/gpt/tpmn_example.html
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>
121 changes: 121 additions & 0 deletions integrationExamples/gpt/tpmn_serverless_example.html
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>
Loading

0 comments on commit 1df7b71

Please sign in to comment.