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.
Merge pull request #22 from prebid/master
merge master
- Loading branch information
Showing
187 changed files
with
9,946 additions
and
1,684 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
integrationExamples/gpt/azerionedgeRtdProvider_example.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,91 @@ | ||
<html> | ||
<head> | ||
<meta name="keywords" content="football basketball rugby tenis" /> | ||
<script async src="../../build/dev/prebid.js" async></script> | ||
<script | ||
async | ||
src="https://www.googletagservices.com/tag/js/gpt.js" | ||
></script> | ||
|
||
<script> | ||
const FAILSAFE_TIMEOUT = 1000; | ||
const PREBID_TIMEOUT = 1000; | ||
const TEST_DIV = "test-div"; | ||
const TEST_SIZES = [[300, 250]]; | ||
const TEST_OUTPUT = "azerion-segments"; | ||
const STORAGE_KEY = "ht-pa-v1-a"; | ||
</script> | ||
|
||
<script> | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function () { | ||
googletag | ||
.defineSlot("/19968336/header-bid-tag-0", TEST_SIZES, TEST_DIV) | ||
.addService(googletag.pubads()); | ||
googletag.pubads().disableInitialLoad(); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
</script> | ||
|
||
<script> | ||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
pbjs.que.push(function () { | ||
pbjs.setConfig({ | ||
debug: true, | ||
realTimeData: { | ||
dataProviders: [ | ||
{ | ||
name: "azerionedge", | ||
waitForIt: true, | ||
params: { bidders: ["appnexus"] }, | ||
}, | ||
], | ||
}, | ||
}); | ||
pbjs.setBidderConfig({ bidders: ["appnexus"], config: {} }); | ||
pbjs.addAdUnits([ | ||
{ | ||
code: TEST_DIV, | ||
mediaTypes: { banner: { sizes: TEST_SIZES } }, | ||
bids: [{ bidder: "appnexus", params: { placementId: 13144370 } }], | ||
}, | ||
]); | ||
pbjs.requestBids({ | ||
bidsBackHandler: sendAdserverRequest, | ||
timeout: PREBID_TIMEOUT, | ||
}); | ||
}); | ||
|
||
function sendAdserverRequest() { | ||
const output = document.getElementById(TEST_OUTPUT); | ||
output.innerHTML = window.localStorage.getItem(STORAGE_KEY); | ||
|
||
if (pbjs.adserverRequestSent) return; | ||
pbjs.adserverRequestSent = true; | ||
googletag.cmd.push(function () { | ||
pbjs.que.push(function () { | ||
pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
setTimeout(sendAdserverRequest, FAILSAFE_TIMEOUT); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h2>Azerion Edge RTD</h2> | ||
|
||
<div id="test-div"> | ||
<script> | ||
googletag.cmd.push(() => googletag.display(TEST_DIV)); | ||
</script> | ||
</div> | ||
|
||
Segments: | ||
<div id="azerion-segments"></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,84 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Prebid.js Banner gpt Example</title> | ||
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script> | ||
<script async src="../../build/dev/prebid.js"></script> | ||
<script> | ||
var FAILSAFE_TIMEOUT = 3300; | ||
var PREBID_TIMEOUT = 1000; | ||
|
||
var adUnits = [{ | ||
code: 'div-gpt-ad-1460505748561-0', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[160, 600]], | ||
} | ||
}, | ||
bids: [{ | ||
bidder: 'publir', | ||
params: { | ||
pubId: 13144370 | ||
} | ||
}] | ||
|
||
}]; | ||
|
||
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() { | ||
googletag.cmd.push(function () { | ||
pbjs.que.push(function () { | ||
pbjs.setTargetingForGPTAsync('div-gpt-ad-1460505748561-0'); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
|
||
setTimeout(function () { | ||
sendAdserverRequest(); | ||
}, FAILSAFE_TIMEOUT); | ||
|
||
</script> | ||
|
||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.defineSlot('/1011927,22444378655/hre_vcn_4', [[160, 600], [240, 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
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,42 @@ | ||
let autoplayEnabled = null; | ||
|
||
/** | ||
* Note: this function returns true if detection is not done yet. This is by design: if autoplay is not allowed, | ||
* the call to video.play() will fail immediately, otherwise it may not terminate. | ||
* @returns true if autoplay is not forbidden | ||
*/ | ||
export const isAutoplayEnabled = () => autoplayEnabled !== false; | ||
|
||
// generated with: | ||
// ask ChatGPT for a 160x90 black PNG image (1/8th the size of 720p) | ||
// | ||
// encode with: | ||
// ffmpeg -i black_image_160x90.png -r 1 -c:v libx264 -bsf:v 'filter_units=remove_types=6' -pix_fmt yuv420p autoplay.mp4 | ||
// this creates a 1 second long, 1 fps YUV 4:2:0 video encoded with H.264 without encoder details. | ||
// | ||
// followed by: | ||
// echo "data:video/mp4;base64,$(base64 -i autoplay.mp4)" | ||
|
||
const autoplayVideoUrl = | ||
'data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAADxtZGF0AAAAMGWIhAAV//73ye/Apuvb3rW/k89I/Cy3PsIqP39atohOSV14BYa1heKCYgALQC5K4QAAAwZtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAD6AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACMHRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAD6AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAoAAAAFoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAA+gAAAAAAAEAAAAAAahtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAEAAAABAAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAFTbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABE3N0YmwAAACvc3RzZAAAAAAAAAABAAAAn2F2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAoABaAEgAAABIAAAAAAAAAAEVTGF2YzYwLjMxLjEwMiBsaWJ4MjY0AAAAAAAAAAAAAAAY//8AAAA1YXZjQwFkAAr/4QAYZ2QACqzZQo35IQAAAwABAAADAAIPEiWWAQAGaOvjyyLA/fj4AAAAABRidHJ0AAAAAAAAAaAAAAGgAAAAGHN0dHMAAAAAAAAAAQAAAAEAAEAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAADQAAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjYwLjE2LjEwMA=='; | ||
|
||
function startDetection() { | ||
// we create an HTMLVideoElement muted and not displayed in which we try to play a one frame video | ||
const videoElement = document.createElement('video'); | ||
videoElement.src = autoplayVideoUrl; | ||
videoElement.setAttribute('playsinline', 'true'); | ||
videoElement.muted = true; | ||
|
||
videoElement | ||
.play() | ||
.then(() => { | ||
autoplayEnabled = true; | ||
videoElement.pause(); | ||
}) | ||
.catch(() => { | ||
autoplayEnabled = false; | ||
}); | ||
} | ||
|
||
// starts detection as soon as this library is loaded | ||
startDetection(); |
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
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,16 @@ | ||
export const UID1_EIDS = { | ||
'tdid': { | ||
source: 'adserver.org', | ||
atype: 1, | ||
getValue: function(data) { | ||
if (data.id) { | ||
return data.id; | ||
} else { | ||
return data; | ||
} | ||
}, | ||
getUidExt: function(data) { | ||
return {...{rtiPartner: 'TDID'}, ...data.ext} | ||
} | ||
} | ||
} |
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
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.