Skip to content

Commit

Permalink
pubwise bidder as an example
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipStamenkovic committed Dec 10, 2021
1 parent 134b0eb commit bbfddb4
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 252 deletions.
143 changes: 143 additions & 0 deletions integrationExamples/gpt/native_ortb2_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<html>

<head>
<link rel="icon" type="image/png" href="/favicon.png">
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

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

function refreshSlots() {
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

// Load GPT when timeout is reached.
// setTimeout(initAdserver, PREBID_TIMEOUT);

pbjs.que.push(function () {
pbjs.setConfig({
debug: true,
});

var adUnits = [
{
code: '/19968336/prebid_native_example_1',
// sizes: [[1, 1]],
mediaTypes: {
native: {
sendTargetingKeys: false,
rendererUrl: "http://localhost:5500/prebid/cardRender.js",
ortb2: {
ver: "1.2",
assets: [
{
id: 1,
required: 1,
title: { len: 80 },
},
{
id: 2,
required: 1,
data: { type: 2 }
},
{
id: 3,
required: 1,
img: {
type: 3,
w: 150,
h: 50,
}
},
{
id: 4,
required: 1,
data: { type: 1 }
},
{
id: 5,
required: 0,
img: {
type: 1,
wmin: 20,
hmin: 20,
}
}
],
},
},
},
bids: [{
bidder: 'pwbid',
params: {
siteId: "xxxxxx",
isTest: true,
}
}]
}
];

pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function (bidResponses) {
refreshSlots();
}
});
});

</script>

<script>
// GPT setup
googletag.cmd.push(function () {
// var slot1 = googletag.defineSlot('/19968336/prebid_native_example_1', [[360, 360]], 'div-1').addService(googletag.pubads());
// var slot2 = googletag.defineSlot('/19968336/prebid_native_example_2', 'fluid', 'div-2').addService(googletag.pubads());
var slot2 = googletag.defineSlot('/19968336/prebid_native_example_1', ['fluid'], 'div-2').addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

</script>
</head>

<body>

<h2>Prebid Native</h2>
<div id='div-1'>
<p>No response</p>
<script type='text/javascript'>
googletag.cmd.push(function () {
// googletag.display('div-1');
});

</script>
</div>

<br>
<br>

<div id='div-2' style="width: 400px;height: 500px;">
<p>No response</p>
<script type='text/javascript'>
googletag.cmd.push(function () {
googletag.display('div-2');
});

</script>
</div>

</body>

</html>
Loading

0 comments on commit bbfddb4

Please sign in to comment.