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

TCF Purpose 1 enforcement #5018

Merged
merged 11 commits into from
Mar 31, 2020
Merged
2 changes: 1 addition & 1 deletion integrationExamples/gpt/hello_world.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ <h5>Div-1</h5>
</script>
</div>
</body>
</html>
</html>
1 change: 1 addition & 0 deletions modules/aardvarkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function resetUserSync() {

export const spec = {
code: BIDDER_CODE,
gvlid: 52,
aliases: ['adsparc', 'safereach'],

isBidRequestValid: function(bid) {
Expand Down
11 changes: 7 additions & 4 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import { loadExternalScript } from '../src/adloader.js'
import JSEncrypt from 'jsencrypt/bin/jsencrypt.js';
import sha256 from 'crypto-js/sha256.js';
import { getStorageManager } from '../src/storageManager.js';

const BIDDER_CODE = 'adagio';
const VERSION = '2.1.0';
Expand All @@ -12,6 +13,8 @@ const ENDPOINT = 'https://mp.4dex.io/prebid';
const SUPPORTED_MEDIA_TYPES = ['banner'];
const ADAGIO_TAG_URL = 'https://script.4dex.io/localstore.js';
const ADAGIO_LOCALSTORAGE_KEY = 'adagioScript';
const GVLID = 617;
const storage = getStorageManager(GVLID);

export const ADAGIO_PUBKEY = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9el0+OEn6fvEh1RdVHQu4cnT0
Expand All @@ -22,7 +25,7 @@ pV6EP3MTLosuUEpLaQIDAQAB

export function getAdagioScript() {
try {
const ls = utils.getDataFromLocalStorage(ADAGIO_LOCALSTORAGE_KEY);
const ls = storage.getDataFromLocalStorage(ADAGIO_LOCALSTORAGE_KEY);

if (!ls) {
utils.logWarn('Adagio Script not found');
Expand All @@ -33,7 +36,7 @@ export function getAdagioScript() {

if (!hashRgx.test(ls)) {
utils.logWarn('No hash found in Adagio script');
utils.removeDataFromLocalStorage(ADAGIO_LOCALSTORAGE_KEY);
storage.removeDataFromLocalStorage(ADAGIO_LOCALSTORAGE_KEY);
} else {
const r = ls.match(hashRgx);
const hash = r[2];
Expand All @@ -47,7 +50,7 @@ export function getAdagioScript() {
Function(ls)(); // eslint-disable-line no-new-func
} else {
utils.logWarn('Invalid Adagio script found');
utils.removeDataFromLocalStorage(ADAGIO_LOCALSTORAGE_KEY);
storage.removeDataFromLocalStorage(ADAGIO_LOCALSTORAGE_KEY);
}
}
} catch (err) {
Expand Down Expand Up @@ -341,7 +344,7 @@ function _getGdprConsent(bidderRequest) {

export const spec = {
code: BIDDER_CODE,

gvlid: GVLID,
supportedMediaType: SUPPORTED_MEDIA_TYPES,

isBidRequestValid: function (bid) {
Expand Down
6 changes: 4 additions & 2 deletions modules/adkernelAdnAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import adapterManager from '../src/adapterManager.js';
import {parse} from '../src/url.js';
import * as utils from '../src/utils.js';
import {ajax} from '../src/ajax.js';
import { getStorageManager } from '../src/storageManager.js';

const ANALYTICS_VERSION = '1.0.1';
const DEFAULT_QUEUE_TIMEOUT = 4000;
const DEFAULT_HOST = 'tag.adkernel.com';
const storageObj = getStorageManager();

const ADK_HB_EVENTS = {
AUCTION_INIT: 'auctionInit',
Expand Down Expand Up @@ -175,10 +177,10 @@ const ORGANIC = '(organic)';

export let storage = {
getItem: (name) => {
return utils.getDataFromLocalStorage(name);
return storageObj.getDataFromLocalStorage(name);
},
setItem: (name, value) => {
utils.setDataInLocalStorage(name, value);
storageObj.setDataInLocalStorage(name, value);
}
};

Expand Down
8 changes: 5 additions & 3 deletions modules/adspendBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { ajax } from '../src/ajax.js'
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js';
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();
const BIDDER_CODE = 'adspend';
const BID_URL = 'https://rtb.com.ru/headerbidding-bid';
const SYNC_URL = 'https://rtb.com.ru/headerbidding-sync?uid={UUID}';
Expand Down Expand Up @@ -40,7 +42,7 @@ export const spec = {
bid.params.bidfloor &&
bid.crumbs.pubcid &&
utils.checkCookieSupport() &&
utils.cookiesAreEnabled()
storage.cookiesAreEnabled()
);
},

Expand Down Expand Up @@ -145,11 +147,11 @@ export const spec = {
}

const getUserID = () => {
const i = utils.getCookie(COOKIE_NAME);
const i = storage.getCookie(COOKIE_NAME);

if (i === null) {
const uuid = utils.generateUUID();
utils.setCookie(COOKIE_NAME, uuid);
storage.setCookie(COOKIE_NAME, uuid);
return uuid;
}
return i;
Expand Down
1 change: 1 addition & 0 deletions modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const syncsCache = {};

export const spec = {
code: BIDDER_CODE,
gvlid: 410,
aliases: ['onefiftytwomedia', 'selectmedia'],
supportedMediaTypes: [VIDEO, BANNER],
isBidRequestValid: function (bid) {
Expand Down
1 change: 1 addition & 0 deletions modules/aolBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function resolveEndpointCode(bid) {

export const spec = {
code: AOL_BIDDERS_CODES.AOL,
gvlid: 25,
aliases: [AOL_BIDDERS_CODES.ONEMOBILE, AOL_BIDDERS_CODES.ONEDISPLAY],
supportedMediaTypes: [BANNER],
isBidRequestValid(bid) {
Expand Down
6 changes: 5 additions & 1 deletion modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { auctionManager } from '../src/auctionManager.js';
import find from 'core-js/library/fn/array/find.js';
import includes from 'core-js/library/fn/array/includes.js';
import { OUTSTREAM, INSTREAM } from '../src/video.js';
import { getStorageManager } from '../src/storageManager.js';

const BIDDER_CODE = 'appnexus';
const URL = 'https://ib.adnxs.com/ut/v3/prebid';
Expand Down Expand Up @@ -38,9 +39,12 @@ const mappingFileUrl = 'https://acdn.adnxs.com/prebid/appnexus-mapping/mappings.
const SCRIPT_TAG_START = '<script';
const VIEWABILITY_URL_START = /\/\/cdn\.adnxs\.com\/v/;
const VIEWABILITY_FILE_NAME = 'trk.js';
const GVLID = 32;
const storage = getStorageManager(GVLID, BIDDER_CODE);

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
aliases: ['appnexusAst', 'brealtime', 'emxdigital', 'pagescience', 'defymedia', 'gourmetads', 'matomy', 'featureforward', 'oftmedia', 'districtm', 'adasta'],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down Expand Up @@ -93,7 +97,7 @@ export const spec = {
let debugObj = {};
let debugObjParams = {};
const debugCookieName = 'apn_prebid_debug';
const debugCookie = utils.getCookie(debugCookieName) || null;
const debugCookie = storage.getCookie(debugCookieName) || null;

if (debugCookie) {
try {
Expand Down
7 changes: 5 additions & 2 deletions modules/audigentRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import {getGlobal} from '../src/prebidGlobal.js';
import * as utils from '../src/utils.js';
import {submodule} from '../src/hook.js';
import {ajax} from '../src/ajax.js';
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();

/** @type {string} */
const MODULE_NAME = 'realTimeData';
Expand All @@ -33,12 +36,12 @@ let _moduleParams = {};
*/

export function setData(data) {
utils.setDataInLocalStorage('__adgntseg', JSON.stringify(data));
storage.setDataInLocalStorage('__adgntseg', JSON.stringify(data));
}

function getSegments(adUnits, onDone) {
try {
let jsonData = utils.getDataFromLocalStorage('__adgntseg');
let jsonData = storage.getDataFromLocalStorage('__adgntseg');
if (jsonData) {
let data = JSON.parse(jsonData);
if (data.audigent_segments) {
Expand Down
5 changes: 4 additions & 1 deletion modules/bidfluenceBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();
const BIDDER_CODE = 'bidfluence';

function stdTimezoneOffset(t) {
Expand Down Expand Up @@ -46,7 +49,7 @@ export const spec = {
var payload = {
v: '2.0',
azr: true,
ck: utils.cookiesAreEnabled(),
ck: storage.cookiesAreEnabled(),
re: refInfo ? refInfo.referer : '',
st: refInfo ? refInfo.stack : [],
tz: getBdfTz(new Date()),
Expand Down
5 changes: 4 additions & 1 deletion modules/browsiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import * as utils from '../src/utils.js';
import {submodule} from '../src/hook.js';
import {ajaxBuilder} from '../src/ajax.js';
import {loadExternalScript} from '../src/adloader.js';
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();

/** @type {string} */
const MODULE_NAME = 'realTimeData';
Expand Down Expand Up @@ -62,7 +65,7 @@ function collectData() {
const doc = win.document;
let browsiData = null;
try {
browsiData = utils.getDataFromLocalStorage('__brtd');
browsiData = storage.getDataFromLocalStorage('__brtd');
} catch (e) {
utils.logError('unable to parse __brtd');
}
Expand Down
10 changes: 6 additions & 4 deletions modules/categoryTranslation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
import { config } from '../src/config.js';
import { setupBeforeHookFnOnce, hook } from '../src/hook.js';
import { ajax } from '../src/ajax.js';
import { timestamp, logError, setDataInLocalStorage, getDataFromLocalStorage } from '../src/utils.js';
import { timestamp, logError } from '../src/utils.js';
import { addBidResponse } from '../src/auction.js';
import { getCoreStorageManager } from '../src/storageManager.js';

export const storage = getCoreStorageManager('categoryTranslation');
const DEFAULT_TRANSLATION_FILE_URL = 'https://cdn.jsdelivr.net/gh/prebid/category-mapping-file@1/freewheel-mapping.json';
const DEFAULT_IAB_TO_FW_MAPPING_KEY = 'iabToFwMappingkey';
const DEFAULT_IAB_TO_FW_MAPPING_KEY_PUB = 'iabToFwMappingkeyPub';
Expand All @@ -43,7 +45,7 @@ export function getAdserverCategoryHook(fn, adUnitCode, bid) {
let localStorageKey = (config.getConfig('brandCategoryTranslation.translationFile')) ? DEFAULT_IAB_TO_FW_MAPPING_KEY_PUB : DEFAULT_IAB_TO_FW_MAPPING_KEY;

if (bid.meta && !bid.meta.adServerCatId) {
let mapping = getDataFromLocalStorage(localStorageKey);
let mapping = storage.getDataFromLocalStorage(localStorageKey);
if (mapping) {
try {
mapping = JSON.parse(mapping);
Expand All @@ -65,15 +67,15 @@ export function getAdserverCategoryHook(fn, adUnitCode, bid) {

export function initTranslation(url, localStorageKey) {
setupBeforeHookFnOnce(addBidResponse, getAdserverCategoryHook, 50);
let mappingData = getDataFromLocalStorage(localStorageKey);
let mappingData = storage.getDataFromLocalStorage(localStorageKey);
if (!mappingData || timestamp() < mappingData.lastUpdated + refreshInDays * 24 * 60 * 60 * 1000) {
ajax(url,
{
success: (response) => {
try {
response = JSON.parse(response);
response['lastUpdated'] = timestamp();
setDataInLocalStorage(localStorageKey, JSON.stringify(response));
storage.setDataInLocalStorage(localStorageKey, JSON.stringify(response));
} catch (error) {
logError('Failed to parse translation mapping file');
}
Expand Down
5 changes: 4 additions & 1 deletion modules/ccxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as utils from '../src/utils.js'
import { registerBidder } from '../src/adapters/bidderFactory.js'
import { config } from '../src/config.js'
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();
const BIDDER_CODE = 'ccx'
const BID_URL = 'https://delivery.clickonometrics.pl/ortb/prebid/bid'
const SUPPORTED_VIDEO_PROTOCOLS = [2, 3, 5, 6]
Expand Down Expand Up @@ -170,7 +173,7 @@ export const spec = {
requestBody.site = _getSiteObj(bidderRequest)
requestBody.device = _getDeviceObj()
requestBody.id = bidderRequest.bids[0].auctionId
requestBody.ext = {'ce': (utils.cookiesAreEnabled() ? 1 : 0)}
requestBody.ext = {'ce': (storage.cookiesAreEnabled() ? 1 : 0)}

// Attaching GDPR Consent Params
if (bidderRequest && bidderRequest.gdprConsent) {
Expand Down
5 changes: 4 additions & 1 deletion modules/cedatoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();

const BIDDER_CODE = 'cedato';
const BID_URL = 'https://h.cedatoplayer.com/hb';
Expand All @@ -19,7 +22,7 @@ export const spec = {
bid.params &&
bid.params.player_id &&
utils.checkCookieSupport() &&
utils.cookiesAreEnabled()
storage.cookiesAreEnabled()
);
},

Expand Down
11 changes: 8 additions & 3 deletions modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { getStorageManager } from '../src/storageManager.js';

const GVLID = 24;
export const storage = getStorageManager(GVLID);

const BIDDER_CODE = 'conversant';
const URL = 'https://web.hb.ad.cpe.dotomi.com/s2s/header/24';

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
aliases: ['cnvr'], // short code
supportedMediaTypes: [BANNER, VIDEO],

Expand Down Expand Up @@ -343,13 +348,13 @@ function readStoredValue(key) {
let storedValue;
try {
// check cookies first
storedValue = utils.getCookie(key);
storedValue = storage.getCookie(key);

if (!storedValue) {
// check expiration time before reading local storage
const storedValueExp = utils.getDataFromLocalStorage(`${key}_exp`);
const storedValueExp = storage.getDataFromLocalStorage(`${key}_exp`);
if (storedValueExp === '' || (storedValueExp && (new Date(storedValueExp)).getTime() - Date.now() > 0)) {
storedValue = utils.getDataFromLocalStorage(key);
storedValue = storage.getDataFromLocalStorage(key);
storedValue = storedValue ? decodeURIComponent(storedValue) : storedValue;
}
}
Expand Down
10 changes: 7 additions & 3 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import { parse } from '../src/url.js';
import * as utils from '../src/utils.js';
import find from 'core-js/library/fn/array/find.js';
import { verify } from 'criteo-direct-rsa-validate/build/verify.js';
import { getStorageManager } from '../src/storageManager.js';

const GVLID = 91;
export const ADAPTER_VERSION = 26;
const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = 'https://bidder.criteo.com/cdb';
const CRITEO_VENDOR_ID = 91;
const PROFILE_ID_INLINE = 207;
export const PROFILE_ID_PUBLISHERTAG = 185;
const storage = getStorageManager(GVLID);

// Unminified source code can be found in: https://github.com/Prebid-org/prebid-js-external-js-criteo/blob/master/dist/prod.js
const PUBLISHER_TAG_URL = 'https://static.criteo.net/js/ld/publishertag.prebid.js';
Expand All @@ -23,6 +26,7 @@ const FAST_BID_PUBKEY_N = 'ztQYwCE5BU7T9CDM5he6rKoabstXRmkzx54zFPZkWbK530dwtLBDe
/** @type {BidderSpec} */
export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [ BANNER, VIDEO, NATIVE ],

/**
Expand Down Expand Up @@ -423,7 +427,7 @@ export function tryGetCriteoFastBid() {
try {
const fastBidStorageKey = 'criteo_fast_bid';
const hashPrefix = '// Hash: ';
const fastBidFromStorage = utils.getDataFromLocalStorage(fastBidStorageKey);
const fastBidFromStorage = storage.getDataFromLocalStorage(fastBidStorageKey);

if (fastBidFromStorage !== null) {
// The value stored must contain the file's encrypted hash as first line
Expand All @@ -432,7 +436,7 @@ export function tryGetCriteoFastBid() {

if (firstLine.substr(0, hashPrefix.length) !== hashPrefix) {
utils.logWarn('No hash found in FastBid');
utils.removeDataFromLocalStorage(fastBidStorageKey);
storage.removeDataFromLocalStorage(fastBidStorageKey);
} else {
// Remove the hash part from the locally stored value
const publisherTagHash = firstLine.substr(hashPrefix.length);
Expand All @@ -446,7 +450,7 @@ export function tryGetCriteoFastBid() {
utils.insertElement(script);
} else {
utils.logWarn('Invalid Criteo FastBid found');
utils.removeDataFromLocalStorage(fastBidStorageKey);
storage.removeDataFromLocalStorage(fastBidStorageKey);
}
}
}
Expand Down
Loading