Skip to content

Commit

Permalink
Merge pull request prebid#11 from prebid/master
Browse files Browse the repository at this point in the history
Sync with prebid master
  • Loading branch information
pm-nitin-shirsat authored May 30, 2024
2 parents 484c691 + 5a62b38 commit 39af04f
Show file tree
Hide file tree
Showing 85 changed files with 4,996 additions and 1,242 deletions.
261 changes: 191 additions & 70 deletions integrationExamples/gpt/contxtfulRtdProvider_example.html
Original file line number Diff line number Diff line change
@@ -1,91 +1,212 @@
<!DOCTYPE html>
<html>

<head>
<script src="http://localhost:9999/build/dev/prebid.js" async></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script async>
const FAILSAFE_TIMEOUT = 8000;
const PREBID_TIMEOUT = 5000;
<script async src=
"https://www.googletagservices.com/tag/js/gpt.js"></script>
<script async src="http://localhost:9999/build/dev/prebid.js"></script>
<title>Contxtful Rtd Provider Example</title>
<script>
var div1Sizes = [
[300, 250],
[300, 600]
];
var div2Sizes = [
[728, 90 ],
[970, 250]
];

var PREBID_TIMEOUT = 1000;
var FAILSAFE_TIMEOUT = 3000;

var adUnits = [
{
code: '/19968336/header-bid-tag-0',
mediaTypes: {
banner: {
sizes: div1Sizes
},
},

const bidders = [
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
placementId: 13144370,
},
},
{
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816,
},
},
{
bidder: 'sharethrough',
params: {

placementId: 13144370,
// REQUIRED - The placement key
pkey: 'LuB3vxGGFrBZJa6tifXW4xgK',

// OPTIONAL - Blocked Advertiser Domains
badv: ['domain1.com', 'domain2.com'],

// OPTIONAL - Blocked Categories (IAB codes)
bcat: ['IAB1-1', 'IAB1-2'],

// OPTIONAL - default bid floor, if not specified in bid request (USD)
floor: 0.1,
}
},
],
},
{
code: '/19968336/header-bid-tag-1',
mediaTypes: {
banner: {
sizes: div2Sizes,
}
];
},

var adUnits = [
bids: [
{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]],
}
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816,
},
bids: bidders,
}
];


var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
},
{
bidder: 'sharethrough',
params: {

placementId: 13144370,
// REQUIRED - The placement key
pkey: 'LuB3vxGGFrBZJa6tifXW4xgK',

// OPTIONAL - Blocked Advertiser Domains
badv: ['domain1.com', 'domain2.com'],

// OPTIONAL - Blocked Categories (IAB codes)
bcat: ['IAB1-1', 'IAB1-2'],

// OPTIONAL - default bid floor, if not specified in bid request (USD)
floor: 0.1,
}
},
]
},
];

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

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

pbjs.que.push(function() {
pbjs.setConfig({
debug: true,
realTimeData: {
auctionDelay: 100,
dataProviders: [
{
name: 'contxtful',
waitForIt: true,
params:
{
'version': 'Contact contact@contxtful.com for the API version',
'customer': 'Contact contact@contxtful.com for the customer ID',
'hostname': 'api.receptivity.io',
'adServerTargeting': true,
'bidders': ['sharethrough']
}
}
]}
});

pbjs.addAdUnits(adUnits);

// Initial bids
pbjs.requestBids({
bidsBackHandler: initAdserver,
timeout: PREBID_TIMEOUT
});
});

function refreshBids() {
pbjs.que.push(function () {
pbjs.requestBids({
bidsBackHandler: initAdserver,
timeout: PREBID_TIMEOUT,
});
});
}

function initAdserver() {
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setConfig({
debug: true,
realTimeData: {
auctionDelay: 100,
dataProviders: [
{
name: "contxtful",
waitForIt: true,
params: {
version: "Contact contact@contxtful.com for the API version",
customer: "Contact contact@contxtful.com for the customer ID"
}
}
]
}
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

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

setTimeout(function () {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);
googletag.cmd.push(function () {
googletag
.defineSlot('/19968336/header-bid-tag-0',
div1Sizes, 'div-1')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

</script>
</head>
googletag.cmd.push(function () {
googletag
.defineSlot('/19968336/header-bid-tag-1',
div2Sizes, 'div-2')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

</script>
</head>
<body>
<h2>Contxtful RTD Provider</h2>
<div id='div-gpt-ad-1460505748561-0'></div>
</div>
</body>
<h2>Contxtful Rtd Provider Example</h2>

<p><button onclick="refreshBids()">Refresh Ad Units</button></p>

<h5>Div-1</h5>
<div id='div-1'>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.display('div-1');
});

</html>
</script>
</div>

<br>

<h5>Div-2</h5>
<div id='div-2'>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.display('div-2');
});

</script>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion modules/51DegreesRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ In order to use the module please first obtain a Resource Key using the [Configu
* ScreenInchesWidth
* PixelRatio (optional)

PixelRatio is desirable, but it's a paid property requiring a paid license. Also free API service is limited to 500,000 requests per month - consider picking a [51Degrees pricing plan](https://51degrees.com/pricing) that fits your needs.
PixelRatio is desirable, but it's a paid property requiring a paid license. Free API service is limited. Please check [51Degrees pricing](https://51degrees.com/pricing) to choose a plan that suits your needs.

#### User Agent Client Hint (UA-CH) Permissions

Expand Down
15 changes: 8 additions & 7 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,13 +667,14 @@ function autoFillParams(bid) {
bid.params.site = adgGlobalConf.siteId.split(':')[1];
}

// Edge case. Useful when Prebid Manager cannot handle properly params setting…
if (adgGlobalConf.useAdUnitCodeAsPlacement === true || bid.params.useAdUnitCodeAsPlacement === true) {
// `useAdUnitCodeAsPlacement` is an edge case. Useful when a Prebid Manager cannot handle properly params setting.
// In Prebid.js 9, `placement` should be defined in ortb2Imp and the `useAdUnitCodeAsPlacement` param should be removed
bid.params.placement = deepAccess(bid, 'ortb2Imp.ext.data.placement', bid.params.placement);
if (!bid.params.placement && (adgGlobalConf.useAdUnitCodeAsPlacement === true || bid.params.useAdUnitCodeAsPlacement === true)) {
bid.params.placement = bid.adUnitCode;
}

bid.params.adUnitElementId = deepAccess(bid, 'ortb2Imp.ext.data.elementId', null) || bid.params.adUnitElementId;

bid.params.adUnitElementId = deepAccess(bid, 'ortb2Imp.ext.data.divId', bid.params.adUnitElementId);
if (!bid.params.adUnitElementId) {
if (adgGlobalConf.useAdUnitCodeAsAdUnitElementId === true || bid.params.useAdUnitCodeAsAdUnitElementId === true) {
bid.params.adUnitElementId = bid.adUnitCode;
Expand Down Expand Up @@ -959,14 +960,14 @@ const OUTSTREAM_RENDERER = {
* @returns
*/
const _getFeatures = (bidRequest) => {
const f = { ...deepAccess(bidRequest, 'ortb2.ext.features', GlobalExchange.getOrSetGlobalFeatures()) } || {};
const f = { ...deepAccess(bidRequest, 'ortb2.site.ext.data.adg_rtd.features', GlobalExchange.getOrSetGlobalFeatures()) } || {};

f.print_number = deepAccess(bidRequest, 'bidderRequestsCount', 1).toString();

if (f.type === 'bidAdapter') {
f.adunit_position = getSlotPosition(bidRequest.params.adUnitElementId)
} else {
f.adunit_position = deepAccess(bidRequest, 'ortb2Imp.ext.data.adunit_position');
f.adunit_position = deepAccess(bidRequest, 'ortb2Imp.ext.data.adg_rtd.adunit_position');
}

Object.keys(f).forEach((prop) => {
Expand Down Expand Up @@ -1019,7 +1020,7 @@ export const spec = {
// We don't validate the dsa object in adapter and let our server do it.
const dsa = deepAccess(bidderRequest, 'ortb2.regs.ext.dsa');

let rtdSamplingSession = deepAccess(bidderRequest, 'ortb2.ext.session');
let rtdSamplingSession = deepAccess(bidderRequest, 'ortb2.site.ext.data.adg_rtd.session');
const dataExchange = (rtdSamplingSession) ? { session: rtdSamplingSession } : GlobalExchange.getExchangeData();

const aucId = generateUUID()
Expand Down
Loading

0 comments on commit 39af04f

Please sign in to comment.