Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase #5

Merged
merged 57 commits into from
Apr 19, 2021
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
81fc1ce
PBJS Core: canBidderRegisterSync ignoring iframe sync disabled by def…
patmmccann Apr 7, 2021
987c082
Added automatic tzo and targetId to adserver request. (#6534)
mikael-lundin Apr 7, 2021
0ab0964
Tappx Bid Adapter: minor updates and universal id added (#6504)
prebidtappx Apr 7, 2021
56bb4ae
Impactify Bid Adapter: add new bid adapter (#6518)
thomasdseao Apr 7, 2021
ef14e4f
Prebid 4.34.0 Release
Apr 7, 2021
f0e3891
Increment pre version
Apr 7, 2021
ce63213
Prebid server adapter: add config for openx hosting (#6530)
deivydas Apr 8, 2021
3cf4702
Yieldmo adapter: add meta data to bids (#6550)
ym-atsymuk Apr 8, 2021
3eae68b
Smartx Bid Adapter: Add meta.advertiserDomains support (#6547)
Skylinar Apr 8, 2021
6af2f1e
Onevideo / Adap.tv Adapter: updated example configuration (#6546)
adam-browning Apr 8, 2021
f48f978
Mass Deal Rendering Module: support multiple custom configs for dealI…
cciocov Apr 9, 2021
c3f5f85
ZetaSsp Bid Adapter: add new bid adapter (#6432)
asurovenko-zeta Apr 9, 2021
60b9d57
Adnuntius Bid Adapter: Fix for bid too low. (#6557)
mikael-lundin Apr 9, 2021
2cc905e
ReadPeak Bid Adapter: fix api issues, add gdpr consent, & getfloor mo…
readpeaktuomo Apr 9, 2021
c34d853
BetweenBidAdatper: added sharedid support (#6531)
ignat-one Apr 9, 2021
1183ae1
adWMG Bid Adapter: update endpoints for cookie sync (#6544)
nyakove Apr 9, 2021
cda0a48
Yieldmo Bid Adapter: add support for the floors module (#6541)
ym-dlabuzov Apr 9, 2021
1003755
Sortable Bid Adapter: add eids support (#6565)
karentnarvaez Apr 10, 2021
421066f
Outbrain Bid Adapter: replacing Zemanta (#6558)
Apr 10, 2021
1107655
Sirdata Real-time Data Module: add new RTD module (#6515)
nouchy Apr 10, 2021
c19e855
Logicad Bid Adapter: add support for userid modules (#6529)
logicad Apr 12, 2021
80de594
ATS-identityLinkIdSystem - add use3P config property to control firin…
mamatic Apr 12, 2021
75f5bdf
Proxistore Bid Adapter: add support for tcf v2 consent (#6543)
vincentproxistore Apr 12, 2021
4b0ba6f
BlueBillyWig Bid Adapter: add renderer customization options (#6540)
K-JBoon Apr 12, 2021
5acc5d2
OpenX Bid Adapter: Set Deal ID for video requests (#6573)
kenan-gillet Apr 12, 2021
7b09115
33Across Bid Adapter: add support for User ID modules (#6554)
curlyblueeagle Apr 12, 2021
dc5a59c
pubGENIUS bid adapter: support floor module (#6555)
edmonl Apr 12, 2021
37de88e
Welect Bid Adapter: update url of API (#6570)
nduitz Apr 13, 2021
e397325
Bright Mountain Media Bid Adapter: change bidder code to bmtm; alias …
Apr 13, 2021
abb1ba4
Adtelligent Bid Adapter: add adUrl support & new alias (#6559)
GeneGenie Apr 13, 2021
9eff9d5
Bright Mountain Media Bid Adapter: Change Endpoint URL (#6576)
Apr 13, 2021
e0007c2
Outbrain Bid Adapter: only trigger nurl ajax call if nurl is present …
Apr 13, 2021
c83bc53
LiveWrapper Bid Adapter: add US privacy and Coppa support (#6569)
bjorn-lw Apr 13, 2021
41e050a
Rubicon Analytics: Handle PBS Sending Bid ID 0 (#6584)
robertrmartinez Apr 13, 2021
e256788
TrustX Bid Adapter: support new format request (#6556)
PWyrembak Apr 14, 2021
5fbef60
FeedAd Bid Adapter: add support for GDPR/TCF 2.0 & remove video suppo…
couchcrew-thomas Apr 14, 2021
1aeca20
Ats optional 3p endpoint - keep default behavior the same (#6586)
mamatic Apr 14, 2021
d51d6eb
use another uri for cookieless (#6572)
vincentproxistore Apr 14, 2021
6a6268a
Pbjs Core: add new API to return the highest unused bid for a given a…
woggle23 Apr 14, 2021
93ba601
Adpone Bid Adapter: remove usersync and pass gpdr via querystring (#6…
seergiioo6 Apr 14, 2021
fddb135
Yieldmo bid adapter: set outstream renderer. (#6566)
ym-abaranov Apr 14, 2021
42e36de
Richaudience Bid Adapter: add new config UserSync (#6523)
richaudience Apr 14, 2021
05d8773
Prebid 4.35.0 Release
smenzer Apr 14, 2021
a3790c2
Increment pre version
smenzer Apr 14, 2021
caead3c
Deepintent ID System: add new ID module (#6537)
sourabhg Apr 15, 2021
bea2261
Update spotxBidAdpter renderer url to ensure onLoad is always called.…
npeceniak Apr 15, 2021
d18c6a8
VIS.X: add onSetTargeting, onBidWon & onTimeout handlers (#6532)
mk0x9 Apr 15, 2021
6ff2cf7
Index Exchange Bid Adapter: resolve negative size bug (#6582)
umakajan Apr 15, 2021
170c82d
smartx Bid Adapter: Outstream render bugfix numeric elementId (#6588)
Skylinar Apr 15, 2021
de40982
Update cookie sync call (#6567)
MaxSmileWanted Apr 16, 2021
8745d46
Add videoCacheKey back to bid response when using spotx as cache serv…
npeceniak Apr 16, 2021
f65fe74
Nativo Bid Adapter: add new bid adapter (#6542)
jsfledd Apr 16, 2021
1b28481
Spotx Bid Adapter: Update endpoint to indicate request is from Prebid…
npeceniak Apr 16, 2021
dd64734
Sharethrough Bid Adapter: add support for COPPA (#6602)
Apr 16, 2021
ef00f9b
tappx Bid Adapter: add video instream support and update testing (#6580)
prebidtappx Apr 16, 2021
c1e3ee6
Halo RTD Module: FPD 2.0 Updates & add ID system tests (#6505)
Apr 19, 2021
dc710b1
Zemanta bid adapter: reinstate Outbrain as alias (#6617)
Apr 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Outbrain Bid Adapter: replacing Zemanta (prebid#6558)
  • Loading branch information
Rok Sušnik authored Apr 10, 2021
commit 421066fb6d63da4148eb09296f0c1c4c3529dce4
274 changes: 274 additions & 0 deletions modules/outbrainBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
// jshint esversion: 6, es3: false, node: true
'use strict';

import {
registerBidder
} from '../src/adapters/bidderFactory.js';
import { NATIVE, BANNER } from '../src/mediaTypes.js';
import * as utils from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import { config } from '../src/config.js';

const BIDDER_CODE = 'outbrain';
const GVLID = 164;
const CURRENCY = 'USD';
const NATIVE_ASSET_IDS = { 0: 'title', 2: 'icon', 3: 'image', 5: 'sponsoredBy', 4: 'body', 1: 'cta' };
const NATIVE_PARAMS = {
title: { id: 0, name: 'title' },
icon: { id: 2, type: 1, name: 'img' },
image: { id: 3, type: 3, name: 'img' },
sponsoredBy: { id: 5, name: 'data', type: 1 },
body: { id: 4, name: 'data', type: 2 },
cta: { id: 1, type: 12, name: 'data' }
};

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [ NATIVE, BANNER ],
isBidRequestValid: (bid) => {
return (
!!config.getConfig('outbrain.bidderUrl') &&
!!utils.deepAccess(bid, 'params.publisher.id') &&
!!(bid.nativeParams || bid.sizes)
);
},
buildRequests: (validBidRequests, bidderRequest) => {
const page = bidderRequest.refererInfo.referer;
const ua = navigator.userAgent;
const test = setOnAny(validBidRequests, 'params.test');
const publisher = setOnAny(validBidRequests, 'params.publisher');
const bcat = setOnAny(validBidRequests, 'params.bcat');
const badv = setOnAny(validBidRequests, 'params.badv');
const cur = CURRENCY;
const endpointUrl = config.getConfig('outbrain.bidderUrl');
const timeout = bidderRequest.timeout;

const imps = validBidRequests.map((bid, id) => {
bid.netRevenue = 'net';
const imp = {
id: id + 1 + ''
}

if (bid.params.tagid) {
imp.tagid = bid.params.tagid
}

if (bid.nativeParams) {
imp.native = {
request: JSON.stringify({
assets: getNativeAssets(bid)
})
}
} else {
imp.banner = {
format: transformSizes(bid.sizes)
}
}

return imp;
});

const request = {
id: bidderRequest.auctionId,
site: { page, publisher },
device: { ua },
source: { fd: 1 },
cur: [cur],
tmax: timeout,
imp: imps,
bcat: bcat,
badv: badv,
};

if (test) {
request.is_debug = !!test;
request.test = 1;
}

if (utils.deepAccess(bidderRequest, 'gdprConsent.gdprApplies')) {
utils.deepSetValue(request, 'user.ext.consent', bidderRequest.gdprConsent.consentString)
utils.deepSetValue(request, 'regs.ext.gdpr', bidderRequest.gdprConsent.gdprApplies & 1)
}
if (bidderRequest.uspConsent) {
utils.deepSetValue(request, 'regs.ext.us_privacy', bidderRequest.uspConsent)
}
if (config.getConfig('coppa') === true) {
utils.deepSetValue(request, 'regs.coppa', config.getConfig('coppa') & 1)
}

return {
method: 'POST',
url: endpointUrl,
data: JSON.stringify(request),
bids: validBidRequests
};
},
interpretResponse: (serverResponse, { bids }) => {
if (!serverResponse.body) {
return [];
}
const { seatbid, cur } = serverResponse.body;

const bidResponses = flatten(seatbid.map(seat => seat.bid)).reduce((result, bid) => {
result[bid.impid - 1] = bid;
return result;
}, []);

return bids.map((bid, id) => {
const bidResponse = bidResponses[id];
if (bidResponse) {
const type = bid.nativeParams ? NATIVE : BANNER;
const bidObject = {
requestId: bid.bidId,
cpm: bidResponse.price,
creativeId: bidResponse.crid,
ttl: 360,
netRevenue: bid.netRevenue === 'net',
currency: cur,
mediaType: type,
nurl: bidResponse.nurl,
};
if (type === NATIVE) {
bidObject.native = parseNative(bidResponse);
} else {
bidObject.ad = bidResponse.adm;
bidObject.width = bidResponse.w;
bidObject.height = bidResponse.h;
}
bidObject.meta = {};
if (bidResponse.adomain && bidResponse.adomain.length > 0) {
bidObject.meta.advertiserDomains = bidResponse.adomain;
}
return bidObject;
}
}).filter(Boolean);
},
getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent) => {
const syncs = [];
let syncUrl = config.getConfig('outbrain.usersyncUrl');
if (syncOptions.pixelEnabled && syncUrl) {
if (gdprConsent) {
syncUrl += '&gdpr=' + (gdprConsent.gdprApplies & 1);
syncUrl += '&gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || '');
}
if (uspConsent) {
syncUrl += '&us_privacy=' + encodeURIComponent(uspConsent);
}

syncs.push({
type: 'image',
url: syncUrl
});
}
return syncs;
},
onBidWon: (bid) => {
ajax(utils.replaceAuctionPrice(bid.nurl, bid.originalCpm))
}
};

registerBidder(spec);

function parseNative(bid) {
const { assets, link, eventtrackers } = JSON.parse(bid.adm);
const result = {
clickUrl: link.url,
clickTrackers: link.clicktrackers || undefined
};
assets.forEach(asset => {
const kind = NATIVE_ASSET_IDS[asset.id];
const content = kind && asset[NATIVE_PARAMS[kind].name];
if (content) {
result[kind] = content.text || content.value || { url: content.url, width: content.w, height: content.h };
}
});
if (eventtrackers) {
result.impressionTrackers = [];
eventtrackers.forEach(tracker => {
if (tracker.event !== 1) return;
switch (tracker.method) {
case 1: // img
result.impressionTrackers.push(tracker.url);
break;
case 2: // js
result.javascriptTrackers = `<script src=\"${tracker.url}\"></script>`;
break;
}
});
}
return result;
}

function setOnAny(collection, key) {
for (let i = 0, result; i < collection.length; i++) {
result = utils.deepAccess(collection[i], key);
if (result) {
return result;
}
}
}

function flatten(arr) {
return [].concat(...arr);
}

function getNativeAssets(bid) {
return utils._map(bid.nativeParams, (bidParams, key) => {
const props = NATIVE_PARAMS[key];
const asset = {
required: bidParams.required & 1,
};
if (props) {
asset.id = props.id;
let wmin, hmin, w, h;
let aRatios = bidParams.aspect_ratios;

if (aRatios && aRatios[0]) {
aRatios = aRatios[0];
wmin = aRatios.min_width || 0;
hmin = aRatios.ratio_height * wmin / aRatios.ratio_width | 0;
}

if (bidParams.sizes) {
const sizes = flatten(bidParams.sizes);
w = sizes[0];
h = sizes[1];
}

asset[props.name] = {
len: bidParams.len,
type: props.type,
wmin,
hmin,
w,
h
};

return asset;
}
}).filter(Boolean);
}

/* Turn bid request sizes into ut-compatible format */
function transformSizes(requestSizes) {
if (!utils.isArray(requestSizes)) {
return [];
}

if (requestSizes.length === 2 && !utils.isArray(requestSizes[0])) {
return [{
w: parseInt(requestSizes[0], 10),
h: parseInt(requestSizes[1], 10)
}];
} else if (utils.isArray(requestSizes[0])) {
return requestSizes.map(item =>
({
w: parseInt(item[0], 10),
h: parseInt(item[1], 10)
})
);
}

return [];
}
111 changes: 111 additions & 0 deletions modules/outbrainBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Overview

```
Module Name: Outbrain Adapter
Module Type: Bidder Adapter
Maintainer: prog-ops-team@outbrain.com
```

# Description

Module that connects to Outbrain bidder to fetch bids.
Both native and display formats are supported but not at the same time. Using OpenRTB standard.

# Configuration

## Bidder and usersync URLs

The Outbrain adapter does not work without setting the correct bidder and usersync URLs.
You will receive the URLs when contacting us.

```
pbjs.setConfig({
outbrain: {
bidderUrl: 'https://bidder-url.com',
usersyncUrl: 'https://usersync-url.com'
}
});
```


# Test Native Parameters
```
var adUnits = [
code: '/19968336/prebid_native_example_1',
mediaTypes: {
native: {
image: {
required: false,
sizes: [100, 50]
},
title: {
required: false,
len: 140
},
sponsoredBy: {
required: false
},
clickUrl: {
required: false
},
body: {
required: false
},
icon: {
required: false,
sizes: [50, 50]
}
}
},
bids: [{
bidder: 'outbrain',
params: {
publisher: {
id: '2706', // required
name: 'Publishers Name',
domain: 'publisher.com'
},
tagid: 'tag-id',
bcat: ['IAB1-1'],
badv: ['example.com']
}
}]
];

pbjs.setConfig({
outbrain: {
bidderUrl: 'https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/'
}
});
```

# Test Display Parameters
```
var adUnits = [
code: '/19968336/prebid_display_example_1',
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
bids: [{
bidder: 'outbrain',
params: {
publisher: {
id: '2706', // required
name: 'Publishers Name',
domain: 'publisher.com'
},
tagid: 'tag-id',
bcat: ['IAB1-1'],
badv: ['example.com']
},
}]
];

pbjs.setConfig({
outbrain: {
bidderUrl: 'https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/'
}
});
```
3 changes: 0 additions & 3 deletions modules/zemantaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -25,9 +25,6 @@ const NATIVE_PARAMS = {
export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
aliases: [
{ code: 'outbrain', gvlid: GVLID }
],
supportedMediaTypes: [ NATIVE, BANNER ],
isBidRequestValid: (bid) => {
return (
Loading
Oops, something went wrong.