Skip to content

Commit

Permalink
sync with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Fawke committed Dec 4, 2019
2 parents f561c71 + 32aef56 commit dc586d1
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 63 deletions.
43 changes: 27 additions & 16 deletions modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import includes from 'core-js/library/fn/array/includes'
* updated to pass aditional auction and impression level parameters. added pass for video targeting parameters
* updated to fix native support for image width/height and icon 2019.03.17
* updated support for userid - pubcid,ttid 2019.05.28
* updated to support prebid 3.0 -remove non https, move to banner.xx.sizes, remove utils.getTopWindowLocation,remove utils.getTopWindowUrl(),remove utils.getTopWindowReferrer()
*/

const BIDDER_CODE = 'adxcg'
Expand All @@ -20,7 +21,7 @@ const SOURCE = 'pbjs10'
const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration', 'startdelay', 'skippable', 'playback_method', 'frameworks']
const USER_PARAMS_AUCTION = ['forcedDspIds', 'forcedCampaignIds', 'forcedCreativeIds', 'gender', 'dnt', 'language']
const USER_PARAMS_BID = ['lineparam1', 'lineparam2', 'lineparam3']
const BIDADAPTERVERSION = 'r20180703PB10'
const BIDADAPTERVERSION = 'r20191128PB30'

export const spec = {
code: BIDDER_CODE,
Expand Down Expand Up @@ -71,8 +72,6 @@ export const spec = {
buildRequests: function (validBidRequests, bidderRequest) {
utils.logMessage(`buildRequests: ${JSON.stringify(validBidRequests)}`)

let location = utils.getTopWindowLocation()
let secure = location.protocol === 'https:'
let dt = new Date()
let ratio = window.devicePixelRatio || 1
let iobavailable = window && window.IntersectionObserver && window.IntersectionObserverEntry && window.IntersectionObserverEntry.prototype && 'intersectionRatio' in window.IntersectionObserverEntry.prototype
Expand All @@ -82,16 +81,11 @@ export const spec = {
bt = Math.min(window.PREBID_TIMEOUT, bt)
}

let requestUrl = url.parse(location.href)
requestUrl.search = null
requestUrl.hash = null

// add common parameters
let beaconParams = {
renderformat: 'javascript',
ver: BIDADAPTERVERSION,
url: encodeURIComponent(utils.getTopWindowUrl()),
secure: secure ? '1' : '0',
secure: '1',
source: SOURCE,
uw: window.screen.width,
uh: window.screen.height,
Expand All @@ -106,9 +100,10 @@ export const spec = {
rndid: Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000
}

if (utils.getTopWindowReferrer()) {
beaconParams.ref = encodeURIComponent(utils.getTopWindowReferrer())
}
const referrer = utils.deepAccess(bidderRequest, 'refererInfo.referer');
const page = utils.deepAccess(bidderRequest, 'refererInfo.canonicalUrl') || config.getConfig('pageUrl') || utils.deepAccess(window, 'location.href');
beaconParams.ref = encodeURIComponent(referrer);
beaconParams.url = encodeURIComponent(page);

if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) {
beaconParams.gdpr = bidderRequest.gdprConsent.gdprApplies ? '1' : '0'
Expand All @@ -131,7 +126,10 @@ export const spec = {
validBidRequests.forEach((bid, index) => {
adZoneIds.push(utils.getBidIdParameter('adzoneid', bid.params))
prebidBidIds.push(bid.bidId)
sizes.push(utils.parseSizesInput(bid.sizes).join('|'))

if (isBannerRequest(bid)) {
sizes.push(utils.parseSizesInput(bid.mediaTypes.banner.sizes).join('|'))
}

let bidfloor = utils.getBidIdParameter('bidfloor', bid.params) || 0
bidfloors.push(bidfloor)
Expand All @@ -144,6 +142,7 @@ export const spec = {
}
// copy video context params
beaconParams['video.context' + '.' + index] = utils.deepAccess(bid, 'mediaTypes.video.context')
sizes.push(utils.parseSizesInput(bid.mediaTypes.video.playerSize).join('|'))
}

// copy all custom parameters impression level parameters not supported above
Expand All @@ -168,9 +167,17 @@ export const spec = {
beaconParams.tdid = validBidRequests[0].userId.tdid;
}

if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.id5id'))) {
beaconParams.id5id = validBidRequests[0].userId.id5id;
}

if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.idl_env'))) {
beaconParams.idl_env = validBidRequests[0].userId.idl_env;
}

let adxcgRequestUrl = url.format({
protocol: secure ? 'https' : 'http',
hostname: secure ? 'hbps.adxcg.net' : 'hbp.adxcg.net',
protocol: 'https',
hostname: 'hbps.adxcg.net',
pathname: '/get/adi',
search: beaconParams
})
Expand Down Expand Up @@ -272,7 +279,7 @@ export const spec = {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: '//cdn.adxcg.net/pb-sync.html'
url: 'https://cdn.adxcg.net/pb-sync.html'
}]
}
}
Expand All @@ -282,4 +289,8 @@ function isVideoRequest (bid) {
return bid.mediaType === 'video' || !!utils.deepAccess(bid, 'mediaTypes.video')
}

function isBannerRequest (bid) {
return bid.mediaType === 'banner' || !!utils.deepAccess(bid, 'mediaTypes.banner')
}

registerBidder(spec)
111 changes: 95 additions & 16 deletions modules/invibesBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const CONSTANTS = {
SYNC_ENDPOINT: 'https://k.r66net.com/GetUserSync',
TIME_TO_LIVE: 300,
DEFAULT_CURRENCY: 'EUR',
PREBID_VERSION: 1,
PREBID_VERSION: 2,
METHOD: 'GET',
INVIBES_VENDOR_ID: 436
};
Expand Down Expand Up @@ -114,7 +114,9 @@ function buildRequest(bidRequests, bidderRequest) {
height: topWin.innerHeight,

noc: !cookieDomain,
oi: invibes.optIn
oi: invibes.optIn,

kw: keywords
};

if (invibes.dom.id) {
Expand Down Expand Up @@ -190,7 +192,7 @@ function handleResponse(responseObj, bidRequests) {
for (let i = 0; i < bidRequests.length; i++) {
let bidRequest = bidRequests[i];

if (bidModel.PlacementId === bidRequest.params.placementId) {
if (bidModel.PlacementId == bidRequest.params.placementId) {
let size = getBiggerSize(bidRequest.sizes);

bidResponses.push({
Expand Down Expand Up @@ -444,7 +446,7 @@ let initDomainId = function (options) {

let persistence = options.persistence || cookiePersistence;
let state;
let minHC = 7;
let minHC = 2;

let validGradTime = function (state) {
if (!state.cr) { return false; }
Expand All @@ -468,23 +470,31 @@ let initDomainId = function (options) {
state.id = invibes.Uid.generate();
}

let graduate;

let setId = function () {
invibes.dom = {
id: (!state.cr && invibes.optIn > 0) ? state.id : undefined,
tempId: (invibes.optIn > 0) ? state.id : undefined,
graduate: graduate
};
};

graduate = function () {
let graduate = function () {
if (!state.cr) { return; }
delete state.cr;
delete state.hc;
persistence.save(state);
setId();
}
};

let regenerateId = function () {
state.id = invibes.Uid.generate();
persistence.save(state);
};

let setId = function () {
invibes.dom = {
get id() {
return (!state.cr && invibes.optIn > 0) ? state.id : undefined;
},
get tempId() {
return (invibes.optIn > 0) ? state.id : undefined;
},
graduate: graduate,
regen: regenerateId
};
};

if (state.cr && !options.noVisit) {
if (state.hc < minHC) {
Expand All @@ -498,6 +508,75 @@ let initDomainId = function (options) {
setId();
ivLogger.info('Did=' + invibes.dom.id);
};

let keywords = (function () {
const cap = 300;
let headTag = document.getElementsByTagName('head')[0];
let metaTag = headTag ? headTag.getElementsByTagName('meta') : [];

function parse(str, cap) {
let parsedStr = str.replace(/[<>~|\\"`!@#$%^&*()=+?]/g, '');

function onlyUnique(value, index, self) {
return value !== '' && self.indexOf(value) === index;
}

let words = parsedStr.split(/[\s,;.:]+/);
let uniqueWords = words.filter(onlyUnique);
parsedStr = '';

for (let i = 0; i < uniqueWords.length; i++) {
parsedStr += uniqueWords[i];
if (parsedStr.length >= cap) {
return parsedStr;
}
if (i < uniqueWords.length - 1) {
parsedStr += ',';
}
}

return parsedStr;
}

function gt(cap, prefix) {
cap = cap || 300;
prefix = prefix || '';
let title = document.title || headTag
? headTag.getElementsByTagName('title')[0]
? headTag.getElementsByTagName('title')[0].innerHTML
: ''
: '';

return parse(prefix + ',' + title, cap);
}

function gmeta(metaName, cap, prefix) {
metaName = metaName || 'keywords';
cap = cap || 100;
prefix = prefix || '';
let fallbackKw = prefix;

for (let i = 0; i < metaTag.length; i++) {
if (metaTag[i].name && metaTag[i].name.toLowerCase() === metaName.toLowerCase()) {
let kw = prefix + ',' + metaTag[i].content || '';
return parse(kw, cap);
} else if (metaTag[i].name && metaTag[i].name.toLowerCase().indexOf(metaName.toLowerCase()) > -1) {
fallbackKw = prefix + ',' + metaTag[i].content || '';
}
}

return parse(fallbackKw, cap);
}

let kw = gmeta('keywords', cap);
if (!kw || kw.length < cap - 8) {
kw = gmeta('description', cap, kw);
if (!kw || kw.length < cap - 8) {
kw = gt(cap, kw);
}
}
return kw;
}());
// =====================

export function resetInvibes() {
Expand Down
23 changes: 15 additions & 8 deletions modules/lockerdomeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ export const spec = {
return !!bid.params.adUnitId;
},
buildRequests: function(bidRequests, bidderRequest) {
let schain;

const adUnitBidRequests = bidRequests.map(function (bid) {
if (bid.schain) schain = schain || bid.schain;
return {
requestId: bid.bidId,
adUnitCode: bid.adUnitCode,
adUnitId: utils.getBidIdParameter('adUnitId', bid.params),
sizes: bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes
}
};
});

const bidderRequestCanonicalUrl = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.canonicalUrl) || '';
Expand All @@ -25,12 +28,16 @@ export const spec = {
url: encodeURIComponent(bidderRequestCanonicalUrl),
referrer: encodeURIComponent(bidderRequestReferer)
};

if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr = {
applies: bidderRequest.gdprConsent.gdprApplies,
consent: bidderRequest.gdprConsent.consentString
};
if (schain) {
payload.schain = schain;
}
if (bidderRequest) {
if (bidderRequest.gdprConsent) {
payload.gdpr = {
applies: bidderRequest.gdprConsent.gdprApplies,
consent: bidderRequest.gdprConsent.consentString
};
}
}

const payloadString = JSON.stringify(payload);
Expand Down Expand Up @@ -58,5 +65,5 @@ export const spec = {
};
});
},
}
};
registerBidder(spec);
6 changes: 3 additions & 3 deletions modules/outconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export const spec = {
switch (validBidRequests[i].params.env) {
case 'test':
par = par + '&demo=true';
url = 'http://test.outcondigital.com:8048/ad/' + par;
url = 'https://test.outcondigital.com/ad/' + par;
break;
case 'api':
url = 'http://api.outcondigital.com:8048/ad/' + par;
url = 'https://api.outcondigital.com/ad/' + par;
break;
case 'stg':
url = 'http://stg.outcondigital.com:8048/ad/' + par;
url = 'https://stg.outcondigital.com/ad/' + par;
break;
}
return {
Expand Down
2 changes: 2 additions & 0 deletions src/adapterManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
s2sAjax
);
}
} else {
utils.logError('missing ' + _s2sConfig.adapter);
}
}

Expand Down
Loading

0 comments on commit dc586d1

Please sign in to comment.