Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pnhegde authored Aug 28, 2024
2 parents 70375a6 + 87e198f commit 6a107a8
Show file tree
Hide file tree
Showing 63 changed files with 8,099 additions and 8,013 deletions.
35 changes: 35 additions & 0 deletions libraries/paapiTools/buyerOrigins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
This list is several known buyer origins for PAAPI auctions.
Bidders should add anyone they like to it.
It is not intended to be comphensive nor maintained by the Core team.
Rather, Bid adapters should simply append additional constants whenever
the need arises in their adapter.
The goal is to reduce expression of common constants over many
bid adapters attempting to define interestGroupBuyers
in advance of network traffic.
Bidders should consider updating their interstGroupBuyer list
with server communication for auctions initiated after the first bid response.
Known buyers without current importers are commented out. If you need one, uncomment it.
*/

export const BO_CSR_ONET = 'https://csr.onet.pl';
// export const BO_DOUBLECLICK_GOOGLEADS = 'https://googleads.g.doubleclick.net';
// export const BO_DOUBLECLICK_TD = 'https://td.doubleclick.net';
// export const BO_RTBHOUSE = 'https://f.creativecdn.com';
// export const BO_CRITEO_US = 'https://fledge.us.criteo.com';
// export const BO_CRITEO_EU = 'https://fledge.eu.criteo.com';
// export const BO_CRITEO_AS = 'https://fledge.as.criteo.com';
// export const BO_CRITEO_GRID_MERCURY = 'https://grid-mercury.criteo.com';
// export const BO_CRITEO_BIDSWITCH_TRADR = 'https://tradr.bsw-sb.criteo.com';
// export const BO_CRITEO_BIDSWITCH_SANDBOX = 'https://dsp-paapi-sandbox.bsw-ig.criteo.com';
// export const BO_APPSPOT = 'https://fledge-buyer-testing-1.uc.r.appspot.com';
// export const BO_OPTABLE = 'https://ads.optable.co';
// export const BO_ADROLL = 'https://x.adroll.com';
// export const BO_ADFORM = 'https://a2.adform.net';
// export const BO_RETARGETLY = 'https://cookieless-campaign.prd-00.retargetly.com';
// export const BO_AUDIGENT = 'https://proton.ad.gt';
// export const BO_YAHOO = 'https://pa.ybp.yahoo.com';
// export const BO_DOTOMI = 'https://usadmm.dotomi.com';
3 changes: 3 additions & 0 deletions libraries/vidazooUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
const contentData = deepAccess(bidderRequest, 'ortb2.site.content.data', []);
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);

const contentLang = deepAccess(bidderRequest, 'ortb2.site.content.language') || document.documentElement.lang;

if (isFn(bid.getFloor)) {
const floorInfo = bid.getFloor({
currency: 'USD',
Expand Down Expand Up @@ -278,6 +280,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
gpid: gpid,
cat: cat,
contentData,
contentLang,
userData: userData,
pagecat: pagecat,
transactionId: ortb2Imp?.ext?.tid,
Expand Down
4 changes: 1 addition & 3 deletions modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ function isBidRequestValid(bid) {
}

function _validateBasic(bid) {
const invalidBidderName = bid.bidder !== BIDDER_CODE && !BIDDER_ALIASES.includes(bid.bidder);

if (invalidBidderName || !bid.params) {
if (!bid.params) {
return false;
}

Expand Down
22 changes: 16 additions & 6 deletions modules/connatixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
isFn,
logError,
isArray,
formatQS
formatQS,
deepSetValue
} from '../src/utils.js';

import {
Expand Down Expand Up @@ -61,6 +62,16 @@ export function validateVideo(mediaTypes) {
return video.context !== ADPOD;
}

/**
* Get ids from Prebid User ID Modules and add them to the payload
*/
function _handleEids(payload, validBidRequests) {
let bidUserIdAsEids = deepAccess(validBidRequests, '0.userIdAsEids');
if (isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
deepSetValue(payload, 'userIdList', bidUserIdAsEids);
}
}

export const spec = {
code: BIDDER_CODE,
gvlid: 143,
Expand All @@ -75,20 +86,17 @@ export const spec = {
const bidId = deepAccess(bid, 'bidId');
const mediaTypes = deepAccess(bid, 'mediaTypes', {});
const params = deepAccess(bid, 'params', {});
const bidder = deepAccess(bid, 'bidder');

const hasBidId = Boolean(bidId);
const isValidBidder = (bidder === BIDDER_CODE);
const hasMediaTypes = Boolean(mediaTypes) && (Boolean(mediaTypes[BANNER]) || Boolean(mediaTypes[VIDEO]));
const isValidBanner = validateBanner(mediaTypes);
const isValidVideo = validateVideo(mediaTypes);
const hasRequiredBidParams = Boolean(params.placementId);

const isValid = isValidBidder && hasBidId && hasMediaTypes && isValidBanner && isValidVideo && hasRequiredBidParams;
const isValid = hasBidId && hasMediaTypes && isValidBanner && isValidVideo && hasRequiredBidParams;
if (!isValid) {
logError(
`Invalid bid request:
isValidBidder: ${isValidBidder},
`Invalid bid request:
hasBidId: ${hasBidId},
hasMediaTypes: ${hasMediaTypes},
isValidBanner: ${isValidBanner},
Expand Down Expand Up @@ -130,6 +138,8 @@ export const spec = {
bidRequests,
};

_handleEids(requestPayload, validBidRequests);

return {
method: 'POST',
url: AD_URL,
Expand Down
161 changes: 80 additions & 81 deletions modules/connectadBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { deepSetValue, logWarn } from '../src/utils.js';
import { deepAccess, deepSetValue, mergeDeep, logWarn, generateUUID } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js'
import {config} from '../src/config.js';
import {tryAppendQueryString} from '../libraries/urlUtils/urlUtils.js';

const BIDDER_CODE = 'connectad';
const BIDDER_CODE_ALIAS = 'connectadrealtime';
const ENDPOINT_URL = 'https://i.connectad.io/api/v2';
Expand Down Expand Up @@ -30,25 +31,39 @@ export const spec = {
return ret;
}

const sellerDefinedAudience = deepAccess(bidderRequest, 'ortb2.user.data', config.getAnyConfig('ortb2.user.data'));
const sellerDefinedContext = deepAccess(bidderRequest, 'ortb2.site.content.data', config.getAnyConfig('ortb2.site.content.data'));

const data = Object.assign({
placements: [],
time: Date.now(),
user: {},
// TODO: does the fallback to window.location make sense?
url: bidderRequest.refererInfo?.page || window.location.href,
url: bidderRequest.refererInfo?.page,
referrer: bidderRequest.refererInfo?.ref,
// TODO: please do not send internal data structures over the network
referrer_info: bidderRequest.refererInfo?.legacy,
screensize: getScreenSize(),
dnt: (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0,
language: navigator.language,
ua: navigator.userAgent,
pversion: '$prebid.version$'
pversion: '$prebid.version$',
cur: 'USD',
user: {},
regs: {},
source: {},
site: {},
sda: sellerDefinedAudience,
sdc: sellerDefinedContext,
});

const ortb2Params = bidderRequest?.ortb2 || {};
['site', 'user', 'device', 'bcat', 'badv', 'regs'].forEach(entry => {
const ortb2Param = ortb2Params[entry];
if (ortb2Param) {
mergeDeep(data, { [entry]: ortb2Param });
}
});

// coppa compliance
if (config.getConfig('coppa') === true) {
deepSetValue(data, 'user.coppa', 1);
deepSetValue(data, 'regs.coppa', 1);
}

// adding schain object
Expand All @@ -71,24 +86,49 @@ export const spec = {
deepSetValue(data, 'user.ext.us_privacy', bidderRequest.uspConsent);
}

// GPP Support
if (bidderRequest?.gppConsent?.gppString) {
deepSetValue(data, 'regs.gpp', bidderRequest.gppConsent.gppString);
deepSetValue(data, 'regs.gpp_sid', bidderRequest.gppConsent.applicableSections);
} else if (bidderRequest?.ortb2?.regs?.gpp) {
deepSetValue(data, 'regs.gpp', bidderRequest.ortb2.regs.gpp);
deepSetValue(data, 'regs.gpp_sid', bidderRequest.ortb2.regs.gpp_sid);
}

// DSA Support
if (bidderRequest?.ortb2?.regs?.ext?.dsa) {
deepSetValue(data, 'regs.ext.dsa', bidderRequest.ortb2.regs.ext.dsa);
}

// EIDS Support
if (validBidRequests[0].userIdAsEids) {
deepSetValue(data, 'user.ext.eids', validBidRequests[0].userIdAsEids);
}

const tid = deepAccess(bidderRequest, 'ortb2.source.tid')
if (tid) {
deepSetValue(data, 'source.tid', tid)
}
data.tmax = bidderRequest.timeout;

validBidRequests.map(bid => {
const placement = Object.assign({
// TODO: fix transactionId leak: https://github.com/prebid/Prebid.js/issues/9781
id: bid.transactionId,
id: generateUUID(),
divName: bid.bidId,
tagId: bid.adUnitCode,
pisze: bid.mediaTypes.banner.sizes[0] || bid.sizes[0],
sizes: bid.mediaTypes.banner.sizes,
adTypes: getSize(bid.mediaTypes.banner.sizes || bid.sizes),
bidfloor: getBidFloor(bid),
siteId: bid.params.siteId,
networkId: bid.params.networkId
networkId: bid.params.networkId,
tid: bid.ortb2Imp?.ext?.tid
});

const gpid = deepAccess(bid, 'ortb2Imp.ext.gpid') || deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
if (gpid) {
placement.gpid = gpid;
}

if (placement.networkId && placement.siteId) {
data.placements.push(placement);
}
Expand Down Expand Up @@ -126,12 +166,22 @@ export const spec = {
bid.width = decision.width;
bid.height = decision.height;
bid.dealid = decision.dealid || null;
bid.meta = { advertiserDomains: decision && decision.adomain ? decision.adomain : [] };
bid.meta = {
advertiserDomains: decision && decision.adomain ? decision.adomain : []
};
bid.ad = retrieveAd(decision);
bid.currency = 'USD';
bid.creativeId = decision.adId;
bid.ttl = 360;
bid.netRevenue = true;

if (decision.dsa) {
bid.meta = Object.assign({}, bid.meta, { dsa: decision.dsa })
}
if (decision.category) {
bid.meta = Object.assign({}, bid.meta, { primaryCatId: decision.category })
}

bidResponses.push(bid);
}
}
Expand All @@ -140,8 +190,15 @@ export const spec = {
return bidResponses;
},

getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
let syncEndpoint = 'https://cdn.connectad.io/connectmyusers.php?';
getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent, gppConsent) => {
let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
let syncEndpoint;

if (pixelType == 'iframe') {
syncEndpoint = 'https://sync.connectad.io/iFrameSyncer?';
} else {
syncEndpoint = 'https://sync.connectad.io/ImageSyncer?';
}

if (gdprConsent) {
syncEndpoint = tryAppendQueryString(syncEndpoint, 'gdpr', (gdprConsent.gdprApplies ? 1 : 0));
Expand All @@ -155,73 +212,26 @@ export const spec = {
syncEndpoint = tryAppendQueryString(syncEndpoint, 'us_privacy', uspConsent);
}

if (gppConsent?.gppString && gppConsent?.applicableSections?.length) {
syncEndpoint = tryAppendQueryString(syncEndpoint, 'gpp', gppConsent.gppString);
syncEndpoint = tryAppendQueryString(syncEndpoint, 'gpp_sid', gppConsent?.applicableSections?.join(','));
}

if (config.getConfig('coppa') === true) {
syncEndpoint = tryAppendQueryString(syncEndpoint, 'coppa', 1);
}

if (syncOptions.iframeEnabled) {
if (syncOptions.iframeEnabled || syncOptions.pixelEnabled) {
return [{
type: 'iframe',
type: pixelType,
url: syncEndpoint
}];
} else {
logWarn('Bidder ConnectAd: Please activate iFrame Sync');
logWarn('Bidder ConnectAd: No User-Matching allowed');
}
}
};

const sizeMap = [
null,
'120x90',
'200x200',
'468x60',
'728x90',
'300x250',
'160x600',
'120x600',
'300x100',
'180x150',
'336x280',
'240x400',
'234x60',
'88x31',
'120x60',
'120x240',
'125x125',
'220x250',
'250x250',
'250x90',
'0x0',
'200x90',
'300x50',
'320x50',
'320x480',
'185x185',
'620x45',
'300x125',
'800x250',
'980x120',
'980x150',
'320x150',
'300x300',
'200x600',
'320x500',
'320x320'
];

sizeMap[77] = '970x90';
sizeMap[123] = '970x250';
sizeMap[43] = '300x600';
sizeMap[286] = '970x66';
sizeMap[3230] = '970x280';
sizeMap[429] = '486x60';
sizeMap[374] = '700x500';
sizeMap[934] = '300x1050';
sizeMap[1578] = '320x100';
sizeMap[331] = '320x250';
sizeMap[3301] = '320x267';
sizeMap[2730] = '728x250';

function getBidFloor(bidRequest) {
let floorInfo = {};

Expand All @@ -238,17 +248,6 @@ function getBidFloor(bidRequest) {
return floor;
}

function getSize(sizes) {
const result = [];
sizes.forEach(function(size) {
const index = sizeMap.indexOf(size[0] + 'x' + size[1]);
if (index >= 0) {
result.push(index);
}
});
return result;
}

function retrieveAd(decision) {
return decision.contents && decision.contents[0] && decision.contents[0].body;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/digitalMatterBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ENDPOINT = 'https://prebid.di-change.live';

export const spec = {
code: BIDDER_CODE,
aliases: ['digitalmatter'],
aliases: ['dichange', 'digitalmatter'],
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid,
buildRequests: (validBidRequests, bidderRequest) => buildRequests(validBidRequests, bidderRequest, ENDPOINT),
Expand Down
Loading

0 comments on commit 6a107a8

Please sign in to comment.