Skip to content

Commit

Permalink
Merge branch 'master' into prebid-8
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 8, 2023
2 parents 63aa185 + ca2f974 commit 22e5daf
Show file tree
Hide file tree
Showing 30 changed files with 1,211 additions and 102 deletions.
39 changes: 24 additions & 15 deletions modules/adgenerationBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const spec = {
buildRequests: function (validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
const ADGENE_PREBID_VERSION = '1.4.0';
const ADGENE_PREBID_VERSION = '1.5.0';
let serverRequests = [];
for (let i = 0, len = validBidRequests.length; i < len; i++) {
const validReq = validBidRequests[i];
Expand Down Expand Up @@ -59,7 +59,6 @@ export const spec = {
data = tryAppendQueryString(data, 'imark', '1');
}

// TODO: is 'page' the right value here?
data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page);
if (isIos()) {
const hyperId = getHyperId(validReq);
Expand Down Expand Up @@ -210,35 +209,45 @@ function appendChildToBody(ad, data) {
return ad.replace(/<\/\s?body>/, `${data}</body>`);
}

/**
* create APVTag
* @return {string}
*/
function createAPVTag() {
const APVURL = 'https://cdn.apvdr.com/js/VideoAd.min.js';
let apvScript = document.createElement('script');
apvScript.type = 'text/javascript';
apvScript.id = 'apv';
apvScript.src = APVURL;
return apvScript.outerHTML;
return `<script type="text/javascript" id="apv" src="${APVURL}"></script>`
}

/**
* create ADGBrowserMTag
* @return {string}
*/
function createADGBrowserMTag() {
const ADGBrowserMURL = 'https://i.socdm.com/sdk/js/adg-browser-m.js';
return `<script type="text/javascript" src="${ADGBrowserMURL}"></script>`;
}

/**
* create APVTag & insertVast
* @param targetId
* @param vastXml
* @return {string}
*/
function insertVASTMethodForAPV(targetId, vastXml) {
let apvVideoAdParam = {
s: targetId
};
let script = document.createElement(`script`);
script.type = 'text/javascript';
script.innerHTML = `(function(){ new APV.VideoAd(${escapeUnsafeChars(JSON.stringify(apvVideoAdParam))}).load('${vastXml.replace(/\r?\n/g, '')}'); })();`;
return script.outerHTML;
return `<script type="text/javascript">(function(){ new APV.VideoAd(${escapeUnsafeChars(JSON.stringify(apvVideoAdParam))}).load('${vastXml.replace(/\r?\n/g, '')}'); })();</script>`
}

/**
* create ADGBrowserMTag & insertVast
* @param vastXml
* @param marginTop
* @return {string}
*/
function insertVASTMethodForADGBrowserM(vastXml, marginTop) {
const script = document.createElement(`script`);
script.type = 'text/javascript';
script.innerHTML = `window.ADGBrowserM.init({vastXml: '${vastXml.replace(/\r?\n/g, '')}', marginTop: '${marginTop}'});`;
return script.outerHTML;
return `<script type="text/javascript">window.ADGBrowserM.init({vastXml: '${vastXml.replace(/\r?\n/g, '')}', marginTop: '${marginTop}'});</script>`
}

/**
Expand Down
4 changes: 3 additions & 1 deletion modules/aidemBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function getPageUrl(bidderRequest) {
function buildWinNotice(bid) {
const params = bid.params[0];
const app = deepAccess(bid, 'meta.ext.app')
const winNoticeExt = deepAccess(bid, 'meta.ext.win_notice_ext')
return {
publisherId: params.publisherId,
siteId: params.siteId,
Expand All @@ -170,7 +171,8 @@ function buildWinNotice(bid) {
responseTimestamp: bid.responseTimestamp,
mediatype: bid.mediaType,
environment: app ? 'app' : 'web',
...app
...app,
ext: winNoticeExt,
};
}

Expand Down
17 changes: 9 additions & 8 deletions modules/mgidBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,40 +380,41 @@ export const spec = {

const syncs = [];
const query = [];
query.push('cbuster=' + Math.round(new Date().getTime()));
query.push('consentData=' + encodeURIComponent(isPlainObject(gdprConsent) && isStr(gdprConsent?.consentString) ? gdprConsent.consentString : ''));
query.push('cbuster={cbuster}');
query.push('gdpr_consent=' + encodeURIComponent(isPlainObject(gdprConsent) && isStr(gdprConsent?.consentString) ? gdprConsent.consentString : ''));
if (isPlainObject(gdprConsent) && typeof gdprConsent?.gdprApplies === 'boolean' && gdprConsent.gdprApplies) {
query.push('gdprApplies=1');
query.push('gdpr=1');
} else {
query.push('gdprApplies=0');
query.push('gdpr=0');
}
if (isPlainObject(uspConsent) && uspConsent?.consentString) {
query.push(`uspString=${encodeURIComponent(uspConsent?.consentString)}`);
query.push(`us_privacy=${encodeURIComponent(uspConsent?.consentString)}`);
}
if (isPlainObject(gppConsent) && gppConsent?.gppString) {
query.push(`gppString=${encodeURIComponent(gppConsent?.gppString)}`);
}
if (config.getConfig('coppa')) {
query.push('coppa=1')
}
const q = query.join('&')
if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
url: 'https://cm.mgid.com/i.html?' + query.join('&')
url: 'https://cm.mgid.com/i.html?' + q.replace('{cbuster}', Math.round(new Date().getTime()))
});
} else if (syncOptions.pixelEnabled) {
if (pixels.length === 0) {
for (let i = 0; i < spb; i++) {
syncs.push({
type: 'image',
url: 'https://cm.mgid.com/i.gif?' + query.join('&') // randomly selects partner if sync required
url: 'https://cm.mgid.com/i.gif?' + q.replace('{cbuster}', Math.round(new Date().getTime())) // randomly selects partner if sync required
});
}
} else {
for (let i = 0; i < spb && i < pixels.length; i++) {
syncs.push({
type: 'image',
url: pixels[i] + (pixels[i].indexOf('?') > 0 ? '&' : '?') + query.join('&')
url: pixels[i] + (pixels[i].indexOf('?') > 0 ? '&' : '?') + q.replace('{cbuster}', Math.round(new Date().getTime()))
});
}
}
Expand Down
6 changes: 6 additions & 0 deletions modules/minutemediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ function generateBidParameters(bid, bidderRequest) {
loop: getBidIdParameter('bidderRequestsCount', bid),
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
transactionId: getBidIdParameter('transactionId', bid),
coppa: 0
};

const pos = deepAccess(bid, `mediaTypes.${mediaType}.pos`);
Expand Down Expand Up @@ -346,6 +347,11 @@ function generateBidParameters(bid, bidderRequest) {
if (linearity) {
bidObject.linearity = linearity;
}

const coppa = deepAccess(bid, `ortb2.regs.coppa`);
if (coppa) {
bidObject.coppa = 1;
}
}

return bidObject;
Expand Down
4 changes: 1 addition & 3 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,7 @@ function queueSync(bidderCodes, gdprConsent, uspConsent, gppConsent, s2sConfig)
}

if (gppConsent) {
// proposing the following formatting, can adjust if needed...
// update - leaving this param as an array, since it's part of a POST payload where the [] characters shouldn't matter too much
payload.gpp_sid = gppConsent.applicableSections
payload.gpp_sid = gppConsent.applicableSections.join();
// should we add check if applicableSections was not equal to -1 (where user was out of scope)?
// this would be similar to what was done above for TCF
payload.gpp = gppConsent.gppString;
Expand Down
6 changes: 5 additions & 1 deletion modules/prebidServerBidAdapter/ortbConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ const PBS_CONVERTER = ortbConverter({
deepSetValue(ortbRequest, 'ext.prebid', mergeDeep(ortbRequest.ext?.prebid || {}, context.s2sBidRequest.s2sConfig.extPrebid));
}

const fpdConfigs = Object.entries(context.s2sBidRequest.ortb2Fragments?.bidder || {}).map(([bidder, ortb2]) => ({
const fpdConfigs = Object.entries(context.s2sBidRequest.ortb2Fragments?.bidder || {}).filter(([bidder]) => {
const bidders = context.s2sBidRequest.s2sConfig.bidders;
const allowUnknownBidderCodes = context.s2sBidRequest.s2sConfig.allowUnknownBidderCodes;
return allowUnknownBidderCodes || (bidders && bidders.includes(bidder));
}).map(([bidder, ortb2]) => ({
bidders: [bidder],
config: {ortb2}
}));
Expand Down
5 changes: 3 additions & 2 deletions modules/pubmaticAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _each, pick, logWarn, isStr, isArray, logError } from '../src/utils.js';
import { _each, pick, logWarn, isStr, isArray, logError, getGptSlotInfoForAdUnitCode } from '../src/utils.js';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
Expand Down Expand Up @@ -353,9 +353,10 @@ function executeBidsLoggerCall(e, highestCpmBids) {
outputObj.s = Object.keys(auctionCache.adUnitCodes).reduce(function(slotsArray, adUnitId) {
let adUnit = auctionCache.adUnitCodes[adUnitId];
let origAdUnit = getAdUnit(auctionCache.origAdUnits, adUnitId) || {};
// getGptSlotInfoForAdUnitCode returns gptslot corresponding to adunit provided as input.
let slotObject = {
'sn': adUnitId,
'au': origAdUnit.adUnitId || adUnitId,
'au': origAdUnit.adUnitId || getGptSlotInfoForAdUnitCode(adUnitId)?.gptSlot || adUnitId,
'mt': getAdUnitAdFormats(origAdUnit),
'sz': getSizesForAdUnit(adUnit, adUnitId),
'ps': gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestCpmBids.filter(bid => bid.adUnitCode === adUnitId)),
Expand Down
32 changes: 32 additions & 0 deletions modules/retailspotBidAdapter .md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Overview

Module Name: RetailSpot Bidder Adapter
Module Type: Bidder Adapter
Maintainer: guillaume@retail-spot.io

# Description

Module that connects to RetailSpot demand sources.
Banner and Video ad formats are supported.

# Test Parameters
```
var adUnits = {
"code": "test-div",
"mediaTypes": {
"banner": {
"sizes": ["300x250"]
},
"video": {
context: "instream",
playerSize: [[640, 480]]
}
},
bids: [{
bidder: "retailspot",
params: {
placement: "test-12345"
}
}]
};
```
Loading

0 comments on commit 22e5daf

Please sign in to comment.