Skip to content

Commit

Permalink
Merge branch 'master' of github.com:prebid/Prebid.js into smaato-adapter
Browse files Browse the repository at this point in the history
* 'master' of github.com:prebid/Prebid.js: (39 commits)
  Increment pre version
  Prebid 3.25.0 release
  Add lotame id system (prebid#5388)
  Change endpoint (prebid#5459)
  ozone 2.4.0 adapter updates (prebid#5421)
  Update AppNexus usersync script (prebid#5473)
  Eplanning fix: decode parameters (prebid#5448)
  Teads adapter : Support page referrer and network bandwidth (prebid#5430)
  Merge Valueimpression Bid Adapter to Quantumdex Bid Adapter (prebid#5405)
  Criteo - partially restore adapter before PR prebid#4518 following performance issues (prebid#5376)
  onetagBidAdapter: outstream support (prebid#5435)
  Vidazoo Adapter: Feature/bidder-version (prebid#5384)
  adform and adformOpenRTB bid adapters: Added support for userId modules (prebid#5425)
  proxistore bid adapter: delay request to server by 5 min if there were no bids (prebid#5379)
  Vidazoo Adapter: Feature/subdomain (prebid#5446)
  Inskin Bid adapter small changes (prebid#5373)
  Revert "add AMX adapter (prebid#5383)" (prebid#5455)
  ATS-change logError to logInfo type (prebid#5443)
  ATS-identityLinkId - add additional info logging events (prebid#5442)
  Update padsquad for meta.advertiserDomains (prebid#5439)
  ...
  • Loading branch information
sbrosinski committed Jul 10, 2020
2 parents ef00d2f + 656b352 commit 4c2509e
Show file tree
Hide file tree
Showing 78 changed files with 5,356 additions and 2,185 deletions.
13 changes: 7 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,12 @@ function injectFakeServerEndpointDev() {

function startFakeServer() {
const fakeServer = spawn('node', ['./test/fake-server/index.js', `--port=${FAKE_SERVER_PORT}`]);
fakeServer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
fakeServer.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
fakeServer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
fakeServer.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
}

// support tasks
Expand All @@ -372,6 +372,7 @@ gulp.task('build', gulp.series(clean, 'build-bundle-prod'));
gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));

gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watch)));
gulp.task('serve-fake', gulp.series(clean, gulp.parallel('build-bundle-dev', watch), injectFakeServerEndpointDev, test, startFakeServer));

gulp.task('default', gulp.series(clean, makeWebpackPkg));
Expand Down
9 changes: 7 additions & 2 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@
name: 'idl_env',
expires: 30
}
}, {
},
{
name: "sharedId",
params: {
syncTime: 60 // in seconds, default is 24 hours
Expand All @@ -189,7 +190,11 @@
name: "sharedid",
expires: 28
}
}, {
},
{
name: 'lotamePanoramaId'
},
{
name: "liveIntentId",
params: {
publisherId: "9896876"
Expand Down
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"parrableIdSystem",
"britepoolIdSystem",
"liveIntentIdSystem",
"lotamePanoramaId",
"criteoIdSystem",
"netIdSystem",
"identityLinkIdSystem",
Expand Down
27 changes: 27 additions & 0 deletions modules/adformBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const spec = {
buildRequests: function (validBidRequests, bidderRequest) {
var i, l, j, k, bid, _key, _value, reqParams, netRevenue, gdprObject;
const currency = config.getConfig('currency.adServerCurrency');
const eids = getEncodedEIDs(utils.deepAccess(validBidRequests, '0.userIdAsEids'));

var request = [];
var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], [ 'fd', 1 ], [ 'url', null ], [ 'tid', null ] ];
Expand Down Expand Up @@ -64,6 +65,10 @@ export const spec = {
request.push('us_privacy=' + bidderRequest.uspConsent);
}

if (eids) {
request.push('eids=' + eids);
}

for (i = 1, l = globalParams.length; i < l; i++) {
_key = globalParams[i][0];
_value = globalParams[i][1];
Expand Down Expand Up @@ -91,6 +96,28 @@ export const spec = {

return encodeURIComponent(btoa(url.join('').slice(0, -1)));
}

function getEncodedEIDs(eids) {
if (utils.isArray(eids) && eids.length > 0) {
const parsed = parseEIDs(eids);
return encodeURIComponent(btoa(JSON.stringify(parsed)));
}
}

function parseEIDs(eids) {
return eids.reduce((result, eid) => {
const source = eid.source;
result[source] = result[source] || {};

eid.uids.forEach(value => {
const id = value.id + '';
result[source][id] = result[source][id] || [];
result[source][id].push(value.atype);
});

return result;
}, {});
}
},
interpretResponse: function (serverResponse, bidRequest) {
const VALID_RESPONSES = {
Expand Down
5 changes: 5 additions & 0 deletions modules/adformOpenRTBBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const spec = {
const siteId = setOnAny(validBidRequests, 'params.siteId');
const currency = config.getConfig('currency.adServerCurrency');
const cur = currency && [ currency ];
const eids = setOnAny(validBidRequests, 'userIdAsEids');

const imp = validBidRequests.map((bid, id) => {
bid.netRevenue = pt;
Expand Down Expand Up @@ -133,6 +134,10 @@ export const spec = {
utils.deepSetValue(request, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}

if (eids) {
utils.deepSetValue(request, 'user.ext.eids', eids);
}

return {
method: 'POST',
url: 'https://' + adxDomain + '/adx/openrtb',
Expand Down
4 changes: 2 additions & 2 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const spec = {
if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdprConsent = {
consentString: bidderRequest.gdprConsent.consentString,
consentRequired: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true
consentRequired: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : null
};
}

Expand Down Expand Up @@ -80,7 +80,7 @@ export const spec = {

try {
bidRequests = JSON.parse(request.data).Bids;
} catch (e) {
} catch (err) {
// json error initial request can't be read
}

Expand Down
24 changes: 18 additions & 6 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,26 @@ export const spec = {
});
}

let eids = [];
const criteoId = utils.deepAccess(bidRequests[0], `userId.criteoId`);
if (criteoId) {
let tpuids = [];
tpuids.push({
'provider': 'criteo',
'user_id': criteoId
eids.push({
source: 'criteo.com',
id: criteoId
});
payload.tpuids = tpuids;
}

const tdid = utils.deepAccess(bidRequests[0], `userId.tdid`);
if (tdid) {
eids.push({
source: 'adserver.org',
id: tdid,
rti_partner: 'TDID'
});
}

if (eids.length) {
payload.eids = eids;
}

if (tags[0].publisher_id) {
Expand Down Expand Up @@ -294,7 +306,7 @@ export const spec = {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: 'https://acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html'
url: 'https://acdn.adnxs.com/dmp/async_usersync.html'
}];
}
},
Expand Down
4 changes: 2 additions & 2 deletions modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const spec = {
if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
url: 'https://acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html'
url: 'https://acdn.adnxs.com/dmp/async_usersync.html'
});
}
if (syncOptions.pixelEnabled && serverResponses.length > 0) {
Expand All @@ -119,7 +119,7 @@ export const spec = {

// syncs.push({
// type: 'iframe',
// url: 'https://acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html'
// url: 'https://acdn.adnxs.com/dmp/async_usersync.html'
// });
syncs.push({
type: 'iframe',
Expand Down
2 changes: 1 addition & 1 deletion modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const GVLID = 24;
export const storage = getStorageManager(GVLID);

const BIDDER_CODE = 'conversant';
const URL = 'https://web.hb.ad.cpe.dotomi.com/s2s/header/24';
const URL = 'https://web.hb.ad.cpe.dotomi.com/cvx/client/hb/ortb/25';

export const spec = {
code: BIDDER_CODE,
Expand Down
23 changes: 13 additions & 10 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { verify } from 'criteo-direct-rsa-validate/build/verify.js';
import { getStorageManager } from '../src/storageManager.js';

const GVLID = 91;
export const ADAPTER_VERSION = 31;
export const ADAPTER_VERSION = 32;
const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = 'https://bidder.criteo.com/cdb';
const PROFILE_ID_INLINE = 207;
Expand Down Expand Up @@ -156,18 +156,24 @@ export const spec = {
* @param {TimedOutBid} timeoutData
*/
onTimeout: (timeoutData) => {
if (publisherTagAvailable()) {
// eslint-disable-next-line no-undef
const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(timeoutData.auctionId);
adapter.handleBidTimeout();
if (publisherTagAvailable() && Array.isArray(timeoutData)) {
var auctionsIds = [];
timeoutData.forEach((bid) => {
if (auctionsIds.indexOf(bid.auctionId) === -1) {
auctionsIds.push(bid.auctionId);
// eslint-disable-next-line no-undef
const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(bid.auctionId);
adapter.handleBidTimeout();
}
});
}
},

/**
* @param {Bid} bid
*/
onBidWon: (bid) => {
if (publisherTagAvailable()) {
if (publisherTagAvailable() && bid) {
// eslint-disable-next-line no-undef
const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(bid.auctionId);
adapter.handleBidWon(bid);
Expand Down Expand Up @@ -471,10 +477,7 @@ export function tryGetCriteoFastBid() {

if (verify(publisherTag, publisherTagHash, FAST_BID_PUBKEY_N, FAST_BID_PUBKEY_E)) {
utils.logInfo('Using Criteo FastBid');
const script = document.createElement('script');
script.type = 'text/javascript';
script.text = publisherTag;
utils.insertElement(script);
eval(publisherTag); // eslint-disable-line no-eval
} else {
utils.logWarn('Invalid Criteo FastBid found');
storage.removeDataFromLocalStorage(fastBidStorageKey);
Expand Down
12 changes: 7 additions & 5 deletions modules/eplanningBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const spec = {
params = {};
} else {
url = 'https://' + (urlConfig.sv || DEFAULT_SV) + '/hb/1/' + urlConfig.ci + '/' + dfpClientId + '/' + getDomain(pageUrl) + '/' + sec;
const referrerUrl = bidderRequest.refererInfo.referer.reachedTop ? encodeURIComponent(window.top.document.referrer) : encodeURIComponent(bidderRequest.refererInfo.referer);
const referrerUrl = bidderRequest.refererInfo.referer.reachedTop ? window.top.document.referrer : bidderRequest.refererInfo.referer;

if (storage.hasLocalStorage()) {
registerViewabilityAllBids(bidRequests);
Expand All @@ -53,7 +53,7 @@ export const spec = {
params = {
rnd: rnd,
e: spaces.str,
ur: encodeURIComponent(pageUrl || FILE),
ur: pageUrl || FILE,
r: 'pbjs',
pbv: '$prebid.version$',
ncb: '1',
Expand Down Expand Up @@ -317,11 +317,13 @@ function getViewabilityTracker() {
}

function isNotHiddenByNonFriendlyIframe() {
return (window === window.top) || window.frameElement;
try { return (window === window.top) || window.frameElement; } catch (e) {}
}

function defineContext(e) {
context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined);
try {
context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined);
} catch (err) {}
return context;
}

Expand Down Expand Up @@ -357,7 +359,7 @@ function getViewabilityTracker() {
}

function itIsNotHiddenByTabFocus() {
return getContext().top.document.hasFocus();
try { return getContext().top.document.hasFocus(); } catch (e) {}
}

function isDefined(e) {
Expand Down
Loading

0 comments on commit 4c2509e

Please sign in to comment.