Skip to content

Commit

Permalink
Merge tag '2.25.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Wright committed Jul 24, 2019
2 parents 232d168 + 99132d8 commit 789afc0
Show file tree
Hide file tree
Showing 33 changed files with 1,179 additions and 209 deletions.
102 changes: 102 additions & 0 deletions integrationExamples/gpt/inskin_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!--
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>
var PREBID_TIMEOUT = 3300;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'inskin',
params: {
networkId: '9874',
siteId: '983808'
}
}]

}];

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

</script>

<script type="text/javascript" src="../../build/dev/prebid.js" async></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
});
});

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();
}, PREBID_TIMEOUT);

</script>

<script>
(function () {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</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>
9 changes: 8 additions & 1 deletion modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import * as utils from '../src/utils';
import find from 'core-js/library/fn/array/find';
import JSEncrypt from 'jsencrypt/bin/jsencrypt';
import sha256 from 'crypto-js/sha256';
import { config } from '../src/config';

const ADAPTER_VERSION = 16;
const ADAPTER_VERSION = 17;
const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = '//bidder.criteo.com/cdb';
const CRITEO_VENDOR_ID = 91;
Expand Down Expand Up @@ -47,6 +48,8 @@ export const spec = {
let url;
let data;

Object.assign(bidderRequest, { ceh: config.getConfig('criteo.ceh') });

// If publisher tag not already loaded try to get it from fast bid
if (!publisherTagAvailable()) {
window.Criteo = window.Criteo || {};
Expand Down Expand Up @@ -239,6 +242,10 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
if (networkId) {
request.publisher.networkid = networkId;
}
request.user = {};
if (bidderRequest && bidderRequest.ceh) {
request.user.ceh = bidderRequest.ceh;
}
if (bidderRequest && bidderRequest.gdprConsent) {
request.gdprConsent = {};
if (typeof bidderRequest.gdprConsent.gdprApplies !== 'undefined') {
Expand Down
10 changes: 10 additions & 0 deletions modules/criteoBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ Module that connects to Criteo's demand sources.
}
];
```

# Additional Config (Optional)
Set the "ceh" property to provides the user's hashed email if available
```
pbjs.setConfig({
criteo: {
ceh: 'hashed mail'
}
});
```
2 changes: 1 addition & 1 deletion modules/dfpAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function buildAdpodVideoUrl({code, params, callback} = {}) {
[adpodUtils.TARGETING_KEY_PB_CAT_DUR]: undefined,
[adpodUtils.TARGETING_KEY_CACHE_ID]: undefined
}
let customParams;
let customParams = {};
if (targeting[code]) {
customParams = targeting[code].reduce((acc, curValue) => {
if (Object.keys(curValue)[0] === adpodUtils.TARGETING_KEY_PB_CAT_DUR) {
Expand Down
9 changes: 8 additions & 1 deletion modules/inskinBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,15 @@ export const spec = {

if (serverResponse) {
const decision = serverResponse.decisions && serverResponse.decisions[bidId];
const price = decision && decision.pricing && decision.pricing.clearPrice;
const data = decision && decision.contents && decision.contents[0] && decision.contents[0].data;
const pubCPM = data && data.customData && data.customData.pubCPM;
const clearPrice = decision && decision.pricing && decision.pricing.clearPrice;
const price = pubCPM || clearPrice;

if (decision && price) {
decision.impressionUrl += ('&property:pubcpm=' + price);
bidObj.price = price;

bid.requestId = bidId;
bid.cpm = price;
bid.width = decision.width;
Expand Down Expand Up @@ -149,6 +155,7 @@ export const spec = {
const id = 'ism_tag_' + Math.floor((Math.random() * 10e16));
window[id] = {
bidId: e.data.bidId,
bidPrice: bidsMap[e.data.bidId].price,
serverResponse
};
const script = document.createElement('script');
Expand Down
68 changes: 68 additions & 0 deletions modules/logicadBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import {registerBidder} from '../src/adapters/bidderFactory';
import {BANNER} from '../src/mediaTypes';

const BIDDER_CODE = 'logicad';
const ENDPOINT_URL = 'https://pb.ladsp.com/adrequest/prebid';

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],
isBidRequestValid: function (bid) {
return !!(bid.params && bid.params.tid);
},
buildRequests: function (bidRequests, bidderRequest) {
const requests = [];
for (let i = 0, len = bidRequests.length; i < len; i++) {
const request = {
method: 'POST',
url: ENDPOINT_URL,
data: JSON.stringify(newBidRequest(bidRequests[i], bidderRequest)),
options: {},
bidderRequest
};
requests.push(request);
}
return requests;
},
interpretResponse: function (serverResponse, bidderRequest) {
serverResponse = serverResponse.body;
const bids = [];
if (!serverResponse || serverResponse.error) {
return bids;
}
serverResponse.seatbid.forEach(function (seatbid) {
bids.push(seatbid.bid);
})
return bids;
},
getUserSyncs: function (syncOptions, serverResponses) {
if (serverResponses.length > 0 && serverResponses[0].body.userSync &&
syncOptions.pixelEnabled && serverResponses[0].body.userSync.type == 'image') {
return [{
type: 'image',
url: serverResponses[0].body.userSync.url
}];
}
return [];
},
};

function newBidRequest(bid, bidderRequest) {
return {
auctionId: bid.auctionId,
bidderRequestId: bid.bidderRequestId,
bids: [{
adUnitCode: bid.adUnitCode,
bidId: bid.bidId,
transactionId: bid.transactionId,
sizes: bid.sizes,
params: bid.params,
mediaTypes: bid.mediaTypes
}],
prebidJsVersion: '$prebid.version$',
referrer: bidderRequest.refererInfo.referer,
auctionStartTime: bidderRequest.auctionStart,
};
}

registerBidder(spec);
25 changes: 25 additions & 0 deletions modules/logicadBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Overview
```
Module Name: Logicad for Publishers
Module Type: Bidder Adapter
Maintainer: [email protected]
```

# Description
Module that connects to Logicad's demand sources.
Currently module supports only banner mediaType.

# Test Parameters
```
var adUnits = [{
code: 'test-code',
sizes: [[300, 250],[300, 600]],
bids: [{
bidder: 'logicad',
params: {
tid: 'test',
page: 'url',
}
}]
}];
```
2 changes: 1 addition & 1 deletion modules/my6senseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BANNER, NATIVE } from '../src/mediaTypes';

const {registerBidder} = require('../src/adapters/bidderFactory');
const BIDDER_CODE = 'my6sense';
const END_POINT = '//papi.mynativeplatform.com/pub2/web/v1.15.0/hbwidget.json';
const END_POINT = '//hb.mynativeplatform.com/pub2/web/v1.15.0/hbwidget.json';
const END_POINT_METHOD = 'POST';

// called first
Expand Down
Loading

0 comments on commit 789afc0

Please sign in to comment.