Skip to content

Commit

Permalink
AFP Bid Adapter: add new bid adapter and integration examples (#7301)
Browse files Browse the repository at this point in the history
* Fix astraoneBidAdapter

* Fix examples; update astraoneBidAdapter description

* Fix astraoneBidAdapter_spec

* Remove integration examples

* Rename gbt to gpt

* update AFP Adapter and add page examples

* replace "AstraLab" with "AFP"

* fix prefixes in example pages

* Revert "update AFP Adapter and add page examples"

This reverts commit 6e15c6a (Revert "astraone" adapter)

* fix error while testing in CircleCI

* update AFP Adapter and add page examples

* Revert "update AFP Adapter and add page examples"

This reverts commit 31224ed.

* fix error while testing in CircleCI

* fix error while testing in CircleCI

* fix error while testing in CircleCI

* replace test ids

* add new format "Just Banner" and refactoring

* update examples in test page and in '.md' file

Co-authored-by: Liza Kobrazova <lizakobrazova@gmail.com>
  • Loading branch information
andrey-ka-97 and lizakobrazova authored Sep 17, 2021
1 parent 1a9d74a commit 1fdc735
Show file tree
Hide file tree
Showing 5 changed files with 1,214 additions and 0 deletions.
242 changes: 242 additions & 0 deletions integrationExamples/gpt/afpExample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Prebid.js Banner Example</title>
<script src="../../../build/dev/prebid.js"></script>
<script>
var adUnits = [
{
code: 'iib-target',
mediaTypes: {
banner: {
sizes: [[0, 0]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-image",
placeId: "613221112871613d1517d181", // id from personal account
placeContainer: '#iib-container',
imageUrl: "https://rtbinsight.ru/content/images/size/w1000/2021/05/ximage-30.png.pagespeed.ic.IfuX4zAEPP.png",
imageWidth: 1000,
imageHeight: 524,
}
}]
},
{
code: 'iimb-target',
mediaTypes: {
banner: {
sizes: [[0, 0]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-image Max",
placeId: "6139ae472871613d1517dedd", // id from personal account
placeContainer: '#iimb-container',
imageUrl: "https://rtbinsight.ru/content/images/size/w1000/2021/05/ximage-30.png.pagespeed.ic.IfuX4zAEPP.png",
imageWidth: 1000,
imageHeight: 524,
}
}]
},
{
code: 'icb-target',
mediaTypes: {
banner: {
sizes: [[0, 0]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-content Banner",
placeId: "6139ae082871613d1517dec0", // id from personal account
placeContainer: '#icb-container',
}
}]
},
{
code: 'ics-target',
mediaTypes: {
banner: {
sizes: [[0, 0]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-content Stories",
placeId: "6139ae292871613d1517ded3", // id from personal account
placeContainer: '#ics-container',
}
}]
},
{
code: 'as-target',
mediaTypes: {
banner: {
sizes: [[0, 0]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "Action Scroller",
placeId: "6139adc12871613d1517deb0", // id from personal account
placeContainer: '#as-container',
}
}]
},
{
code: 'asl-target',
mediaTypes: {
banner: {
sizes: [[0, 0]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "Action Scroller Light",
placeId: "6139adda2871613d1517deb8", // id from personal account
placeContainer: '#asl-container',
}
}]
},
{
code: 'jb-target',
mediaTypes: {
banner: {
sizes: [[100, 100], [300, 250], [40, 50]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "Just Banner",
placeId: "6139ae832871613d1517dee9", // id from personal account
placeContainer: '#jb-container',
}
}]
},
{
code: 'icv-target',
mediaTypes: {
video: {
playerSize: [[480, 320]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-content Video",
placeId: "6139ae182871613d1517deca", // id from personal account
placeContainer: '#icv-container',
}
}]
},
{
code: 'ocv-target',
mediaTypes: {
video: {
playerSize: [[480, 320]],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "Out-content Video",
placeId: "6139ae5b2871613d1517dee2", // id from personal account
placeContainer: '#ocv-container', // only the "body" tag is used as a container
}
}]
}
];

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

pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function (e) {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;

var targets = ['iib-target', 'iimb-target', 'icb-target', 'ics-target', 'as-target', 'asl-target', 'jb-target', 'icv-target', 'ocv-target']

targets.forEach(function(target) {
var params = pbjs.getAdserverTargetingForAdUnitCode(target);
var iframe = document.getElementById(target);

if (params && params['hb_adid']) {
pbjs.renderAd(iframe.contentDocument, params['hb_adid']);
}
})
}
});
});
</script>
</head>
<body id="ocv-container">
<h2>In-image</h2>
<div class="container-wrapper">
<div id="iib-container" style="max-width: 600px;">
<img src="https://creative.astraone.io/files/default_image-1-600x400.jpg" width="100%" />
</div>
<iframe id="iib-target" style="display: none;"></iframe>
</div>

<h2>In-image Max</h2>
<div class="container-wrapper">
<div id="iimb-container" style="max-width: 600px;">
<img src="https://creative.astraone.io/files/default_image-1-600x400.jpg" width="100%" />
</div>
<iframe id="iimb-target" style="display: none;"></iframe>
</div>

<h2>In-content Banner</h2>
<div class="container-wrapper">
<div id="icb-container"></div>
<iframe id="icb-target" style="display: none;"></iframe>
</div>

<h2>In-content Stories</h2>
<div class="container-wrapper">
<div id="ics-container"></div>
<iframe id="ics-target" style="display: none;"></iframe>
</div>

<h2>Action Scroller</h2>
<div class="container-wrapper">
<div id="as-container"></div>
<iframe id="as-target" style="display: none;"></iframe>
</div>

<h2>Action Scroller Light</h2>
<div class="container-wrapper">
<div id="asl-container"></div>
<iframe id="asl-target" style="display: none;"></iframe>
</div>

<h2>Just Banner</h2>
<div class="container-wrapper">
<div id="jb-container"></div>
<iframe id="jb-target" style="display: none;"></iframe>
</div>

<h2>In-content Video</h2>
<div class="container-wrapper">
<div id="icv-container"></div>
<iframe id="icv-target" style="display: none;"></iframe>
</div>

<!-- Out-content Video -->
<iframe id="ocv-target" style="display: none;"></iframe>
</body>
</html>
152 changes: 152 additions & 0 deletions integrationExamples/gpt/afpGamExample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Prebid.js Banner Example</title>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script src="../../../build/dev/prebid.js"></script>
<script>
var adUnits = [{
code: 'div-gpt-ad-1574864639578-0',
mediaTypes: {
banner: {
sizes: [0, 0],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-image",
placeId: "613221112871613d1517d181",
placeContainer: '#iib-container',
imageUrl: "https://rtbinsight.ru/content/images/size/w1000/2021/05/ximage-30.png.pagespeed.ic.IfuX4zAEPP.png",
imageWidth: 600,
imageHeight: 400,
}
}]
},
{
code: 'div-gpt-ad-1574864639578-1',
mediaTypes: {
video: {
playerSize: [640, 480]
}
},
bids: [{
bidder: "afp",
params: {
placeType: "In-content Video",
placeId: "60e5684718047b3fae304617",
placeContainer: '#icv-container',
}
}]
},
{
code: 'div-gpt-ad-1574864639578-2',
mediaTypes: {
banner: {
sizes: [500, 500],
}
},
bids: [{
bidder: "afp",
params: {
placeType: "Action Scroller",
placeId: "60f15a8515770d5ab7c7f885",
placeContainer: '#as-container',
}
}]
}];

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

var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

googletag.cmd.push(() => {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(() => {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({ bidsBackHandler: sendAdServerRequest });
});

function sendAdServerRequest() {
googletag.cmd.push(() => {
pbjs.que.push(() => {
pbjs.setTargetingForGPTAsync('div-gpt-ad-1574864639578-0');
pbjs.setTargetingForGPTAsync('div-gpt-ad-1574864639578-1');
pbjs.setTargetingForGPTAsync('div-gpt-ad-1574864639578-2');
googletag.pubads().refresh();
});
});
}

googletag.cmd.push(() => {
googletag
.defineSlot('/19968336/header-bid-tag-0', [300, 250], 'div-gpt-ad-1574864639578-0')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

googletag.cmd.push(() => {
googletag
.defineSlot('/19968336/header-bid-tag-0', [300, 250], 'div-gpt-ad-1574864639578-1')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

googletag.cmd.push(() => {
googletag
.defineSlot('/19968336/header-bid-tag-0', [300, 250], 'div-gpt-ad-1574864639578-2')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

</script>
</head>
<body id="ocv-container">
<h2>In-image</h2>
<div class="container-wrapper">
<div id="iib-container" style="width: 600px;">
<img src="https://creative.astraone.io/files/default_image-1-600x400.jpg" width="100%" />
</div>
<div id="div-gpt-ad-1574864639578-0">
<script type="text/javascript">
googletag.cmd.push(function() {
googletag.display('div-gpt-ad-1574864639578-0');
});
</script>
</div>
</div>

<h2>In-content Video</h2>
<div class="container-wrapper">
<div id="icv-container"></div>
<div id="div-gpt-ad-1574864639578-1">
<script type="text/javascript">
googletag.cmd.push(function() {
googletag.display('div-gpt-ad-1574864639578-1');
});
</script>
</div>
</div>

<h2>Action Scroller</h2>
<div class="container-wrapper">
<div id="as-container"></div>
<div id="div-gpt-ad-1574864639578-2">
<script type="text/javascript">
googletag.cmd.push(function() {
googletag.display('div-gpt-ad-1574864639578-2');
});
</script>
</div>
</div>
</body>
</html>
Loading

0 comments on commit 1fdc735

Please sign in to comment.