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
pnhegde authored Aug 19, 2024
2 parents 225c526 + 4835e08 commit 70375a6
Show file tree
Hide file tree
Showing 61 changed files with 3,689 additions and 3,276 deletions.
170 changes: 170 additions & 0 deletions integrationExamples/gpt/precisoExample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<html>

<head>
<link rel="icon" type="image/png" href="/favicon.png">

<!--script async src="//cdn.preciso.net/Preciso_Prebid/prebid.js"></script-->
<script async src="../../build/dev/prebid.js"></script>
<script>
var div_1_sizes = [
[300, 250],
[300, 250]
];
var div_2_sizes = [
[300, 250],
[970, 250]
];
var PREBID_TIMEOUT = 1000;
var FAILSAFE_TIMEOUT = 3000;
var adslot1 = 'preciso-adslot-1';
var adslot2 = 'preciso-adslot-2';

// define Ad units
var adUnits = [
{
code: adslot1,
mediaTypes: {
banner: {
sizes: div_1_sizes
}
},
bids: [{
bidder: 'preciso',
params: {
publisherId: 'PRECISO_TEST00001',
traffic: 'banner',
bidFloor: 0.12,
currency: ['USD'],
region: 'NPL'
}
}]
},
{
code: adslot2,
mediaTypes: {
banner: {
sizes: div_2_sizes
}
},
bids: [{
bidder: 'preciso',
params: {
publisherId: 'PRECISO_TEST00001',
host: 'prebid',
traffic: 'banner',
bidFloor: 0.28,
currency: ['INR'],
region: 'NPL'
}
}]
}
];



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

pbjs.que.push(function () {
pbjs.addAdUnits(adUnits);
// Pbjs configurations
pbjs.setConfig({
userSync: {
userIds: [{
name: 'sharedId',
storage: {
name: '_sharedid',
type: 'cookie',
expires: 365
}
}],
filterSettings: {
iframe: {
bidders: ['preciso'],
filter: 'include'
},
image: {
bidders: ['preciso'],
filter: 'include'
}
}
},
realTimeData: {
dataProviders: [{
"name": "geolocation",
"waitForIt": true,
"params": {
"requestPermission": true
}
}]
},
floors: {
floorMin: 0.32,
currency: ['USD']
},
ortb2: {
bcat: ['IAB1-1'],
badv: ['example.com'],
wlang: ['fr', 'en']
},
enableTIDs: true
});
pbjs.setTargetingForGPTAsync();
pbjs.requestBids({
bidsBackHandler: function () {
// call for the bid response which have the high bid price
let ad1 = pbjs.getHighestCpmBids(adslot1)
let ad2 = pbjs.getHighestCpmBids(adslot2)
if (ad1 && ad1.length > 0) {
var iframe1 = document.getElementById('preciso-iframe-1');
var iframe1Doc = iframe1.contentWindow.document;
try {
pbjs.renderAd(iframe1Doc, ad1[0]['adId']);
} catch (e) {
console.log(e);
}
} else {
console.log("No bids for the adslot : " + adslot1);
};
if (ad2 && ad2.length > 0) {
var iframe2 = document.getElementById('preciso-iframe-2');
var iframe2Doc = iframe2.contentWindow.document;
try {
pbjs.renderAd(iframe2Doc, ad2[0]['adId']);
} catch (e) {
console.log(e)
}
} else {
console.log("No bids for the adslot : " + adslot2);
};

var bids = pbjs.getBidResponses();
console.log('Bids received Test test:', bids);
pbjs.setTargetingForAst();
console.log('Rendering ads...');
},
timeout: PREBID_TIMEOUT
});

});

</script>

</head>

<body>
<!-- Ad slot Creation -->
<h2>Basic Prebid.js Example with Preciso Bidder</h2>
<h3>Adslot-1</h3>
<div id='div-1' style="display: inline-block;">
<iframe id='preciso-iframe-1' style="min-width: 350px; min-height: 600px; padding: 0%;" scrolling="no"></iframe>
</div>

<div id='div-2' style="margin-left: 30; vertical-align: top; display: inline-block;">
<h3>Adslot-2</h3>
<iframe id='preciso-iframe-2' style="min-width: 970px; min-height: 250px; " scrolling="no"></iframe>
</div>

</body>

</html>
Loading

0 comments on commit 70375a6

Please sign in to comment.