diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9c00a2bf51a..6188d6c2182 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -48,7 +48,7 @@ When you are adding code to Prebid.js, or modifying code that isn't covered by a
- _Assert_: check that the expected results have occurred
- e.g., use Chai assertions to check that the expected output is equal to the actual output
- Test the public interface, not the internal implementation
-- If you need to check `adloader.loadScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadScript` call without affecting external resources
+- If you need to check `adloader.loadExternalScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadExternalScript` call without affecting external resources
- When writing tests you may use ES2015 syntax if desired
### Test Examples
diff --git a/integrationExamples/gpt/prebidServer_example.html b/integrationExamples/gpt/prebidServer_example.html
index db61a6a46d6..7761178efa8 100644
--- a/integrationExamples/gpt/prebidServer_example.html
+++ b/integrationExamples/gpt/prebidServer_example.html
@@ -36,7 +36,11 @@
pbjs.que.push(function() {
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
- sizes: [[300, 250]],
+ mediaTypes: {
+ banner: {
+ sizes: [[300, 250]]
+ }
+ },
bids: [
{
bidder: 'appnexus',
diff --git a/modules/.submodules.json b/modules/.submodules.json
index 0841f5e9777..3572dc2e303 100644
--- a/modules/.submodules.json
+++ b/modules/.submodules.json
@@ -1,5 +1,7 @@
{
"userId": [
+ "unifiedIdSystem",
+ "pubCommonIdSystem",
"digiTrustIdSystem",
"id5IdSystem",
"criteortusIdSystem",
diff --git a/modules/7xbidBidAdapter.js b/modules/7xbidBidAdapter.js
deleted file mode 100644
index 5464f87ee99..00000000000
--- a/modules/7xbidBidAdapter.js
+++ /dev/null
@@ -1,155 +0,0 @@
-import * as utils from '../src/utils';
-import { registerBidder } from '../src/adapters/bidderFactory';
-
-const BIDDER_CODE = '7xbid';
-const BIDDER_ALIAS = '7xb';
-const ENDPOINT_BANNER = '//bidder.7xbid.com/api/v1/prebid/banner';
-const ENDPOINT_NATIVE = '//bidder.7xbid.com/api/v1/prebid/native';
-const COOKIE_SYNC_URL = '//bidder.7xbid.com/api/v1/cookie/gen';
-const SUPPORTED_MEDIA_TYPES = ['banner', 'native'];
-const SUPPORTED_CURRENCIES = ['USD', 'JPY'];
-const DEFAULT_CURRENCY = 'JPY';
-const NET_REVENUE = true;
-
-const _encodeURIComponent = function(a) {
- let b = window.encodeURIComponent(a);
- b = b.replace(/'/g, '%27');
- return b;
-}
-
-export const _getUrlVars = function(url) {
- var hash;
- var myJson = {};
- var hashes = url.slice(url.indexOf('?') + 1).split('&');
- for (var i = 0; i < hashes.length; i++) {
- hash = hashes[i].split('=');
- myJson[hash[0]] = hash[1];
- }
- return myJson;
-}
-
-export const spec = {
- code: BIDDER_CODE,
- aliases: [BIDDER_ALIAS], // short code
- supportedMediaTypes: SUPPORTED_MEDIA_TYPES,
- isBidRequestValid: function(bid) {
- if (!(bid.params.placementId)) {
- return false;
- }
-
- if (bid.params.hasOwnProperty('currency') &&
- SUPPORTED_CURRENCIES.indexOf(bid.params.currency) === -1) {
- utils.logInfo('Invalid currency type, we support only JPY and USD!')
- return false;
- }
-
- return true;
- },
- /**
- * Make a server request from the list of BidRequests.
- *
- * @param {validBidRequests[]} - an array of bids
- * @return ServerRequest Info describing the request to the server.
- */
- buildRequests: function(validBidRequests, bidderRequest) {
- let serverRequests = [];
- var refererInfo;
- if (bidderRequest && bidderRequest.refererInfo) {
- refererInfo = bidderRequest.refererInfo;
- }
- validBidRequests.forEach((bid, i) => {
- let endpoint = ENDPOINT_BANNER
- let data = {
- 'placementid': bid.params.placementId,
- 'cur': bid.params.hasOwnProperty('currency') ? bid.params.currency : DEFAULT_CURRENCY,
- 'ua': navigator.userAgent,
- 'loc': utils.getTopWindowUrl(),
- 'topframe': (window.parent === window.self) ? 1 : 0,
- 'sw': screen && screen.width,
- 'sh': screen && screen.height,
- 'cb': Math.floor(Math.random() * 99999999999),
- 'tpaf': 1,
- 'cks': 1,
- 'requestid': bid.bidId
- };
-
- if (bid.hasOwnProperty('nativeParams')) {
- endpoint = ENDPOINT_NATIVE
- data.tkf = 1 // return url tracker
- data.ad_track = '1'
- data.apiv = '1.1.0'
- }
-
- if (refererInfo && refererInfo.referer) {
- data.referer = refererInfo.referer;
- } else {
- data.referer = '';
- }
-
- serverRequests.push({
- method: 'GET',
- url: endpoint,
- data: utils.parseQueryStringParameters(data)
- })
- })
-
- return serverRequests;
- },
- interpretResponse: function(serverResponse, request) {
- const data = _getUrlVars(request.data)
- const successBid = serverResponse.body || {};
- let bidResponses = [];
- if (successBid.hasOwnProperty(data.placementid)) {
- let bid = successBid[data.placementid]
- let bidResponse = {
- requestId: bid.requestid,
- cpm: bid.price,
- creativeId: bid.creativeId,
- currency: bid.cur,
- netRevenue: NET_REVENUE,
- ttl: 700
- };
-
- if (bid.hasOwnProperty('title')) { // it is native ad response
- bidResponse.mediaType = 'native'
- bidResponse.native = {
- title: bid.title,
- body: bid.description,
- cta: bid.cta,
- sponsoredBy: bid.advertiser,
- clickUrl: _encodeURIComponent(bid.landingURL),
- impressionTrackers: bid.trackings,
- }
- if (bid.screenshots) {
- bidResponse.native.image = {
- url: bid.screenshots.url,
- height: bid.screenshots.height,
- width: bid.screenshots.width,
- }
- }
- if (bid.icon) {
- bidResponse.native.icon = {
- url: bid.icon.url,
- height: bid.icon.height,
- width: bid.icon.width,
- }
- }
- } else {
- bidResponse.ad = bid.adm
- bidResponse.width = bid.width
- bidResponse.height = bid.height
- }
-
- bidResponses.push(bidResponse);
- }
-
- return bidResponses;
- },
- getUserSyncs: function(syncOptions, serverResponses) {
- return [{
- type: 'image',
- url: COOKIE_SYNC_URL
- }];
- }
-}
-registerBidder(spec);
diff --git a/modules/a4gBidAdapter.js b/modules/a4gBidAdapter.js
deleted file mode 100644
index d66630ce4db..00000000000
--- a/modules/a4gBidAdapter.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import {registerBidder} from '../src/adapters/bidderFactory';
-import * as utils from '../src/utils';
-
-const A4G_BIDDER_CODE = 'a4g';
-const A4G_CURRENCY = 'USD';
-const A4G_DEFAULT_BID_URL = '//ads.ad4game.com/v1/bid';
-const A4G_TTL = 120;
-
-const LOCATION_PARAM_NAME = 'siteurl';
-const ID_PARAM_NAME = 'id';
-const IFRAME_PARAM_NAME = 'if';
-const ZONE_ID_PARAM_NAME = 'zoneId';
-const SIZE_PARAM_NAME = 'size';
-
-const ARRAY_PARAM_SEPARATOR = ';';
-const ARRAY_SIZE_SEPARATOR = ',';
-const SIZE_SEPARATOR = 'x';
-
-export const spec = {
- code: A4G_BIDDER_CODE,
- isBidRequestValid: function(bid) {
- return bid.params && !!bid.params.zoneId;
- },
-
- buildRequests: function(validBidRequests, bidderRequest) {
- let deliveryUrl = '';
- const idParams = [];
- const sizeParams = [];
- const zoneIds = [];
-
- utils._each(validBidRequests, function(bid) {
- if (!deliveryUrl && typeof bid.params.deliveryUrl === 'string') {
- deliveryUrl = bid.params.deliveryUrl;
- }
- idParams.push(bid.bidId);
- sizeParams.push(bid.sizes.map(size => size.join(SIZE_SEPARATOR)).join(ARRAY_SIZE_SEPARATOR));
- zoneIds.push(bid.params.zoneId);
- });
-
- if (!deliveryUrl) {
- deliveryUrl = A4G_DEFAULT_BID_URL;
- }
-
- let data = {
- [IFRAME_PARAM_NAME]: 0,
- [LOCATION_PARAM_NAME]: utils.getTopWindowUrl(),
- [SIZE_PARAM_NAME]: sizeParams.join(ARRAY_PARAM_SEPARATOR),
- [ID_PARAM_NAME]: idParams.join(ARRAY_PARAM_SEPARATOR),
- [ZONE_ID_PARAM_NAME]: zoneIds.join(ARRAY_PARAM_SEPARATOR)
- };
-
- if (bidderRequest && bidderRequest.gdprConsent) {
- data.gdpr = {
- applies: bidderRequest.gdprConsent.gdprApplies,
- consent: bidderRequest.gdprConsent.consentString
- };
- }
-
- return {
- method: 'GET',
- url: deliveryUrl,
- data: data
- };
- },
-
- interpretResponse: function(serverResponses, request) {
- const bidResponses = [];
- utils._each(serverResponses.body, function(response) {
- if (response.cpm > 0) {
- const bidResponse = {
- requestId: response.id,
- creativeId: response.id,
- adId: response.id,
- cpm: response.cpm,
- width: response.width,
- height: response.height,
- currency: A4G_CURRENCY,
- netRevenue: true,
- ttl: A4G_TTL,
- ad: response.ad
- };
- bidResponses.push(bidResponse);
- }
- });
- return bidResponses;
- }
-};
-
-registerBidder(spec);
diff --git a/modules/aardvarkBidAdapter.js b/modules/aardvarkBidAdapter.js
index 9caaaaa747c..c1bc281e037 100644
--- a/modules/aardvarkBidAdapter.js
+++ b/modules/aardvarkBidAdapter.js
@@ -103,7 +103,7 @@ export const spec = {
var req = requestsMap[auctionId];
requests.push({
method: 'GET',
- url: `//${req.endpoint}/${auctionId}/${req.shortCodes.join('_')}/aardvark`,
+ url: `https://${req.endpoint}/${auctionId}/${req.shortCodes.join('_')}/aardvark`,
data: req.payload,
bidderRequest
});
@@ -162,7 +162,7 @@ export const spec = {
getUserSyncs: function(syncOptions, serverResponses, gdprConsent) {
const syncs = [];
- var url = '//' + SYNC_ENDPOINT + '/cs';
+ var url = 'https://' + SYNC_ENDPOINT + '/cs';
var gdprApplies = false;
if (gdprConsent && (typeof gdprConsent.gdprApplies === 'boolean')) {
gdprApplies = gdprConsent.gdprApplies;
diff --git a/modules/adbutlerBidAdapter.js b/modules/adbutlerBidAdapter.js
deleted file mode 100644
index 88aa4f158b7..00000000000
--- a/modules/adbutlerBidAdapter.js
+++ /dev/null
@@ -1,131 +0,0 @@
-'use strict';
-
-import * as utils from '../src/utils';
-import {config} from '../src/config';
-import {registerBidder} from '../src/adapters/bidderFactory';
-
-const BIDDER_CODE = 'adbutler';
-
-export const spec = {
- code: BIDDER_CODE,
- pageID: Math.floor(Math.random() * 10e6),
- aliases: ['divreach'],
-
- isBidRequestValid: function (bid) {
- return !!(bid.params.accountID && bid.params.zoneID);
- },
-
- buildRequests: function (validBidRequests) {
- var i;
- var zoneID;
- var bidRequest;
- var accountID;
- var keyword;
- var domain;
- var requestURI;
- var serverRequests = [];
- var zoneCounters = {};
-
- for (i = 0; i < validBidRequests.length; i++) {
- bidRequest = validBidRequests[i];
- zoneID = utils.getBidIdParameter('zoneID', bidRequest.params);
- accountID = utils.getBidIdParameter('accountID', bidRequest.params);
- keyword = utils.getBidIdParameter('keyword', bidRequest.params);
- domain = utils.getBidIdParameter('domain', bidRequest.params);
-
- if (!(zoneID in zoneCounters)) {
- zoneCounters[zoneID] = 0;
- }
-
- if (typeof domain === 'undefined' || domain.length === 0) {
- domain = 'servedbyadbutler.com';
- }
-
- requestURI = location.protocol + '//' + domain + '/adserve/;type=hbr;';
- requestURI += 'ID=' + encodeURIComponent(accountID) + ';';
- requestURI += 'setID=' + encodeURIComponent(zoneID) + ';';
- requestURI += 'pid=' + encodeURIComponent(spec.pageID) + ';';
- requestURI += 'place=' + encodeURIComponent(zoneCounters[zoneID]) + ';';
-
- // append the keyword for targeting if one was passed in
- if (keyword !== '') {
- requestURI += 'kw=' + encodeURIComponent(keyword) + ';';
- }
-
- zoneCounters[zoneID]++;
- serverRequests.push({
- method: 'GET',
- url: requestURI,
- data: {},
- bidRequest: bidRequest
- });
- }
- return serverRequests;
- },
-
- interpretResponse: function (serverResponse, bidRequest) {
- var bidObj = bidRequest.bidRequest;
- var bidResponses = [];
- var bidResponse = {};
- var isCorrectSize = false;
- var isCorrectCPM = true;
- var CPM;
- var minCPM;
- var maxCPM;
- var width;
- var height;
-
- serverResponse = serverResponse.body;
- if (serverResponse && serverResponse.status === 'SUCCESS' && bidObj) {
- CPM = serverResponse.cpm;
- minCPM = utils.getBidIdParameter('minCPM', bidObj.params);
- maxCPM = utils.getBidIdParameter('maxCPM', bidObj.params);
- width = parseInt(serverResponse.width);
- height = parseInt(serverResponse.height);
-
- // Ensure response CPM is within the given bounds
- if (minCPM !== '' && CPM < parseFloat(minCPM)) {
- isCorrectCPM = false;
- }
- if (maxCPM !== '' && CPM > parseFloat(maxCPM)) {
- isCorrectCPM = false;
- }
-
- // Ensure that response ad matches one of the placement sizes.
- utils._each(bidObj.sizes, function (size) {
- if (width === size[0] && height === size[1]) {
- isCorrectSize = true;
- }
- });
- if (isCorrectCPM && isCorrectSize) {
- bidResponse.requestId = bidObj.bidId;
- bidResponse.bidderCode = bidObj.bidder;
- bidResponse.creativeId = serverResponse.placement_id;
- bidResponse.cpm = CPM;
- bidResponse.width = width;
- bidResponse.height = height;
- bidResponse.ad = serverResponse.ad_code;
- bidResponse.ad += spec.addTrackingPixels(serverResponse.tracking_pixels);
- bidResponse.currency = 'USD';
- bidResponse.netRevenue = true;
- bidResponse.ttl = config.getConfig('_bidderTimeout');
- bidResponse.referrer = utils.getTopWindowUrl();
- bidResponses.push(bidResponse);
- }
- }
- return bidResponses;
- },
-
- addTrackingPixels: function (trackingPixels) {
- var trackingPixelMarkup = '';
- utils._each(trackingPixels, function (pixelURL) {
- var trackingPixel = '';
-
- trackingPixelMarkup += trackingPixel;
- });
- return trackingPixelMarkup;
- }
-};
-registerBidder(spec);
diff --git a/modules/adformBidAdapter.js b/modules/adformBidAdapter.js
index d344908c638..7ffd79328b1 100644
--- a/modules/adformBidAdapter.js
+++ b/modules/adformBidAdapter.js
@@ -42,7 +42,7 @@ export const spec = {
request.push(formRequestUrl(reqParams));
}
- request.unshift('//' + globalParams[0][1] + '/adx/?rp=4');
+ request.unshift('https://' + globalParams[0][1] + '/adx/?rp=4');
netRevenue = netRevenue || 'gross';
request.push('pt=' + netRevenue);
request.push('stid=' + validBidRequests[0].auctionId);
diff --git a/modules/adformOpenRTBBidAdapter.js b/modules/adformOpenRTBBidAdapter.js
index 98e6de8036a..a936c39d625 100644
--- a/modules/adformOpenRTBBidAdapter.js
+++ b/modules/adformOpenRTBBidAdapter.js
@@ -129,7 +129,7 @@ export const spec = {
return {
method: 'POST',
- url: '//' + adxDomain + '/adx/openrtb',
+ url: 'https://' + adxDomain + '/adx/openrtb',
data: JSON.stringify(request),
options: {
contentType: 'application/json'
diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js
index 77b6acbf0e0..0a8466ce477 100644
--- a/modules/adgenerationBidAdapter.js
+++ b/modules/adgenerationBidAdapter.js
@@ -28,7 +28,7 @@ export const spec = {
let serverRequests = [];
for (let i = 0, len = validBidRequests.length; i < len; i++) {
const validReq = validBidRequests[i];
- const DEBUG_URL = 'http://api-test.scaleout.jp/adsv/v1';
+ const DEBUG_URL = 'https://api-test.scaleout.jp/adsv/v1';
const URL = 'https://d.socdm.com/adsv/v1';
const url = validReq.params.debug ? DEBUG_URL : URL;
let data = ``;
diff --git a/modules/adkernelAdnAnalyticsAdapter.js b/modules/adkernelAdnAnalyticsAdapter.js
deleted file mode 100644
index b72fc268ea3..00000000000
--- a/modules/adkernelAdnAnalyticsAdapter.js
+++ /dev/null
@@ -1,378 +0,0 @@
-import adapter from '../src/AnalyticsAdapter';
-import CONSTANTS from '../src/constants.json';
-import adapterManager from '../src/adapterManager';
-import {parse} from '../src/url';
-import * as utils from '../src/utils';
-import {ajax} from '../src/ajax';
-
-const ANALYTICS_VERSION = '1.0.0';
-const DEFAULT_QUEUE_TIMEOUT = 4000;
-const DEFAULT_HOST = 'tag.adkernel.com';
-
-const ADK_HB_EVENTS = {
- AUCTION_INIT: 'auctionInit',
- BID_REQUEST: 'bidRequested',
- BID_RESPONSE: 'bidResponse',
- BID_WON: 'bidWon',
- AUCTION_END: 'auctionEnd',
- TIMEOUT: 'adapterTimedOut'
-};
-
-function buildRequestTemplate(pubId) {
- const url = utils.getTopWindowUrl();
- const ref = utils.getTopWindowReferrer();
- const topLocation = utils.getTopWindowLocation();
-
- return {
- ver: ANALYTICS_VERSION,
- domain: topLocation.hostname,
- path: topLocation.pathname,
- accId: pubId,
- env: {
- screen: {
- w: window.screen.width,
- h: window.screen.height
- },
- lang: navigator.language
- },
- src: getUmtSource(url, ref)
- }
-}
-
-let analyticsAdapter = Object.assign(adapter({analyticsType: 'endpoint'}),
- {
- track({ eventType, args }) {
- if (!analyticsAdapter.context) {
- return;
- }
- let handler = null;
- switch (eventType) {
- case CONSTANTS.EVENTS.AUCTION_INIT:
- if (analyticsAdapter.context.queue) {
- analyticsAdapter.context.queue.init();
- }
- handler = trackAuctionInit;
- break;
- case CONSTANTS.EVENTS.BID_REQUESTED:
- handler = trackBidRequest;
- break;
- case CONSTANTS.EVENTS.BID_RESPONSE:
- handler = trackBidResponse;
- break;
- case CONSTANTS.EVENTS.BID_WON:
- handler = trackBidWon;
- break;
- case CONSTANTS.EVENTS.BID_TIMEOUT:
- handler = trackBidTimeout;
- break;
- case CONSTANTS.EVENTS.AUCTION_END:
- handler = trackAuctionEnd;
- break;
- }
- if (handler) {
- let events = handler(args);
- if (analyticsAdapter.context.queue) {
- analyticsAdapter.context.queue.push(events);
- }
- if (eventType === CONSTANTS.EVENTS.AUCTION_END) {
- sendAll();
- }
- }
- }
- });
-
-analyticsAdapter.context = {};
-
-analyticsAdapter.originEnableAnalytics = analyticsAdapter.enableAnalytics;
-
-analyticsAdapter.enableAnalytics = (config) => {
- if (!config.options.pubId) {
- utils.logError('PubId is not defined. Analytics won\'t work');
- return;
- }
- analyticsAdapter.context = {
- host: config.options.host || DEFAULT_HOST,
- pubId: config.options.pubId,
- requestTemplate: buildRequestTemplate(config.options.pubId),
- queue: new ExpiringQueue(sendAll, config.options.queueTimeout || DEFAULT_QUEUE_TIMEOUT)
- };
- analyticsAdapter.originEnableAnalytics(config);
-};
-
-adapterManager.registerAnalyticsAdapter({
- adapter: analyticsAdapter,
- code: 'adkernelAdn'
-});
-
-export default analyticsAdapter;
-
-function sendAll() {
- let events = analyticsAdapter.context.queue.popAll();
- if (events.length !== 0) {
- let req = Object.assign({}, analyticsAdapter.context.requestTemplate, {hb_ev: events});
- analyticsAdapter.ajaxCall(JSON.stringify(req));
- }
-}
-
-analyticsAdapter.ajaxCall = function ajaxCall(data) {
- ajax(`//${analyticsAdapter.context.host}/hb-analytics`, () => {
- }, data);
-};
-
-function trackAuctionInit() {
- analyticsAdapter.context.auctionTimeStart = Date.now();
- const event = createHbEvent(undefined, ADK_HB_EVENTS.AUCTION_INIT);
- return [event];
-}
-
-function trackBidRequest(args) {
- return args.bids.map(bid =>
- createHbEvent(args.bidderCode, ADK_HB_EVENTS.BID_REQUEST, bid.adUnitCode));
-}
-
-function trackBidResponse(args) {
- const event = createHbEvent(args.bidderCode, ADK_HB_EVENTS.BID_RESPONSE,
- args.adUnitCode, args.cpm, args.timeToRespond / 1000);
- return [event];
-}
-
-function trackBidWon(args) {
- const event = createHbEvent(args.bidderCode, ADK_HB_EVENTS.BID_WON, args.adUnitCode, args.cpm);
- return [event];
-}
-
-function trackAuctionEnd(args) {
- const event = createHbEvent(undefined, ADK_HB_EVENTS.AUCTION_END, undefined,
- undefined, (Date.now() - analyticsAdapter.context.auctionTimeStart) / 1000);
- return [event];
-}
-
-function trackBidTimeout(args) {
- return args.map(bidderName => createHbEvent(bidderName, ADK_HB_EVENTS.TIMEOUT));
-}
-
-function createHbEvent(adapter, event, tagid = undefined, value = 0, time = 0) {
- let ev = { event: event };
- if (adapter) {
- ev.adapter = adapter
- }
- if (tagid) {
- ev.tagid = tagid;
- }
- if (value) {
- ev.val = value;
- }
- if (time) {
- ev.time = time;
- }
- return ev;
-}
-
-const UTM_TAGS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',
- 'utm_c1', 'utm_c2', 'utm_c3', 'utm_c4', 'utm_c5'];
-const ADKERNEL_PREBID_KEY = 'adk_dpt_analytics';
-const DIRECT = '(direct)';
-const REFERRAL = '(referral)';
-const ORGANIC = '(organic)';
-
-export let storage = {
- getItem: (name) => {
- return localStorage.getItem(name);
- },
- setItem: (name, value) => {
- localStorage.setItem(name, value);
- }
-};
-
-export function getUmtSource(pageUrl, referrer) {
- let prevUtm = getPreviousTrafficSource();
- let currUtm = getCurrentTrafficSource(pageUrl, referrer);
- let [updated, actual] = chooseActualUtm(prevUtm, currUtm);
- if (updated) {
- storeUtm(actual);
- }
- return actual;
-
- function getPreviousTrafficSource() {
- let val = storage.getItem(ADKERNEL_PREBID_KEY);
- if (!val) {
- return getDirect();
- }
- return JSON.parse(val);
- }
-
- function getCurrentTrafficSource(pageUrl, referrer) {
- var source = getUTM(pageUrl);
- if (source) {
- return source;
- }
- if (referrer) {
- let se = getSearchEngine(referrer);
- if (se) {
- return asUtm(se, ORGANIC, ORGANIC);
- }
- let parsedUrl = parse(pageUrl);
- let [refHost, refPath] = getReferrer(referrer);
- if (refHost && refHost !== parsedUrl.hostname) {
- return asUtm(refHost, REFERRAL, REFERRAL, '', refPath);
- }
- }
- return getDirect();
- }
-
- function getSearchEngine(pageUrl) {
- let engines = {
- 'google': /^https?\:\/\/(?:www\.)?(?:google\.(?:com?\.)?(?:com|cat|[a-z]{2})|g.cn)\//i,
- 'yandex': /^https?\:\/\/(?:www\.)?ya(?:ndex\.(?:com|net)?\.?(?:asia|mobi|org|[a-z]{2})?|\.ru)\//i,
- 'bing': /^https?\:\/\/(?:www\.)?bing\.com\//i,
- 'duckduckgo': /^https?\:\/\/(?:www\.)?duckduckgo\.com\//i,
- 'ask': /^https?\:\/\/(?:www\.)?ask\.com\//i,
- 'yahoo': /^https?\:\/\/(?:[-a-z]+\.)?(?:search\.)?yahoo\.com\//i
- };
-
- for (let engine in engines) {
- if (engines.hasOwnProperty(engine) && engines[engine].test(pageUrl)) {
- return engine;
- }
- }
- }
-
- function getReferrer(referrer) {
- let ref = parse(referrer);
- return [ref.hostname, ref.pathname];
- }
-
- function getUTM(pageUrl) {
- let urlParameters = parse(pageUrl).search;
- if (!urlParameters['utm_campaign'] || !urlParameters['utm_source']) {
- return;
- }
- let utmArgs = [];
- utils._each(UTM_TAGS, (utmTagName) => {
- let utmValue = urlParameters[utmTagName] || '';
- utmArgs.push(utmValue);
- });
- return asUtm.apply(this, utmArgs);
- }
-
- function getDirect() {
- return asUtm(DIRECT, DIRECT, DIRECT);
- }
-
- function storeUtm(utm) {
- let val = JSON.stringify(utm);
- storage.setItem(ADKERNEL_PREBID_KEY, val);
- }
-
- function asUtm(source, medium, campaign, term = '', content = '', c1 = '', c2 = '', c3 = '', c4 = '', c5 = '') {
- let result = {
- source: source,
- medium: medium,
- campaign: campaign
- };
- if (term) {
- result.term = term;
- }
- if (content) {
- result.content = content;
- }
- if (c1) {
- result.c1 = c1;
- }
- if (c2) {
- result.c2 = c2;
- }
- if (c3) {
- result.c3 = c3;
- }
- if (c4) {
- result.c4 = c4;
- }
- if (c5) {
- result.c5 = c5;
- }
- return result;
- }
-
- function chooseActualUtm(prev, curr) {
- if (ord(prev) < ord(curr)) {
- return [true, curr];
- } if (ord(prev) > ord(curr)) {
- return [false, prev];
- } else {
- if (prev.campaign === REFERRAL && prev.content !== curr.content) {
- return [true, curr];
- } else if (prev.campaign === ORGANIC && prev.source !== curr.source) {
- return [true, curr];
- } else if (isCampaignTraffic(prev) && (prev.campaign !== curr.campaign || prev.source !== curr.source)) {
- return [true, curr];
- }
- }
- return [false, prev];
- }
-
- function ord(utm) {
- switch (utm.campaign) {
- case DIRECT:
- return 0;
- case ORGANIC:
- return 1;
- case REFERRAL:
- return 2;
- default:
- return 3;
- }
- }
-
- function isCampaignTraffic(utm) {
- return [DIRECT, REFERRAL, ORGANIC].indexOf(utm.campaign) === -1;
- }
-}
-
-/**
- * Expiring queue implementation. Fires callback on elapsed timeout since last last update or creation.
- * @param callback
- * @param ttl
- * @constructor
- */
-export function ExpiringQueue(callback, ttl) {
- let queue = [];
- let timeoutId;
-
- this.push = (event) => {
- if (event instanceof Array) {
- queue.push.apply(queue, event);
- } else {
- queue.push(event);
- }
- reset();
- };
-
- this.popAll = () => {
- let result = queue;
- queue = [];
- reset();
- return result;
- };
-
- /**
- * For test/debug purposes only
- * @return {Array}
- */
- this.peekAll = () => {
- return queue;
- };
-
- this.init = reset;
-
- function reset() {
- if (timeoutId) {
- clearTimeout(timeoutId);
- }
- timeoutId = setTimeout(() => {
- if (queue.length) {
- callback();
- }
- }, ttl);
- }
-}
diff --git a/modules/admanBidAdapter.js b/modules/admanBidAdapter.js
deleted file mode 100644
index 4720d06d094..00000000000
--- a/modules/admanBidAdapter.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import {registerBidder} from '../src/adapters/bidderFactory';
-import * as utils from '../src/utils';
-
-const BIDDER_CODE = 'adman';
-
-export const spec = {
- code: BIDDER_CODE,
- supportedMediaTypes: ['video', 'banner'],
- isBidRequestValid: function(bid) {
- const isValid = _validateId(utils.deepAccess(bid, 'params.id'));
- if (!isValid) {
- utils.logError('Adman id parameter is required. Bid aborted.');
- }
- return isValid;
- },
- buildRequests: function(validBidRequests, bidderRequest) {
- const ENDPOINT_URL = '//bidtor.admanmedia.com/prebid';
- const bids = validBidRequests.map(buildRequestObject);
- const payload = {
- referer: utils.getTopWindowUrl(),
- bids,
- deviceWidth: screen.width
- };
-
- if (bidderRequest && bidderRequest.gdprConsent) {
- payload.gdpr = {
- consent: bidderRequest.gdprConsent.consentString,
- applies: bidderRequest.gdprConsent.gdprApplies
- };
- } else {
- payload.gdpr = {
- consent: ''
- }
- }
-
- const payloadString = JSON.stringify(payload);
- return {
- method: 'POST',
- url: ENDPOINT_URL,
- data: payloadString,
- };
- },
- interpretResponse: function(serverResponse) {
- serverResponse = serverResponse.body;
- if (serverResponse && typeof serverResponse.bids === 'object') {
- return serverResponse.bids;
- }
- return [];
- },
- getUserSyncs: function(syncOptions) {
- if (syncOptions.iframeEnabled) {
- return [{
- type: 'iframe',
- url: '//cs.admanmedia.com/sync_tag/html'
- }];
- }
- }
-};
-
-function buildRequestObject(bid) {
- return {
- params: {
- id: utils.getValue(bid.params, 'id'),
- bidId: bid.bidId
- },
- sizes: bid.sizes,
- bidId: utils.getBidIdParameter('bidId', bid),
- bidderRequestId: utils.getBidIdParameter('bidderRequestId', bid),
- adUnitCode: utils.getBidIdParameter('adUnitCode', bid),
- auctionId: utils.getBidIdParameter('auctionId', bid),
- transactionId: utils.getBidIdParameter('transactionId', bid)
- };
-}
-
-function _validateId(id = '') {
- return (id.length === 8);
-}
-
-registerBidder(spec);
diff --git a/modules/admaticBidAdapter.js b/modules/admaticBidAdapter.js
index 727b1553d21..c0f32319d79 100644
--- a/modules/admaticBidAdapter.js
+++ b/modules/admaticBidAdapter.js
@@ -2,7 +2,7 @@ import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';
const BIDDER_CODE = 'admatic';
-const ENDPOINT_URL = '//ads4.admatic.com.tr/prebid/v3/bidrequest';
+const ENDPOINT_URL = 'https://ads4.admatic.com.tr/prebid/v3/bidrequest';
export const spec = {
code: BIDDER_CODE,
@@ -108,7 +108,7 @@ export const spec = {
if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
- url: '//ads4.admatic.com.tr/prebid/static/usersync/v3/async_usersync.html'
+ url: 'https://ads4.admatic.com.tr/prebid/static/usersync/v3/async_usersync.html'
});
}
diff --git a/modules/admediaBidAdapter.js b/modules/admediaBidAdapter.js
index 73d6ea08eea..d6d7044a371 100644
--- a/modules/admediaBidAdapter.js
+++ b/modules/admediaBidAdapter.js
@@ -2,7 +2,7 @@ import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';
const BIDDER_CODE = 'admedia';
-const ENDPOINT_URL = '//prebid.admedia.com/bidder/';
+const ENDPOINT_URL = 'https://prebid.admedia.com/bidder/';
export const spec = {
code: BIDDER_CODE,
diff --git a/modules/admixerBidAdapter.js b/modules/admixerBidAdapter.js
deleted file mode 100644
index c6d6dd34a11..00000000000
--- a/modules/admixerBidAdapter.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import * as utils from '../src/utils';
-import {registerBidder} from '../src/adapters/bidderFactory';
-
-const BIDDER_CODE = 'admixer';
-const ALIASES = ['go2net'];
-const ENDPOINT_URL = '//inv-nets.admixer.net/prebid.1.0.aspx';
-export const spec = {
- code: BIDDER_CODE,
- aliases: ALIASES,
- supportedMediaTypes: ['banner', 'video'],
- /**
- * Determines whether or not the given bid request is valid.
- *
- * @param {BidRequest} bid The bid params to validate.
- * @return boolean True if this is a valid bid, and false otherwise.
- */
- isBidRequestValid: function (bid) {
- return !!bid.params.zone;
- },
- /**
- * Make a server request from the list of BidRequests.
- *
- * @param {bidderRequest} - bidderRequest.bids[] is an array of AdUnits and bids
- * @return ServerRequest Info describing the request to the server.
- */
- buildRequests: function (bidderRequest) {
- const payload = {
- imps: [],
- referrer: encodeURIComponent(utils.getTopWindowUrl()),
- };
- bidderRequest.forEach((bid) => {
- payload.imps.push(bid);
- });
- const payloadString = JSON.stringify(payload);
- return {
- method: 'GET',
- url: ENDPOINT_URL,
- data: `data=${payloadString}`,
- };
- },
- /**
- * Unpack the response from the server into a list of bids.
- *
- * @param {*} serverResponse A successful response from the server.
- * @return {Bid[]} An array of bids which were nested inside the server.
- */
- interpretResponse: function (serverResponse, bidRequest) {
- const bidResponses = [];
- // loop through serverResponses {
- try {
- serverResponse = serverResponse.body;
- serverResponse.forEach((bidResponse) => {
- const bidResp = {
- requestId: bidResponse.bidId,
- cpm: bidResponse.cpm,
- width: bidResponse.width,
- height: bidResponse.height,
- ad: bidResponse.ad,
- ttl: bidResponse.ttl,
- creativeId: bidResponse.creativeId,
- netRevenue: bidResponse.netRevenue,
- currency: bidResponse.currency,
- vastUrl: bidResponse.vastUrl,
- };
- bidResponses.push(bidResp);
- });
- } catch (e) {
- utils.logError(e);
- }
- return bidResponses;
- }
-};
-registerBidder(spec);
diff --git a/modules/adspendBidAdapter.js b/modules/adspendBidAdapter.js
index 7818e3fc910..d96ae20f895 100644
--- a/modules/adspendBidAdapter.js
+++ b/modules/adspendBidAdapter.js
@@ -5,8 +5,8 @@ import { registerBidder } from '../src/adapters/bidderFactory';
import { BANNER } from '../src/mediaTypes';
const BIDDER_CODE = 'adspend';
-const BID_URL = '//rtb.com.ru/headerbidding-bid';
-const SYNC_URL = '//rtb.com.ru/headerbidding-sync?uid={UUID}';
+const BID_URL = 'https://rtb.com.ru/headerbidding-bid';
+const SYNC_URL = 'https://rtb.com.ru/headerbidding-sync?uid={UUID}';
const COOKIE_NAME = 'hb-adspend-id';
const UUID_LEN = 36;
const TTL = 10000;
diff --git a/modules/adspiritBidAdapter.js b/modules/adspiritBidAdapter.js
deleted file mode 100644
index a428a5c8829..00000000000
--- a/modules/adspiritBidAdapter.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import * as utils from '../src/utils';
-import {registerBidder} from '../src/adapters/bidderFactory';
-const RTB_URL = '/rtb/getbid.php?rtbprovider=prebid';
-const SCRIPT_URL = '/adasync.min.js';
-export const spec = {
- code: 'adspirit',
- aliases: ['xapadsmedia', 'connectad'],
- isBidRequestValid: function(bid) {
- let host = spec.getBidderHost(bid);
- if (!host) return false;
- if (!bid.params.placementId) return false;
- return true;
- },
- buildRequests: function(validBidRequests) {
- let requests = [];
- let bidRequest;
- let reqUrl;
- let placementId;
- for (let i = 0; i < validBidRequests.length; i++) {
- bidRequest = validBidRequests[i];
- bidRequest.adspiritConId = spec.genAdConId(bidRequest);
- reqUrl = spec.getBidderHost(bidRequest);
- placementId = utils.getBidIdParameter('placementId', bidRequest.params);
- reqUrl = '//' + reqUrl + RTB_URL + '&pid=' + placementId + '&ref=' + encodeURIComponent(utils.getTopWindowUrl()) + '&scx=' + (screen.width) + '&scy=' + (screen.height) + '&wcx=' + ('innerWidth' in window ? window.innerWidth : page.clientWidth) + '&wcy=' + ('innerHeight' in window ? window.innerHeight : page.clientHeight) + '&async=' + bidRequest.adspiritConId + '&t=' + Math.round(Math.random() * 100000);
- requests.push({
- method: 'GET',
- url: reqUrl,
- data: {},
- bidRequest: bidRequest
- });
- }
- return requests;
- },
- interpretResponse: function(serverResponse, bidRequest) {
- const bidResponses = [];
- let bidObj = bidRequest.bidRequest;
-
- if (!serverResponse || !serverResponse.body || !bidObj) {
- utils.logWarn(`No valid bids from ${spec.code} bidder!`);
- return [];
- }
- let adData = serverResponse.body;
- let cpm = adData.cpm;
- if (!cpm) return [];
-
- let host = spec.getBidderHost(bidObj);
- let adm = '