-
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.
- Loading branch information
Showing
106 changed files
with
6,062 additions
and
797 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<!-- | ||
This page calls a single bidder for a single ad slot. | ||
It is a specialized example for adding floors to bids using the priceFloors Module | ||
It also makes a good test page for new adapter PR submissions. Simply set your server's Bid Params object in the | ||
bids array inside the adUnits, and it will use your adapter to load an ad. | ||
NOTE that many ad servers won't send back an ad if the URL is localhost... so you might need to | ||
set an alias in your /etc/hosts file so that you can load this page from a different domain. | ||
--> | ||
|
||
<html> | ||
|
||
<head> | ||
<script async src="../../build/dist/prebid.js"></script> | ||
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> | ||
<script> | ||
var FAILSAFE_TIMEOUT = 3300; | ||
var PREBID_TIMEOUT = 1000; | ||
var adUnits = [{ | ||
code: 'div-gpt-ad-51545-0', | ||
sizes: [[300, 250], [600, 500]], | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250], [600, 500]] | ||
} | ||
}, | ||
// Replace this object to test a new Adapter! | ||
bids: [{ | ||
bidder: 'ix', | ||
params: { | ||
siteId: '300', | ||
size: [300, 250] | ||
} | ||
}] | ||
}]; | ||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
</script> | ||
<script> | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function () { | ||
googletag.pubads().disableInitialLoad(); | ||
}); | ||
|
||
pbjs.que.push(function () { | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.setConfig({ | ||
floors: { | ||
enforcement: { | ||
floorDeals: false, //default to false | ||
bidAdjustment: true | ||
}, | ||
data: { // default if endpoint doesn't return in time | ||
currency: 'USD', | ||
skipRate: 5, | ||
modelVersion: 'BlackBerryZap', | ||
schema: { | ||
fields: ['gptSlot', 'mediaType', 'size'] | ||
}, | ||
values: { | ||
'*|banner|600x500': 6.5, | ||
'*|banner|300x250': 3.25, | ||
'*|video': 3.5 | ||
} | ||
} | ||
} | ||
}); | ||
pbjs.requestBids({ | ||
bidsBackHandler: sendAdserverRequest, | ||
timeout: PREBID_TIMEOUT | ||
}); | ||
}); | ||
|
||
function sendAdserverRequest() { | ||
if (pbjs.adserverRequestSent) return; | ||
pbjs.adserverRequestSent = true; | ||
googletag.cmd.push(function () { | ||
pbjs.que.push(function () { | ||
pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
|
||
setTimeout(function () { | ||
sendAdserverRequest(); | ||
}, FAILSAFE_TIMEOUT); | ||
|
||
</script> | ||
|
||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-51545-0').addService(googletag.pubads()); | ||
|
||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h2>Prebid.js Test</h2> | ||
<h5>Div-1</h5> | ||
<div id='div-gpt-ad-51545-0'> | ||
<script type='text/javascript'> | ||
googletag.cmd.push(function () { googletag.display('div-gpt-ad-51545-0'); }); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Prebid Display/Video Merged Auction with Adloox Integration</title> | ||
|
||
<script async src="http://localhost:9999/build/dev/prebid.js"></script> | ||
<!-- <script async src="https://storage.googleapis.com/adloox-ads-js-test/prebid.js"></script> --> | ||
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script> | ||
|
||
<script> | ||
// set to 10s (rather than 100ms) only to assist development as 'Local Overrides' stalls for >1s :-/ | ||
var AUCTION_DELAY = 10000; // recommended to be set to 100 in production | ||
var PREBID_TIMEOUT = 1000; | ||
var FAILSAFE_TIMEOUT = AUCTION_DELAY + (3 * PREBID_TIMEOUT); | ||
|
||
var div_1_sizes = [ [728, 90] ]; | ||
var div_2_sizes = [ [300, 250] ]; | ||
var video_1_size = [ 640, 480 ]; | ||
|
||
var adUnits = [ | ||
{ | ||
code: 'div-1', | ||
mediaTypes: { | ||
banner: { | ||
sizes: div_1_sizes | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'rubicon', | ||
params: { | ||
accountId: 14062, | ||
siteId: 70608, | ||
zoneId: 498816 | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'div-2', | ||
mediaTypes: { | ||
banner: { | ||
sizes: div_2_sizes | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'rubicon', | ||
params: { | ||
accountId: 14062, | ||
siteId: 70608, | ||
zoneId: 498816 | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
|
||
var videoAdUnit = { | ||
code: 'video-1', | ||
mediaTypes: { | ||
video: { | ||
context: 'instream', | ||
playerSize: [ 640, 480 ] | ||
} | ||
}, | ||
fpd: { | ||
context: { | ||
pbAdSlot: '/19968336/prebid_cache_video_adunit' | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'spotx', | ||
params: { | ||
channel_id: 85394, | ||
ad_unit: 'instream' | ||
} | ||
} | ||
] | ||
}; | ||
|
||
window.googletag = window.googletag || { cmd: [] }; | ||
googletag.cmd.push(function() { | ||
googletag | ||
.defineSlot('/19968336/header-bid-tag-0', div_1_sizes, 'div-1') | ||
.addService(googletag.pubads()); | ||
googletag | ||
.defineSlot('/19968336/header-bid-tag-1', div_2_sizes, 'div-2') | ||
.addService(googletag.pubads()); | ||
googletag.pubads().disableInitialLoad(); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
|
||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
|
||
var tempTag = false; | ||
var invokeVideoPlayer = function(url) { | ||
tempTag = url; | ||
}; | ||
|
||
function sendAdserverRequest(bids, timedOut, auctionId) { | ||
if (pbjs.initAdserverSet) return; | ||
pbjs.initAdserverSet = true; | ||
|
||
googletag.cmd.push(function() { | ||
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync(adUnits); | ||
googletag.pubads().refresh(); | ||
}); | ||
|
||
var videoBids = bids[videoAdUnit.code]; | ||
if (videoBids) { | ||
var videoUrl = videoBids.bids[0].vastUrl; | ||
// var videoUrl = pbjs.adServers.dfp.buildVideoUrl({ | ||
// adUnit: videoAdUnit, | ||
// params: { | ||
// iu: '/19968336/prebid_cache_video_adunit', | ||
// cust_params: { | ||
// section: 'blog', | ||
// anotherKey: 'anotherValue' | ||
// }, | ||
// output: 'vast' | ||
// } | ||
// }); | ||
invokeVideoPlayer(videoUrl); | ||
} | ||
} | ||
|
||
// optionally wrap with googletag to have gpt-pre-auction | ||
// automatically populate Prebid Ad Slot (pbAdSlot) | ||
// https://docs.prebid.org/dev-docs/modules/gpt-pre-auction.html | ||
// alternatively remove wrapping and set AdUnit.fpd.context.pbAdSlot | ||
googletag.cmd.push(function() { | ||
pbjs.que.push(function() { | ||
pbjs.setConfig({ | ||
instreamTracking: { | ||
enabled: true | ||
}, | ||
rubicon: { | ||
singleRequest: true | ||
} | ||
}); | ||
pbjs.enableAnalytics({ | ||
provider: 'adloox', | ||
options: { | ||
client: 'adlooxtest', | ||
clientid: 127, | ||
platformid: 0, | ||
tagid: 0 | ||
} | ||
}); | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.addAdUnits(videoAdUnit); | ||
pbjs.requestBids({ | ||
bidsBackHandler: sendAdserverRequest, | ||
timeout: PREBID_TIMEOUT | ||
}) | ||
}); | ||
}); | ||
|
||
setTimeout(function() { | ||
sendAdserverRequest(); | ||
}, FAILSAFE_TIMEOUT); | ||
</script> | ||
</head> | ||
<body> | ||
<h1>Prebid Display/Video Merged Auction with Adloox Integration</h1> | ||
|
||
<h2>div-1</h2> | ||
<div id="div-1"> | ||
<script> | ||
googletag.cmd.push(function() { | ||
googletag.display('div-1'); | ||
}); | ||
</script> | ||
</div> | ||
|
||
<h2>div-2</h2> | ||
<div id="div-2"> | ||
<script> | ||
googletag.cmd.push(function() { | ||
googletag.display('div-2'); | ||
}); | ||
</script> | ||
</div> | ||
|
||
<h2>video-1</h2> | ||
<div id="video-1"></div> | ||
<script src="https://content.jwplatform.com/libraries/72xIKEe6.js"></script> | ||
<script> | ||
var playerInstance = jwplayer('video-1'); | ||
invokeVideoPlayer = function(url) { | ||
playerInstance.setup({ | ||
"playlist": "https://content.jwplatform.com/feeds/ae4tmw2D.json", | ||
"width": 640, | ||
"height": 480, | ||
"advertising": { | ||
"client": "vast", | ||
"tag": url | ||
} | ||
}); | ||
}; | ||
if (tempTag) { | ||
invokeVideoPlayer(tempTag); | ||
tempTag = false; | ||
} | ||
</script> | ||
</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
Oops, something went wrong.