Skip to content

Commit

Permalink
Preciso Bid Adapter : update on valid request checks (#11161)
Browse files Browse the repository at this point in the history
* test logs added

* Added precisoExample.html in integrationExamples

* updated request Validation check

* bid request data updated

* bid request data updated

* trailing spaces removed

* precisoBidAdapter_spec.js updated

* Auction_price macro replacing from response

* Auction_price macro replacing from response

* Auction_price macro replacing from response

* Test logs removed

* Bid Request valid check modified

* Test logs removed

* userid updated in usersync call

* add back blank line

* add blank line to end

* bidFloor correction

---------

Co-authored-by: Chris Huie <[email protected]>
  • Loading branch information
NikhilGopalChennissery and ChrisHuie committed May 28, 2024
1 parent 6957843 commit 646426f
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 123 deletions.
168 changes: 168 additions & 0 deletions integrationExamples/gpt/precisoExample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<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, 600]
];
var div_2_sizes = [
[728, 90],
[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: '123456',
region: 'IND',
traffic: 'banner',
bidFloor: 0.12,
}
}]
},
{
code: adslot2,
mediaTypes: {
banner: {
sizes: div_2_sizes
}
},
bids: [{
bidder: 'preciso',
params: {
publisherId: '123456',
host: 'prebid',
region: 'prebid-eu',
traffic: 'banner',
bidFloor: 0.28
}
}]
}
];



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 646426f

Please sign in to comment.