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

Multiformat refactor changes #2

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6c50bd3
Merge pull request #13 from prebid/master
pm-manasi-moghe Mar 20, 2019
c5ab18d
Merge pull request #14 from pm-harshad-mane/native_refactor
pm-manasi-moghe Mar 20, 2019
9ee6927
code review changes
pm-manasi-moghe Mar 20, 2019
7da2a32
changes to checkMediaType function
pm-manasi-moghe Mar 25, 2019
ec67b85
Merge pull request #15 from pm-harshad-mane/native_refactor
pm-manasi-moghe Mar 26, 2019
b9fb264
Add hb_uuid and hb_cache_id back to dfp module (#3668)
jaiminpanchal27 Mar 26, 2019
12882f9
fix spelling of 'country' (#3679)
Mar 26, 2019
010f203
Kargo migration to localstorage alternatives (#3672)
samuelhorwitz Mar 26, 2019
876a714
ReklamStore Bid Adapter (#3634)
ReklamStoreIT Mar 26, 2019
cc80fe3
support userId module (#3675)
HolzAndrew Mar 26, 2019
c1fbba2
Cedato new bid adapter (#3629)
alexkh13 Mar 26, 2019
0f01ce3
Rubicon Bid Adapter: custom price granularity fix (#3670)
Mar 26, 2019
9d8a37b
Added MediaFuse Lift alias to Orbitsoft adapter (#3682)
Macheta Mar 26, 2019
e74bf6c
Add buyer data to Index bid responses (#3585)
kelvin-chappell Mar 26, 2019
cce5b6e
Ensure width and height are integers (#3674)
benjaminclot Mar 26, 2019
6d8ad70
Prebid 2.8.0 Release
jsnellbaker Mar 26, 2019
68a342c
increment pre version
jsnellbaker Mar 26, 2019
b06919c
add privacyLink for native (#3680)
naoto0822 Mar 27, 2019
04ebe44
Merge pull request #16 from prebid/master
pm-manasi-moghe Mar 27, 2019
a583147
Merge pull request #17 from pm-manasi-moghe/master
pm-manasi-moghe Mar 27, 2019
5d83608
suppress warning of missing mediaTypes.banner for native and video im…
pm-manasi-moghe Mar 27, 2019
67d3a7c
ignore fluid size, if present, in banner impression
pm-manasi-moghe Mar 27, 2019
e985be4
fix for ignoring fluid size in banner impression
pm-manasi-moghe Mar 27, 2019
b2b9e2d
added relevant comments and test cases for fluid case in banner request
pm-manasi-moghe Mar 28, 2019
c715ef0
added sample config for multiformat adunit
pm-manasi-moghe Mar 28, 2019
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
1 change: 1 addition & 0 deletions modules/ajaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const spec = {
sponsoredBy: assets.sponsor,
clickUrl: assets.lp_link,
impressionTrackers: nativeAd.imps,
privacyLink: assets.adchoice_url,
};

if (assets.img_main !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion modules/ajaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ var adUnits = [
icon: {
required: false,
sendId: false
}
},
privacyLink: {
required: true,
sendId: true
},
}
},
bids: [{
Expand Down
154 changes: 154 additions & 0 deletions modules/cedatoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import * as utils from 'src/utils';
import { registerBidder } from 'src/adapters/bidderFactory';
import { BANNER } from 'src/mediaTypes';

const BIDDER_CODE = 'cedato';
const BID_URL = '//h.cedatoplayer.com/hb';
const SYNC_URL = '//h.cedatoplayer.com/hb_usync?uid={UUID}';
const COOKIE_NAME = 'hb-cedato-id';
const UUID_LEN = 36;
const TTL = 10000;
const CURRENCY = 'USD';
const FIRST_PRICE = 1;
const NET_REVENUE = true;

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],

isBidRequestValid: function(bid) {
return !!(
bid &&
bid.params &&
bid.params.player_id &&
utils.checkCookieSupport() &&
utils.cookiesAreEnabled()
);
},

buildRequests: function(bidRequests, bidderRequest) {
const req = bidRequests[Math.floor(Math.random() * bidRequests.length)];
const params = req.params;
const at = FIRST_PRICE;
const site = { id: params.player_id, domain: document.domain };
const device = { ua: navigator.userAgent, ip: '' };
const user = { id: getUserID() }
const cur = [ CURRENCY ];
const tmax = bidderRequest.timeout;

const imp = bidRequests.map(req => {
const banner = { 'format': getFormats(utils.deepAccess(req, 'mediaTypes.banner.sizes')) };
const bidfloor = params.bidfloor !== undefined
? Number(params.bidfloor) : 1;
const bidfloorcur = CURRENCY;
const bidId = req.bidId;

return {
bidId,
banner,
bidfloor,
bidfloorcur,
};
});

const payload = {
at,
site,
device,
user,
imp,
cur,
tmax,
};

if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr_consent = {
consent_string: bidderRequest.gdprConsent.consentString,
consent_required: bidderRequest.gdprConsent.gdprApplies
};
}

return {
method: 'POST',
url: BID_URL,
data: JSON.stringify(payload),
};
},

interpretResponse: function(resp) {
if (resp.body === '') return [];

const bids = resp.body.seatbid[0].bid.map(bid => {
const cpm = bid.price;
const requestId = bid.uuid;
const width = bid.w;
const height = bid.h;
const creativeId = bid.crid;
const dealId = bid.dealid;
const currency = resp.body.cur;
const netRevenue = NET_REVENUE;
const ttl = TTL;
const ad = bid.adm;

return {
cpm,
requestId,
width,
height,
creativeId,
dealId,
currency,
netRevenue,
ttl,
ad,
};
});

return bids;
},

getUserSyncs: function(syncOptions, resps, gdprConsent) {
const syncs = [];
if (syncOptions.pixelEnabled) {
resps.forEach(() => {
const uuid = getUserID();
const syncUrl = SYNC_URL;
let params = '';
if (gdprConsent && typeof gdprConsent.consentString === 'string') {
if (typeof gdprConsent.gdprApplies === 'boolean') {
params += `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
} else {
params += `?gdpr_consent=${gdprConsent.consentString}`;
}
}
syncs.push({
type: 'image',
url: syncUrl.replace('{UUID}', uuid) + params,
});
});
}
return syncs;
}
}

const getUserID = () => {
const cookieName = COOKIE_NAME;
const uuidLen = UUID_LEN;

const i = document.cookie.indexOf(cookieName);

if (i === -1) {
const uuid = utils.generateUUID();
document.cookie = `${cookieName}=${uuid}; path=/`;
return uuid;
}

const j = i + cookieName.length + 1;
return document.cookie.substring(j, j + uuidLen);
};

const getFormats = arr => arr.map((s) => {
return { w: s[0], h: s[1] };
});

registerBidder(spec);
53 changes: 53 additions & 0 deletions modules/cedatoBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Overview

```
Module Name: Cedato Bidder Adapter
Module Type: Bidder Adapter
Maintainer: alexk@cedato.com
```

# Description

Connects to Cedato bidder.
Cedato adapter supports only Banner at the moment.

# Test Parameters
```
var adUnits = [
// Banner
{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
// You can choose one of them
sizes: [
[300, 250],
[300, 600],
[240, 400],
[728, 90],
]
}
},
bids: [
{
bidder: "cedato",
params: {
player_id: 1450133326,
}
}
]
}
];

pbjs.que.push(() => {
pbjs.setConfig({
userSync: {
syncEnabled: true,
enabledBidders: ['cedato'],
pixelEnabled: true,
syncsPerBidder: 200,
syncDelay: 100,
},
});
});
```
4 changes: 4 additions & 0 deletions modules/dfpAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ function getCustParams(bid, options) {

const optCustParams = deepAccess(options, 'params.cust_params');
let customParams = Object.assign({},
// Why are we adding standard keys here ? Refer https://github.com/prebid/Prebid.js/issues/3664
{ hb_uuid: bid && bid.videoCacheKey },
// hb_uuid will be deprecated and replaced by hb_cache_id
{ hb_cache_id: bid && bid.videoCacheKey },
allTargetingData,
adserverTargeting,
optCustParams,
Expand Down
6 changes: 3 additions & 3 deletions modules/etargetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ export const spec = {
var i, l, bid, reqParams, netRevenue, gdprObject;
var request = [];
var bids = JSON.parse(JSON.stringify(validBidRequests));
var lastContry = 'sk';
var lastCountry = 'sk';
for (i = 0, l = bids.length; i < l; i++) {
bid = bids[i];
if (countryMap[bid.params.country]) {
lastContry = countryMap[bid.params.country];
lastCountry = countryMap[bid.params.country];
}
reqParams = bid.params;
reqParams.transactionId = bid.transactionId;
request.push(formRequestUrl(reqParams));
}

request.unshift('//' + lastContry + '.search.etargetnet.com/hb/?hbget=1');
request.unshift('//' + lastCountry + '.search.etargetnet.com/hb/?hbget=1');
netRevenue = 'net';

if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) {
Expand Down
5 changes: 5 additions & 0 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ function parseBid(rawBid, currency) {
bid.currency = currency;
bid.creativeId = rawBid.hasOwnProperty('crid') ? rawBid.crid : '-';

bid.meta = {};
bid.meta.networkId = utils.deepAccess(rawBid, 'ext.dspid');
bid.meta.brandId = utils.deepAccess(rawBid, 'ext.advbrandid');
bid.meta.brandName = utils.deepAccess(rawBid, 'ext.advbrand');

return bid;
}

Expand Down
50 changes: 23 additions & 27 deletions modules/kargoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,40 +91,37 @@ export const spec = {
return null;
},

_getCrbIds() {
_getCrbFromCookie() {
try {
const crb = JSON.parse(decodeURIComponent(spec._readCookie('krg_crb')));
let syncIds = {};

if (crb && crb.v) {
let vParsed = JSON.parse(atob(crb.v));

if (vParsed && vParsed.syncIds) {
syncIds = vParsed.syncIds;
if (vParsed) {
return vParsed;
}
}

return syncIds;
return {};
} catch (e) {
return {};
}
},

_getUid() {
_getCrbFromLocalStorage() {
try {
const uid = JSON.parse(decodeURIComponent(spec._readCookie('krg_uid')));
let vData = {};

if (uid && uid.v) {
vData = uid.v;
}

return vData;
return JSON.parse(atob(spec._getLocalStorageSafely('krg_crb')));
} catch (e) {
return {};
}
},

_getCrb() {
let localStorageCrb = spec._getCrbFromLocalStorage();
if (Object.keys(localStorageCrb).length) {
return localStorageCrb;
}
return spec._getCrbFromCookie();
},

_getKruxUserId() {
return spec._getLocalStorageSafely('kxkar_user');
},
Expand Down Expand Up @@ -156,28 +153,27 @@ export const spec = {
},

_getUserIds() {
const uid = spec._getUid();
const crbIds = spec._getCrbIds();

const crb = spec._getCrb();
return {
kargoID: uid.userId,
clientID: uid.clientId,
crbIDs: crbIds,
optOut: uid.optOut
kargoID: crb.userId,
clientID: crb.clientId,
crbIDs: crb.syncIds || {},
optOut: crb.optOut
};
},

_getClientId() {
const uid = spec._getUid();
return uid.clientId;
const crb = spec._getCrb();
return crb.clientId;
},

_getAllMetadata() {
return {
userIDs: spec._getUserIds(),
krux: spec._getKrux(),
pageURL: window.location.href,
rawCRB: spec._readCookie('krg_crb')
rawCRB: spec._readCookie('krg_crb'),
rawCRBLocalStorage: spec._getLocalStorageSafely('krg_crb')
};
},

Expand Down
2 changes: 1 addition & 1 deletion modules/orbitsoftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let styleParamsMap = {
};
export const spec = {
code: BIDDER_CODE,
aliases: ['oas', '152media'], // short code and customer aliases
aliases: ['oas', 'mediafuseLift'], // short code and customer aliases
isBidRequestValid: function (bid) {
switch (true) {
case !('params' in bid):
Expand Down
Loading