forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to support Prebid 5.0 API Change
Changes for: Adapter does not seem capable of supporting advertiserDomains prebid#6650 Support video params at the adunit level prebid#6512 Bid adapters that support floors must support the floors module prebid#6465
- Loading branch information
1 parent
cd4d0d8
commit c8fa08a
Showing
8 changed files
with
847 additions
and
24 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 @@ | ||
<!-- | ||
This page calls a single bidder for a single ad slot. It can be considered a "hello world" example for using | ||
Prebid with the Google Publisher Tag. | ||
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/dev/prebid.js"></script> | ||
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script> | ||
<script> | ||
var FAILSAFE_TIMEOUT = 3300; | ||
var PREBID_TIMEOUT = 1000; | ||
|
||
var adUnits = [{ | ||
code: 'div-gpt-ad-1460505748561-0', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250], [300,600], [320,50],[320,480]], | ||
} | ||
}, | ||
// Replace this object to test a new Adapter! | ||
bids: [{ | ||
bidder: 'advangelists', | ||
params: { | ||
pubid: '36b1698d957fc35f63b95c35a7938fe2', | ||
placement: 10931, | ||
bidfloor: 0.01 | ||
} | ||
}] | ||
|
||
}]; | ||
|
||
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.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-1460505748561-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-1460505748561-0'> | ||
<script type='text/javascript'> | ||
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-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,115 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Prebid.js video adUnit example1</title> | ||
|
||
<link href="http://vjs.zencdn.net/4.7.1/video-js.css" rel="stylesheet"> | ||
<link href="https://raw.githubusercontent.com/theonion/videojs-vast-plugin/master/lib/videojs-contrib-ads/videojs.ads.css" rel="stylesheet" type="text/css"> | ||
<link href="https://raw.githubusercontent.com/theonion/videojs-vast-plugin/master/videojs.vast.css" rel="stylesheet" type="text/css"> | ||
|
||
<style type="text/css"> | ||
.description { | ||
background-color:#eee; | ||
border: 1px solid #777; | ||
padding: 10px; | ||
font-size: .8em; | ||
line-height: 1.5em; | ||
font-family: Verdana, sans-serif; | ||
} | ||
.example-video-container { | ||
display: inline-block; | ||
} | ||
</style> | ||
<script src="/build/dev/prebid.js" async=true></script> | ||
<script> | ||
|
||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
|
||
/* | ||
adUnits can support video demand requests by setting 'mediaType' to | ||
'video'. When an adUnit is configured to support video, all bidders | ||
within that adUnit must be video-enabled as well, as configured in | ||
adapters.json. | ||
*/ | ||
var videoAdUnit = { | ||
code: 'video1', | ||
sizes: [320,480], | ||
mediaTypes: { | ||
video: { | ||
playerSize : [[320, 480]], | ||
context: 'instream', | ||
skip: 1, | ||
mimes : ['video/mp4', 'application/javascript'], | ||
playbackmethod : [2,6], | ||
maxduration: 30 | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'advangelists', | ||
params: { | ||
pubid: '36b1698d957fc35f63b95c35a7938fe2', | ||
placement: 10931, | ||
|
||
} | ||
} | ||
] | ||
}; | ||
|
||
pbjs.que.push(function(){ | ||
pbjs.addAdUnits(videoAdUnit); | ||
pbjs.requestBids({ | ||
timeout : 3000, | ||
bidsBackHandler : function(bids) { | ||
var adserverTag = '<dfp_tag>'; // base ad server tag, see: https://support.google.com/dfp_premium/answer/1068325 | ||
var options = { | ||
'adserver': 'dfp', | ||
'code': 'video1' //code that matches the video adUnit declared above | ||
}; | ||
//generate URL | ||
var masterTagUrl = pbjs.buildMasterVideoTagFromAdserverTag(adserverTag, options); | ||
//send masterTagUrl to the video player | ||
invokeVideoPlayer(masterTagUrl); | ||
|
||
} | ||
}); | ||
}); | ||
|
||
|
||
</script> | ||
</head> | ||
<body> | ||
|
||
<div class="example-video-container"> | ||
<video id="vid1" class="video-js vjs-default-skin" autoplay controls preload="auto" | ||
poster="http://video-js.zencoder.com/oceans-clip.png" | ||
data-setup='{}' | ||
width='320' | ||
height='480' | ||
> | ||
<source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'> | ||
|
||
<p>Video Playback Not Supported</p> | ||
</video> | ||
</div> | ||
|
||
<script> | ||
|
||
var vid1 = videojs('vid1'); | ||
vid1.muted(true); | ||
vid1.ads(); | ||
|
||
/* | ||
This function called after prebid is back | ||
*/ | ||
function invokeVideoPlayer(url) { | ||
vid1.vast({ | ||
url: url | ||
}); | ||
} | ||
</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
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.