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

init new pull request with GothamAds prebid adapter #6180

Merged
merged 18 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
<script src="../../build/dev/prebid.js" async></script>

<script>
function getHashedEmail() {}
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
Expand Down Expand Up @@ -157,7 +158,7 @@
}
}]
}],
eidsFunction: getHashedEmail // any user defined function that exists in the page
eidsFunction: getHashedEmail // any user defined function that exists in the page
}
},{
name: "unifiedId",
Expand Down
2 changes: 1 addition & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const NATIVE_INDEX = NATIVE_MODEL.reduce((acc, val, idx) => {
export const spec = {

code: 'adkernel',
aliases: ['headbidding', 'adsolut', 'oftmediahb', 'audiencemedia', 'waardex_ak', 'roqoon', 'andbeyond', 'adbite', 'houseofpubs'],
aliases: ['headbidding', 'adsolut', 'oftmediahb', 'audiencemedia', 'waardex_ak', 'roqoon', 'andbeyond', 'adbite', 'houseofpubs', 'torchad'],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

/**
Expand Down
1 change: 1 addition & 0 deletions modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const spec = {
buildRequests: function (validRequest, bidderRequest) {
const payload = {
imps: [],
fpd: config.getConfig('fpd')
};
let endpointUrl;
if (bidderRequest) {
Expand Down
16 changes: 13 additions & 3 deletions modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const HOST_GETTERS = {
appaloosa: function () {
return 'ghb.hb.appaloosa.media';
},
onefiftytwomedia: function() {
onefiftytwomedia: function () {
return 'ghb.ads.152media.com';
},
mediafuse: function() {
mediafuse: function () {
return 'ghb.hbmp.mediafuse.com';
}

Expand All @@ -40,7 +40,12 @@ const syncsCache = {};
export const spec = {
code: BIDDER_CODE,
gvlid: 410,
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa', 'mediafuse'],
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa',
{
code: 'mediafuse',
skipPbsAliasing: true
}
],
supportedMediaTypes: [VIDEO, BANNER],
isBidRequestValid: function (bid) {
return !!utils.deepAccess(bid, 'params.aid');
Expand Down Expand Up @@ -203,6 +208,11 @@ function prepareBidRequests(bidReq) {
'AdType': mediaType,
'Sizes': utils.parseSizesInput(sizes).join(',')
};

bidReqParams.PlacementId = bidReq.adUnitCode;
if (bidReq.params.vpb_placement_id) {
bidReqParams.PlacementId = bidReq.params.vpb_placement_id;
}
if (mediaType === VIDEO) {
const context = utils.deepAccess(bidReq, 'mediaTypes.video.context');
if (context === ADPOD) {
Expand Down
3 changes: 2 additions & 1 deletion modules/adxpremiumAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import adapter from '../src/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
import * as utils from '../src/utils.js';
import includes from 'core-js-pure/features/array/includes.js';

const analyticsType = 'endpoint';
const defaultUrl = 'https://adxpremium.services/graphql';
Expand Down Expand Up @@ -211,7 +212,7 @@ function deviceType() {
}

function clearSlot(elementId) {
if (elementIds.includes(elementId)) { elementIds.splice(elementIds.indexOf(elementId), 1); utils.logInfo('AdxPremium Analytics - Done with: ' + elementId); }
if (includes(elementIds, elementId)) { elementIds.splice(elementIds.indexOf(elementId), 1); utils.logInfo('AdxPremium Analytics - Done with: ' + elementId); }
if (elementIds.length == 0 && !requestSent && !timeoutBased) {
requestSent = true;
sendEvent(completeObject);
Expand Down
3 changes: 2 additions & 1 deletion modules/cleanmedianetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {Renderer} from '../src/Renderer.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import includes from 'core-js-pure/features/array/includes.js';

export const helper = {
getTopWindowDomain: function (url) {
Expand Down Expand Up @@ -119,7 +120,7 @@ export const spec = {

const hasFavoredMediaType =
params.favoredMediaType &&
this.supportedMediaTypes.includes(params.favoredMediaType);
includes(this.supportedMediaTypes, params.favoredMediaType);

if (!mediaTypes || mediaTypes.banner) {
if (!hasFavoredMediaType || params.favoredMediaType === BANNER) {
Expand Down
90 changes: 58 additions & 32 deletions modules/consentManagementUsp.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@ function lookupStaticConsentData(cmpSuccess, cmpError, hookConfig) {
* @param {object} hookConfig contains module related variables (see comment in requestBidsHook function)
*/
function lookupUspConsent(uspSuccess, uspError, hookConfig) {
function findUsp() {
let f = window;
let uspapiFrame;
let uspapiFunction;

while (!uspapiFrame) {
try {
if (typeof f.__uspapi === 'function') {
uspapiFunction = f.__uspapi;
uspapiFrame = f;
break;
}
} catch (e) {}

try {
if (f.frames['__uspapiLocator']) {
uspapiFrame = f;
break;
}
} catch (e) {}
if (f === window.top) break;
f = f.parent;
}
return {
uspapiFrame,
uspapiFunction,
};
}

function handleUspApiResponseCallbacks() {
const uspResponse = {};

Expand All @@ -61,41 +90,43 @@ function lookupUspConsent(uspSuccess, uspError, hookConfig) {
uspResponse.usPrivacy = consentResponse.uspString;
}
afterEach();
}
},
};
}

let callbackHandler = handleUspApiResponseCallbacks();
let uspapiCallbacks = {};

let { uspapiFrame, uspapiFunction } = findUsp();

if (!uspapiFrame) {
return uspError('USP CMP not found.', hookConfig);
}

// to collect the consent information from the user, we perform a call to USPAPI
// to collect the user's consent choices represented as a string (via getUSPData)

// the following code also determines where the USPAPI is located and uses the proper workflow to communicate with it:
// - use the USPAPI locator code to see if USP's located in the current window or an ancestor window. This works in friendly or cross domain iframes
// - use the USPAPI locator code to see if USP's located in the current window or an ancestor window.
// - else assume prebid is in an iframe, and use the locator to see if the CMP is located in a higher parent window. This works in cross domain iframes.
// - if USPAPI is not found, the iframe function will call the uspError exit callback to abort the rest of the USPAPI workflow
// - try to call the __uspapi() function directly, otherwise use the postMessage() api
// find the CMP frame/window

try {
// try to call __uspapi directly
window.__uspapi('getUSPData', USPAPI_VERSION, callbackHandler.consentDataCallback);
} catch (e) {
// must not have been accessible, try using postMessage() api
let f = window;
let uspapiFrame;
while (!uspapiFrame) {
try {
if (f.frames['__uspapiLocator']) uspapiFrame = f;
} catch (e) { }
if (f === window.top) break;
f = f.parent;
}

if (!uspapiFrame) {
return uspError('USP CMP not found.', hookConfig);
}
callUspApiWhileInIframe('getUSPData', uspapiFrame, callbackHandler.consentDataCallback);
if (utils.isFn(uspapiFunction)) {
utils.logInfo('Detected USP CMP is directly accessible, calling it now...');
uspapiFunction(
'getUSPData',
USPAPI_VERSION,
callbackHandler.consentDataCallback
);
} else {
utils.logInfo(
'Detected USP CMP is outside the current iframe where Prebid.js is located, calling it now...'
);
callUspApiWhileInIframe(
'getUSPData',
uspapiFrame,
callbackHandler.consentDataCallback
);
}

function callUspApiWhileInIframe(commandName, uspapiFrame, moduleCallback) {
Expand All @@ -107,19 +138,19 @@ function lookupUspConsent(uspSuccess, uspError, hookConfig) {
__uspapiCall: {
command: cmd,
version: ver,
callId: callId
}
callId: callId,
},
};

uspapiCallbacks[callId] = callback;
uspapiFrame.postMessage(msg, '*');
}
};

/** when we get the return message, call the stashed callback */
window.addEventListener('message', readPostMessageResponse, false);

// call uspapi
window.__uspapi(commandName, USPAPI_VERSION, uspapiCallback);
window.__uspapi(commandName, USPAPI_VERSION, moduleCallback);

function readPostMessageResponse(event) {
const res = event && event.data && event.data.__uspapiReturn;
Expand All @@ -130,11 +161,6 @@ function lookupUspConsent(uspSuccess, uspError, hookConfig) {
}
}
}

function uspapiCallback(consentObject, success) {
window.removeEventListener('message', readPostMessageResponse, false);
moduleCallback(consentObject, success);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion modules/gamoshiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {Renderer} from '../src/Renderer.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import includes from 'core-js-pure/features/array/includes.js';

const ENDPOINTS = {
'gamoshi': 'https://rtb.gamoshi.io'
Expand Down Expand Up @@ -111,7 +112,7 @@ export const spec = {
};

const hasFavoredMediaType =
params.favoredMediaType && this.supportedMediaTypes.includes(params.favoredMediaType);
params.favoredMediaType && includes(this.supportedMediaTypes, params.favoredMediaType);

if (!mediaTypes || mediaTypes.banner) {
if (!hasFavoredMediaType || params.favoredMediaType === BANNER) {
Expand Down
2 changes: 2 additions & 0 deletions modules/gjirafaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const spec = {
adUnitId: adUnitId,
placementId: placementId,
bidid: bidRequest.bidId,
count: bidRequest.params.count,
skipTime: bidRequest.params.skipTime
};
});

Expand Down
Loading