Skip to content

Commit

Permalink
Merge pull request #22 from prebid/master
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
pro-nsk authored Mar 27, 2024
2 parents 03c89be + 673f44f commit f82a31e
Show file tree
Hide file tree
Showing 187 changed files with 9,946 additions and 1,684 deletions.
91 changes: 91 additions & 0 deletions integrationExamples/gpt/azerionedgeRtdProvider_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<html>
<head>
<meta name="keywords" content="football basketball rugby tenis" />
<script async src="../../build/dev/prebid.js" async></script>
<script
async
src="https://www.googletagservices.com/tag/js/gpt.js"
></script>

<script>
const FAILSAFE_TIMEOUT = 1000;
const PREBID_TIMEOUT = 1000;
const TEST_DIV = "test-div";
const TEST_SIZES = [[300, 250]];
const TEST_OUTPUT = "azerion-segments";
const STORAGE_KEY = "ht-pa-v1-a";
</script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag
.defineSlot("/19968336/header-bid-tag-0", TEST_SIZES, TEST_DIV)
.addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

<script>
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
pbjs.que.push(function () {
pbjs.setConfig({
debug: true,
realTimeData: {
dataProviders: [
{
name: "azerionedge",
waitForIt: true,
params: { bidders: ["appnexus"] },
},
],
},
});
pbjs.setBidderConfig({ bidders: ["appnexus"], config: {} });
pbjs.addAdUnits([
{
code: TEST_DIV,
mediaTypes: { banner: { sizes: TEST_SIZES } },
bids: [{ bidder: "appnexus", params: { placementId: 13144370 } }],
},
]);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT,
});
});

function sendAdserverRequest() {
const output = document.getElementById(TEST_OUTPUT);
output.innerHTML = window.localStorage.getItem(STORAGE_KEY);

if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}
setTimeout(sendAdserverRequest, FAILSAFE_TIMEOUT);
</script>
</head>

<body>
<h2>Azerion Edge RTD</h2>

<div id="test-div">
<script>
googletag.cmd.push(() => googletag.display(TEST_DIV));
</script>
</div>

Segments:
<div id="azerion-segments"></div>
</body>
</html>
84 changes: 84 additions & 0 deletions integrationExamples/gpt/publir_hello_world.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Prebid.js Banner gpt Example</title>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script async src="../../build/dev/prebid.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 1000;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[160, 600]],
}
},
bids: [{
bidder: 'publir',
params: {
pubId: 13144370
}
}]

}];

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() {
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync('div-gpt-ad-1460505748561-0');
googletag.pubads().refresh();
});
});
}

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

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/1011927,22444378655/hre_vcn_4', [[160, 600], [240, 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'>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
</body>

</html>
2 changes: 1 addition & 1 deletion libraries/appnexusUtils/anKeywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function convertKeywordStringToANMap(keyStr) {
}

/**
* @param {Array<String>} kwarray: keywords as an array of strings
* @param {Array<String>} kwarray keywords as an array of strings
* @return {{}} appnexus-style keyword map
*/
function convertKeywordsToANMap(kwarray) {
Expand Down
42 changes: 42 additions & 0 deletions libraries/autoplayDetection/autoplay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
let autoplayEnabled = null;

/**
* Note: this function returns true if detection is not done yet. This is by design: if autoplay is not allowed,
* the call to video.play() will fail immediately, otherwise it may not terminate.
* @returns true if autoplay is not forbidden
*/
export const isAutoplayEnabled = () => autoplayEnabled !== false;

// generated with:
// ask ChatGPT for a 160x90 black PNG image (1/8th the size of 720p)
//
// encode with:
// ffmpeg -i black_image_160x90.png -r 1 -c:v libx264 -bsf:v 'filter_units=remove_types=6' -pix_fmt yuv420p autoplay.mp4
// this creates a 1 second long, 1 fps YUV 4:2:0 video encoded with H.264 without encoder details.
//
// followed by:
// echo "data:video/mp4;base64,$(base64 -i autoplay.mp4)"

const autoplayVideoUrl =
'data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAADxtZGF0AAAAMGWIhAAV//73ye/Apuvb3rW/k89I/Cy3PsIqP39atohOSV14BYa1heKCYgALQC5K4QAAAwZtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAD6AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACMHRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAD6AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAoAAAAFoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAA+gAAAAAAAEAAAAAAahtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAEAAAABAAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAFTbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABE3N0YmwAAACvc3RzZAAAAAAAAAABAAAAn2F2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAoABaAEgAAABIAAAAAAAAAAEVTGF2YzYwLjMxLjEwMiBsaWJ4MjY0AAAAAAAAAAAAAAAY//8AAAA1YXZjQwFkAAr/4QAYZ2QACqzZQo35IQAAAwABAAADAAIPEiWWAQAGaOvjyyLA/fj4AAAAABRidHJ0AAAAAAAAAaAAAAGgAAAAGHN0dHMAAAAAAAAAAQAAAAEAAEAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAADQAAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjYwLjE2LjEwMA==';

function startDetection() {
// we create an HTMLVideoElement muted and not displayed in which we try to play a one frame video
const videoElement = document.createElement('video');
videoElement.src = autoplayVideoUrl;
videoElement.setAttribute('playsinline', 'true');
videoElement.muted = true;

videoElement
.play()
.then(() => {
autoplayEnabled = true;
videoElement.pause();
})
.catch(() => {
autoplayEnabled = false;
});
}

// starts detection as soon as this library is loaded
startDetection();
2 changes: 1 addition & 1 deletion libraries/keywords/keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ORTB_KEYWORDS_PATHS = ['user.keywords'].concat(
);

/**
* @param commaSeparatedKeywords: any number of either keyword arrays, or comma-separated keyword strings
* @param commaSeparatedKeywords any number of either keyword arrays, or comma-separated keyword strings
* @returns an array with all unique keywords contained across all inputs
*/
export function mergeKeywords(...commaSeparatedKeywords) {
Expand Down
2 changes: 2 additions & 0 deletions libraries/objectGuard/objectGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {isData, objectTransformer, sessionedApplies} from '../../src/activities/
import {deepAccess, deepClone, deepEqual, deepSetValue} from '../../src/utils.js';

/**
* @typedef {import('../src/activities/redactor.js').TransformationRuleDef} TransformationRuleDef
* @typedef {import('../src/adapters/bidderFactory.js').TransformationRule} TransformationRule
* @typedef {Object} ObjectGuard
* @property {*} obj a view on the guarded object
* @property {function(): void} verify a function that checks for and rolls back disallowed changes to the guarded object
Expand Down
4 changes: 4 additions & 0 deletions libraries/objectGuard/ortbGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import {
import {objectGuard, writeProtectRule} from './objectGuard.js';
import {mergeDeep} from '../../src/utils.js';

/**
* @typedef {import('./objectGuard.js').ObjectGuard} ObjectGuard
*/

function ortb2EnrichRules(isAllowed = isActivityAllowed) {
return [
{
Expand Down
16 changes: 16 additions & 0 deletions libraries/uid1Eids/uid1Eids.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const UID1_EIDS = {
'tdid': {
source: 'adserver.org',
atype: 1,
getValue: function(data) {
if (data.id) {
return data.id;
} else {
return data;
}
},
getUidExt: function(data) {
return {...{rtiPartner: 'TDID'}, ...data.ext}
}
}
}
1 change: 1 addition & 0 deletions libraries/video/shared/parentModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function ParentModule(submoduleBuilder_) {
}

/**
* @typedef {import('../../../modules/videoModule/coreVideo.js').vendorSubmoduleDirectory} vendorSubmoduleDirectory
* @typedef {Object} SubmoduleBuilder
* @summary Instantiates submodules
* @param {vendorSubmoduleDirectory} submoduleDirectory_
Expand Down
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"airgridRtdProvider",
"akamaiDapRtdProvider",
"arcspanRtdProvider",
"azerionedgeRtdProvider",
"blueconicRtdProvider",
"brandmetricsRtdProvider",
"browsiRtdProvider",
Expand Down
2 changes: 1 addition & 1 deletion modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const ORTB_VIDEO_PARAMS = {
'boxingallowed': (value) => isInteger(value),
'playbackmethod': (value) => isArrayOfNums(value),
'playbackend': (value) => isInteger(value),
'delivery': (value) => isInteger(value),
'delivery': (value) => isArrayOfNums(value),
'pos': (value) => isInteger(value),
'api': (value) => isArrayOfNums(value)
};
Expand Down
9 changes: 8 additions & 1 deletion modules/adfBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,14 @@ export const spec = {
ortb: bidResponse.native
};
} else {
result[ mediaType === VIDEO ? 'vastXml' : 'ad' ] = bidResponse.adm;
if (mediaType === VIDEO) {
result.vastXml = bidResponse.adm;
if (bidResponse.nurl) {
result.vastUrl = bidResponse.nurl;
}
} else {
result.ad = bidResponse.adm;
}
}

if (!bid.renderer && mediaType === VIDEO && deepAccess(bid, 'mediaTypes.video.context') === 'outstream') {
Expand Down
3 changes: 2 additions & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export const spec = {
{code: 'didnadisplay'},
{code: 'qortex'},
{code: 'adpluto'},
{code: 'headbidder'}
{code: 'headbidder'},
{code: 'digiad'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down
Loading

0 comments on commit f82a31e

Please sign in to comment.