-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration example, fix bid requestId
- Loading branch information
1 parent
5bd6d47
commit 32674cd
Showing
3 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<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 sizes = [ | ||
[300, 250], | ||
[250, 300], | ||
[300, 600] | ||
]; | ||
var PREBID_TIMEOUT = 3000; | ||
var FAILSAFE_TIMEOUT = 3000; | ||
|
||
var adUnits = [{ | ||
code: '/19968336/header-bid-tag-1', | ||
mediaTypes: { | ||
banner: { | ||
sizes: sizes | ||
} | ||
}, | ||
bids: [{ | ||
bidder: 'adikteev', | ||
params: { | ||
placementId: 13144370, | ||
stagingEnvironment: true, | ||
bidFloorPrice: 0.1, | ||
} | ||
}] | ||
}]; | ||
|
||
// ======== DO NOT EDIT BELOW THIS LINE =========== // | ||
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.addAdUnits(adUnits); | ||
pbjs.requestBids({ | ||
bidsBackHandler: initAdserver, | ||
timeout: PREBID_TIMEOUT | ||
}); | ||
}); | ||
|
||
function initAdserver() { | ||
if (pbjs.initAdserverSet) return; | ||
pbjs.initAdserverSet = true; | ||
googletag.cmd.push(function () { | ||
pbjs.que.push(function () { | ||
pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
|
||
|
||
// in case PBJS doesn't load | ||
setTimeout(function () { | ||
console.log("prebid.js setTimeout"); | ||
initAdserver(); | ||
}, FAILSAFE_TIMEOUT); | ||
|
||
googletag.cmd.push(function () { | ||
googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1') | ||
.addService(googletag.pubads()); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
|
||
</script> | ||
|
||
</head> | ||
|
||
<body> | ||
<h2>Basic Prebid.js Example</h2> | ||
<h5>Div-1</h5> | ||
<div id='div-1'> | ||
<script type='text/javascript'> | ||
googletag.cmd.push(function () { | ||
googletag.display('div-1'); | ||
}); | ||
|
||
</script> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters