Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into prebid-5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHuie committed Jun 9, 2021
2 parents 1ac7c3b + 3fad473 commit 0b55d6b
Show file tree
Hide file tree
Showing 49 changed files with 1,695 additions and 512 deletions.
117 changes: 117 additions & 0 deletions integrationExamples/gpt/ixMultiFormat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!--
This page calls a single bidder for a single ad slot.
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',
mediaTypes: {
banner: {
sizes: [[300, 250], [600, 500]]
},
video: {
playerSize : [300,250],
mimes : ["video/x-ms-wmv", "video/mp4"],
minduration : 0,
maxduration: 3,
protocols : [1,2]
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'ix',
params: {
// only siteId required
siteId: '300'
}
}]
}];
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>

1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"dgkeywordRtdProvider",
"geoedgeRtdProvider",
"haloRtdProvider",
"iasRtdProvider",
"jwplayerRtdProvider",
"optimeraRtdProvider",
"permutiveRtdProvider",
Expand Down
11 changes: 11 additions & 0 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ function buildRtbRequest(imps, bidderRequest, schain) {
if (schain) {
utils.deepSetValue(req, 'source.ext.schain', schain);
}
let eids = getExtendedUserIds(bidderRequest);
if (eids) {
utils.deepSetValue(req, 'user.ext.eids', eids);
}
return req;
}

Expand Down Expand Up @@ -435,6 +439,13 @@ function createSite(refInfo) {
return site;
}

function getExtendedUserIds(bidderRequest) {
let eids = utils.deepAccess(bidderRequest, 'bids.0.userIdAsEids');
if (utils.isArray(eids)) {
return eids;
}
}

/**
* Format creative with optional nurl call
* @param bid rtb Bid object
Expand Down
2 changes: 1 addition & 1 deletion modules/axonixBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name : Axonix Bidder Adapter
Module Type : Bidder Adapter
Maintainer : support+prebid@axonix.com
Maintainer : support.axonix@emodoinc.com
```

# Description
Expand Down
6 changes: 5 additions & 1 deletion modules/coinzillaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export const spec = {
netRevenue: netRevenue,
ttl: config.getConfig('_bidderTimeout'),
referrer: referrer,
ad: response.ad
ad: response.ad,
mediaType: response.mediaType,
meta: {
advertiserDomains: response.advertiserDomain || []
}
};
bidResponses.push(bidResponse);
}
Expand Down
39 changes: 35 additions & 4 deletions modules/gamoshiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ export const helper = {
}
}
return BANNER;
},
getBidFloor(bid) {
if (!utils.isFn(bid.getFloor)) {
return bid.params.bidfloor ? bid.params.bidfloor : null;
}

let bidFloor = bid.getFloor({
mediaType: '*',
size: '*',
currency: 'USD'
});

if (utils.isPlainObject(bidFloor) && !isNaN(bidFloor.floor) && bidFloor.currency === 'USD') {
return bidFloor.floor;
}

return null;
}
};

Expand Down Expand Up @@ -106,7 +123,7 @@ export const spec = {
id: transactionId,
instl: params.instl === 1 ? 1 : 0,
tagid: adUnitCode,
bidfloor: params.bidfloor || 0,
bidfloor: helper.getBidFloor(bidRequest) || 0,
bidfloorcur: 'USD',
secure: 1
};
Expand All @@ -133,11 +150,19 @@ export const spec = {
const playerSize = mediaTypes.video.playerSize || sizes;
const videoImp = Object.assign({}, imp, {
video: {
protocols: params.protocols || [1, 2, 3, 4, 5, 6],
protocols: bidRequest.mediaTypes.video.protocols || params.protocols || [1, 2, 3, 4, 5, 6],
pos: params.pos || 0,
ext: {
context: mediaTypes.video.context
}
},
mimes: bidRequest.mediaTypes.video.mimes,
maxduration: bidRequest.mediaTypes.video.maxduration,
api: bidRequest.mediaTypes.video.api,
skip: bidRequest.mediaTypes.video.skip || bidRequest.params.video.skip,
placement: bidRequest.mediaTypes.video.placement || bidRequest.params.video.placement,
minduration: bidRequest.mediaTypes.video.minduration || bidRequest.params.video.minduration,
playbackmethod: bidRequest.mediaTypes.video.playbackmethod || bidRequest.params.video.playbackmethod,
startdelay: bidRequest.mediaTypes.video.startdelay || bidRequest.params.video.startdelay
}
});

Expand Down Expand Up @@ -198,9 +223,15 @@ export const spec = {
creativeId: bid.crid || bid.adid,
netRevenue: true,
currency: bid.cur || response.cur,
mediaType: helper.getMediaType(bid)
mediaType: helper.getMediaType(bid),
};

if (bid.adomain && bid.adomain.length) {
outBid.meta = {
advertiserDomains: bid.adomain
}
}

if (utils.deepAccess(bidRequest.bidRequest, 'mediaTypes.' + outBid.mediaType)) {
if (outBid.mediaType === BANNER) {
outBids.push(Object.assign({}, outBid, {ad: bid.adm}));
Expand Down
15 changes: 13 additions & 2 deletions modules/glimpseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import { BANNER } from '../src/mediaTypes.js';

const BIDDER_CODE = 'glimpse';

function transformEachBidResponse(glimpseBid) {
const bid = glimpseBid;
bid.meta = { advertiserDomains: [] };

if (glimpseBid.adomain) {
bid.meta.advertiserDomains = glimpseBid.adomain;
}

return bid;
}

export const spec = {
code: BIDDER_CODE,
url: 'https://api.glimpseprotocol.io/cloud/v1/vault/prebid',
Expand Down Expand Up @@ -45,10 +56,10 @@ export const spec = {
},

interpretResponse: (serverResponse, _) => {
const bids = [];
let bids = [];
try {
const { body } = serverResponse;
bids.push(...body);
bids = body.map(transformEachBidResponse);
} catch (error) {}

return bids;
Expand Down
8 changes: 5 additions & 3 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function _getVidParams (attributes) {
* @param {Object} bid
* @returns {Number} floor
*/
function _getFloor (mediaTypes, staticBidfloor, bid) {
function _getFloor (mediaTypes, staticBidFloor, bid) {
const curMediaType = Object.keys(mediaTypes)[0] || 'banner';
const bidFloor = { floor: 0, currency: 'USD' };

Expand All @@ -220,9 +220,11 @@ function _getFloor (mediaTypes, staticBidfloor, bid) {
floor && (bidFloor.floor = floor);
currency && (bidFloor.currency = currency);

if (staticBidfloor && floor && currency === 'USD') {
bidFloor.floor = Math.max(staticBidfloor, parseFloat(floor));
if (staticBidFloor && floor && currency === 'USD') {
bidFloor.floor = Math.max(staticBidFloor, parseFloat(floor));
}
} else if (staticBidFloor) {
bidFloor.floor = staticBidFloor
}

return bidFloor;
Expand Down
Loading

0 comments on commit 0b55d6b

Please sign in to comment.