Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihkaya84 authored Nov 6, 2024
2 parents 6b95339 + 7504055 commit 33ff55a
Show file tree
Hide file tree
Showing 129 changed files with 7,663 additions and 2,749 deletions.
132 changes: 132 additions & 0 deletions integrationExamples/gpt/adnuntius_multiformat_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<html>
<head>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script async src="../../build/dev/prebid.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3000;

var adUnits = [{
code: 'div-gpt-ad-1683695049516-0',
bids: [{
bidder: 'adnuntius',
params: {
auId: "381535",
network: "1287",
bidType: 'netBid',
targeting: {
kv: {
'isolate': 'native-anto'
}
}
}
}],
mediaTypes: {
banner: {
sizes: [[200, 200]]
},
video: {
playerSize: [200, 200],
context: 'instream'
}
}},
{
code: 'div-gpt-ad-1683695049516-0',
bids: [{
bidder: 'adnuntius',
params: {
auId: "381535",
network: "1287",
bidType: 'netBid',
targetId: 'fred',
targeting: {
kv: {
'isolate': 'native-anto'
}
}
}
}],
mediaTypes: {
banner: {
sizes: [[200, 200]]
},
video: {
playerSize: [200, 200],
context: 'instream'
}
}}];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});

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

pbjs.que.push(function() {
pbjs.setConfig({
enableSendAllBids: true,
targetingControls: {
alwaysIncludeDeals: true
},
userSync: {
syncEnabled: false
}
});

pbjs.setBidderConfig({
bidders: ['adnuntius'],
config: {
bidType: 'netBid'
}
});

pbjs.bidderSettings = {
standard: {
storageAllowed: true
}
};

pbjs.addAdUnits(adUnits);
pbjs.requestBids({bidsBackHandler: initAdserver});
});

function initAdserver() {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync('div-gpt-ad-1683695049516-0');
googletag.pubads().refresh();
});
});
}

// in case PBJS doesn't load
setTimeout(function() {
initAdserver();
}, FAILSAFE_TIMEOUT);

window.googletag = window.googletag || {cmd: []};
googletag.cmd.push(function() {
googletag.defineSlot('/19660636/320x320', [320, 320], 'div-gpt-ad-1683695049516-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>
<body>
<h2>Adnuntius NATIVE</h2>
<h5>Ad Slot 1</h5>

<!-- /19660636/320x320 -->
<div id='div-gpt-ad-1683695049516-0' style='min-width: 320px; min-height: 320px;'>
<script>
googletag.cmd.push(function() {
googletag.display('div-gpt-ad-1683695049516-0');
});
</script>
</div>

</body>
</html>
203 changes: 203 additions & 0 deletions integrationExamples/gpt/precisonativeExample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<html>

<head>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>

<script>
var PREBID_TIMEOUT = 2000;

var adUnits = [
{
code: 'test-div',
mediaTypes: {
native: {
adTemplate: `
<div class="sponsored-post">
<div class="thumbnail" style="background-image: url('${encodeURI('##hb_native_asset_id_2##')}'); width=100%; height=100%; background-repeat: no-repeat;
background-size: cover; >
<div class="content">
<h1>
<a href="${encodeURI("https://" + '##hb_native_linkurl##')}" target="_blank" class="pb-click" hb_native_asset_id="4" >
${encodeURI('##hb_native_body##')}
</a>
</h1>
<p class="pb-click">${encodeURI('##hb_native_asset_id_4##')}</p>
<div class="attribution" class="pb-click hb_native_asset_id="1">${encodeURI('##hb_native_asset_id_1##')}</div>
</div>
</div>
</div>
`,
ortb: {
assets: [
{
id: 2,
required: 0,
img: {
type: 3,
w: 300,
h: 250
}
},
{
id: 1,
required: 1,
title: {
len: 800
}
},
{
id: 4,
required: 0,
data: {
type: 1
}
}
]
}
}
},

bids: [
{
bidder: 'preciso',
params: {
publisherId: 'PRECISO_TEST00001',
traffic: 'native',
// bidFloor: 0.12,
// currency: ['USD']
}
}
]
}
];

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



<script>
pbjs.que.push(function () {
pbjs.setConfig({ enableSendAllBids: true });
pbjs.addAdUnits(adUnits);
pbjs.setConfig({
userSync: {
userIds: [{
name: 'sharedId',
storage: {
name: '_sharedid',
type: 'cookie',
expires: 365
}
}],
filterSettings: {
iframe: {
bidders: ['preciso'],
filter: 'include'
},
image: {
bidders: ['preciso'],
filter: 'include'
}
}
},
floors: {
currency: 'USD',
skipRate: 5,
modelVersion: 'Sports Ad Unit Floors',
schema: {
fields: ['mediaType']
},
values: {
'banner': 0.05,
'native': 0.1
}
},
ortb2: {
bcat: ['IAB1-1'],
badv: ['example.com'],
wlang: ['fr', 'en']
},
enableTIDs: true,
debug: true
});
});

function renderEverything() {
var winners = pbjs.getHighestCpmBids();
for (var i = 0; i < winners.length; i++) {
renderOne(winners[i]);
}
}

function renderOne(winningBid) {
if (winningBid && winningBid.adId) {
let options = winningBid.adm
console.log("Here 123");
var div = document.getElementById(winningBid.adUnitCode);
if (div) {
let iframe = document.createElement('iframe');
iframe.frameBorder = '0';
iframe.style.width = '300';
iframe.style.height = '600';
div.appendChild(iframe);
console.log("Here 1234");
if (winningBid.mediaType == "native") {
console.log("Here 1234 native");
var domdoc = iframe.contentWindow.document;
console.log("Here 12345 native");
pbjs.renderAd(domdoc, winningBid.adId);
console.log("Here 123456 native");
}
}
}
}

</script>
<script>
pbjs.que.push(function () {
pbjs.requestBids({
timeout: 2000,

bidsBackHandler: renderEverything
});
});
</script>
<script src="https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/native.js"></script>
<script>
var pbNativeTagData = {};
pbNativeTagData.pubUrl = '##hb_adomain##'; // GAM specific
pbNativeTagData.adId = "##hb_adid##"; // GAM specific
// if you're using 'Send All Bids' mode, you should use %%PATTERN:hb_adid_BIDDER%%
pbNativeTagData.requestAllAssets = true;
// if you want to track clicks in GAM, add the following variable
pbNativeTagData.clickUrlUnesc = "%%CLICK_URL_UNESC%%";
window.pbNativeTag.renderNativeAd(pbNativeTagData);
</script>
</head>

<body>
<h2>Ad Serverless Test Page</h2>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make
a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions
of Lorem Ipsum
</p>
<div id="test-div"></div>
<p>
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin
literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney
College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and
going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum
comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by
Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance.
The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
</p>
<div id="test-nat-div"></div>
</body>

</html>
1 change: 1 addition & 0 deletions integrationExamples/top-level-paapi/gam-contextual.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
debug: true,
paapi: {
enabled: true,
parallel: true,
gpt: {
autoconfig: false
},
Expand Down
1 change: 1 addition & 0 deletions integrationExamples/top-level-paapi/no_adserver.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
debug: true,
paapi: {
enabled: true,
parallel: true,
gpt: {
autoconfig: false
},
Expand Down
30 changes: 30 additions & 0 deletions libraries/equativUtils/equativUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { VIDEO } from '../../src/mediaTypes.js';
import { deepAccess, isFn } from '../../src/utils.js';

const DEFAULT_FLOOR = 0.0;

/**
* Get floors from Prebid Price Floors module
*
* @param {object} bid Bid request object
* @param {string} currency Ad server currency
* @param {string} mediaType Bid media type
* @return {number} Floor price
*/
export function getBidFloor (bid, currency, mediaType) {
const floors = [];

if (isFn(bid.getFloor)) {
(deepAccess(bid, `mediaTypes.${mediaType}.${mediaType === VIDEO ? 'playerSize' : 'sizes'}`) || []).forEach(size => {
const floor = bid.getFloor({
currency: currency || 'USD',
mediaType,
size
}).floor;

floors.push(!isNaN(floor) ? floor : DEFAULT_FLOOR);
});
}

return floors.length ? Math.min(...floors) : DEFAULT_FLOOR;
}
10 changes: 10 additions & 0 deletions libraries/intentIqConstants/intentIqConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const FIRST_PARTY_KEY = '_iiq_fdata';

export const WITH_IIQ = 'A';
export const WITHOUT_IIQ = 'B';
export const NOT_YET_DEFINED = 'U';
export const OPT_OUT = 'O';
export const BLACK_LIST = 'L';
export const CLIENT_HINTS_KEY = '_iiq_ch';
export const EMPTY = 'EMPTY'
export const VERSION = 0.21
Loading

0 comments on commit 33ff55a

Please sign in to comment.