diff --git a/bundle-template.txt b/bundle-template.txt
new file mode 100644
index 00000000000..c624e25b805
--- /dev/null
+++ b/bundle-template.txt
@@ -0,0 +1,16 @@
+/* <%= prebid.name %> v<%= prebid.version %>
+Updated: <%= (new Date()).toISOString().substring(0, 10) %>
+Modules: <%= modules %> */
+
+if (!<%= prebid.globalVarName %> || !<%= prebid.globalVarName %>.libLoaded) {
+ $$PREBID_SOURCE$$
+ <% if(enable) {%>
+ <%= prebid.globalVarName %>.processQueue();
+ <% } %>
+} else {
+ try {
+ if(<%= prebid.globalVarName %>.getConfig('debug')) {
+ console.warn('Attempted to load a copy of Prebid.js that clashes with the existing \'<%= prebid.globalVarName %>\' instance. Load aborted.');
+ }
+ } catch (e) {}
+}
diff --git a/gulpfile.js b/gulpfile.js
index ff49436384b..adf052ca240 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -15,8 +15,6 @@ var opens = require('opn');
var webpackConfig = require('./webpack.conf.js');
var helpers = require('./gulpHelpers.js');
var concat = require('gulp-concat');
-var header = require('gulp-header');
-var footer = require('gulp-footer');
var replace = require('gulp-replace');
var shell = require('gulp-shell');
var eslint = require('gulp-eslint');
@@ -27,10 +25,10 @@ var fs = require('fs');
var jsEscape = require('gulp-js-escape');
const path = require('path');
const execa = require('execa');
+const {minify} = require('terser');
+const Vinyl = require('vinyl');
var prebid = require('./package.json');
-var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
-var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + '*/\n';
var port = 9999;
const INTEG_SERVER_HOST = argv.host ? argv.host : 'localhost';
const INTEG_SERVER_PORT = 4444;
@@ -149,18 +147,12 @@ function makeWebpackPkg() {
.pipe(gulp.dest('build/dist'));
}
-function addBanner() {
- const sm = argv.sourceMaps;
-
- return gulp.src(['build/dist/prebid-core.js'])
- .pipe(gulpif(sm, sourcemaps.init({loadMaps: true})))
- .pipe(header(banner, {prebid}))
- .pipe(gulpif(sm, sourcemaps.write('.')))
- .pipe(gulp.dest('build/dist'))
-}
-
function getModulesListToAddInBanner(modules) {
- return (modules.length > 0) ? modules.join(', ') : 'All available modules in current version.';
+ if (!modules || modules.length === helpers.getModuleNames().length) {
+ return 'All available modules for this version.'
+ } else {
+ return modules.join(', ')
+ }
}
function gulpBundle(dev) {
@@ -180,6 +172,47 @@ function nodeBundle(modules, dev = false) {
});
}
+function wrapWithHeaderAndFooter(dev, modules) {
+ // NOTE: gulp-header, gulp-footer & gulp-wrap do not play nice with source maps.
+ // gulp-concat does; for that reason we are prepending and appending the source stream with "fake" header & footer files.
+ function memoryVinyl(name, contents) {
+ return new Vinyl({
+ cwd: '',
+ base: 'generated',
+ path: name,
+ contents: Buffer.from(contents, 'utf-8')
+ });
+ }
+ return function wrap(stream) {
+ const wrapped = through.obj();
+ const placeholder = '$$PREBID_SOURCE$$';
+ const tpl = _.template(fs.readFileSync('./bundle-template.txt'))({
+ prebid,
+ modules: getModulesListToAddInBanner(modules),
+ enable: !argv.manualEnable
+ });
+ (dev ? Promise.resolve(tpl) : minify(tpl, {format: {comments: true}}).then((res) => res.code))
+ .then((tpl) => {
+ // wrap source placeholder in an IIFE to make it an expression (so that it works with minify output)
+ const parts = tpl.replace(placeholder, `(function(){$$${placeholder}$$})()`).split(placeholder);
+ if (parts.length !== 2) {
+ throw new Error(`Cannot parse bundle template; it must contain exactly one instance of '${placeholder}'`);
+ }
+ const [header, footer] = parts;
+ wrapped.push(memoryVinyl('prebid-header.js', header));
+ stream.pipe(wrapped, {end: false});
+ stream.on('end', () => {
+ wrapped.push(memoryVinyl('prebid-footer.js', footer));
+ wrapped.push(null);
+ });
+ })
+ .catch((err) => {
+ wrapped.destroy(err);
+ });
+ return wrapped;
+ }
+}
+
function bundle(dev, moduleArr) {
var modules = moduleArr || helpers.getArgModules();
var allModules = helpers.getModuleNames(modules);
@@ -210,17 +243,10 @@ function bundle(dev, moduleArr) {
gutil.log('Appending ' + prebid.globalVarName + '.processQueue();');
gutil.log('Generating bundle:', outputFileName);
- return gulp.src(
- entries
- )
- // Need to uodate the "Modules: ..." section in comment with the current modules list
- .pipe(replace(/(Modules: )(.*?)(\*\/)/, ('$1' + getModulesListToAddInBanner(helpers.getArgModules()) + ' $3')))
+ const wrap = wrapWithHeaderAndFooter(dev, modules);
+ return wrap(gulp.src(entries))
.pipe(gulpif(sm, sourcemaps.init({ loadMaps: true })))
.pipe(concat(outputFileName))
- .pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', {
- global: prebid.globalVarName
- }
- )))
.pipe(gulpif(sm, sourcemaps.write('.')));
}
@@ -389,7 +415,7 @@ gulp.task(clean);
gulp.task(escapePostbidConfig);
gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null, true)));
-gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, addBanner, gulpBundle.bind(null, false)));
+gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false)));
// public tasks (dependencies are needed for each task since they can be ran on their own)
gulp.task('test-only', test);
@@ -405,6 +431,7 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));
gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast)));
+gulp.task('serve-prod', gulp.series(clean, gulp.parallel('build-bundle-prod', startLocalServer)));
gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true}))));
gulp.task('serve-e2e', gulp.series(clean, 'build-bundle-prod', gulp.parallel(() => startIntegServer(), startLocalServer)))
gulp.task('serve-e2e-dev', gulp.series(clean, 'build-bundle-dev', gulp.parallel(() => startIntegServer(true), startLocalServer)))
diff --git a/integrationExamples/gpt/akamaidap_email_example.html b/integrationExamples/gpt/akamaidap_email_example.html
deleted file mode 100755
index 828b2add787..00000000000
--- a/integrationExamples/gpt/akamaidap_email_example.html
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Prebid.js Test
-Div-1
-
-
-
-User IDs Sent to Bidding Adapter
-
-
-
diff --git a/integrationExamples/gpt/akamaidap_signature_example.html b/integrationExamples/gpt/akamaidap_signature_example.html
deleted file mode 100644
index e4c7c617653..00000000000
--- a/integrationExamples/gpt/akamaidap_signature_example.html
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Prebid.js Test
-Div-1
-
-
-
-User IDs Sent to Bidding Adapter
-
-
-
diff --git a/integrationExamples/gpt/akamaidap_x1_example.html b/integrationExamples/gpt/akamaidap_x1_example.html
deleted file mode 100755
index b1f16acc560..00000000000
--- a/integrationExamples/gpt/akamaidap_x1_example.html
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Prebid.js Test
-Div-1
-
-
-
-User IDs Sent to Bidding Adapter
-
-
-
diff --git a/integrationExamples/gpt/userId_example.html b/integrationExamples/gpt/userId_example.html
index 4bba558c4db..48b349649bc 100644
--- a/integrationExamples/gpt/userId_example.html
+++ b/integrationExamples/gpt/userId_example.html
@@ -251,14 +251,7 @@
{
"name": "uid2"
}
- ,{
- name: "flocId",
- params: {
- // Default sharedid.org token : "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
- // To get new token, register https://developer.chrome.com/origintrials/#/trials/active for Federated Learning of Cohorts
- token: "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
- }
- },
+ ,
{
"name": "imuid",
"params": {
diff --git a/modules/.submodules.json b/modules/.submodules.json
index 8d62f30d7c4..5c8fb8eb3c5 100644
--- a/modules/.submodules.json
+++ b/modules/.submodules.json
@@ -3,7 +3,6 @@
"33acrossIdSystem",
"admixerIdSystem",
"adtelligentIdSystem",
- "akamaiDAPIdSystem",
"amxIdSystem",
"britepoolIdSystem",
"connectIdSystem",
@@ -13,9 +12,7 @@
"deepintentDpesIdSystem",
"dmdIdSystem",
"fabrickIdSystem",
- "flocIdSystem",
"hadronIdSystem",
- "haloIdSystem",
"id5IdSystem",
"ftrackIdSystem",
"identityLinkIdSystem",
@@ -30,7 +27,6 @@
"mwOpenLinkIdSystem",
"naveggIdSystem",
"netIdSystem",
- "nextrollIdSystem",
"novatiqIdSystem",
"parrableIdSystem",
"pubProvidedIdSystem",
diff --git a/modules/33acrossBidAdapter.js b/modules/33acrossBidAdapter.js
index 498e6cf8634..0095b4fb768 100644
--- a/modules/33acrossBidAdapter.js
+++ b/modules/33acrossBidAdapter.js
@@ -195,7 +195,7 @@ function _buildRequestParams(bidRequests, bidderRequest) {
const uspConsent = bidderRequest && bidderRequest.uspConsent;
- const pageUrl = (bidderRequest && bidderRequest.refererInfo) ? (bidderRequest.refererInfo.referer) : (undefined);
+ const pageUrl = bidderRequest?.refererInfo?.page
adapterState.uniqueSiteIds = bidRequests.map(req => req.params.siteId).filter(uniques);
diff --git a/modules/7xbidBidAdapter.md b/modules/7xbidBidAdapter.md
deleted file mode 100644
index 692428332f0..00000000000
--- a/modules/7xbidBidAdapter.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Overview
-
-Module Name: 7xbid Bid Adapter
-
-Maintainer: 7xbid.com@gmail.com
-
-# Description
-
-Module that connects to 7xbid's demand sources
-
-# Test Parameters
-```javascript
- var adUnits = [
- {
- code: 'test',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [
- {
- bidder: '7xbid',
- params: {
- placementId: 1425292,
- currency: 'USD'
- }
- }
- ]
- },
- {
- code: 'test',
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 80
- },
- image: {
- required: true,
- sizes: [150, 50]
- },
- sponsoredBy: {
- required: true
- }
- }
- },
- bids: [
- {
- bidder: '7xbid',
- params: {
- placementId: 1429695,
- currency: 'USD'
- }
- },
- ],
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/a4gBidAdapter.js b/modules/a4gBidAdapter.js
index 03f9d6fd726..f0c7a5f5af1 100644
--- a/modules/a4gBidAdapter.js
+++ b/modules/a4gBidAdapter.js
@@ -44,7 +44,7 @@ export const spec = {
let data = {
[IFRAME_PARAM_NAME]: 0,
- [LOCATION_PARAM_NAME]: (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) ? bidderRequest.refererInfo.referer : window.location.href,
+ [LOCATION_PARAM_NAME]: bidderRequest.refererInfo?.page,
[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)
diff --git a/modules/aardvarkBidAdapter.md b/modules/aardvarkBidAdapter.md
deleted file mode 100644
index 9f7a128b6f3..00000000000
--- a/modules/aardvarkBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-**Module Name**: Aardvark Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: chris@rtk.io
-
-# Description
-
-Module that connects to a RTK.io Ad Units to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [{
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- code: 'div-gpt-ad-1460505748561-0',
-
- bids: [{
- bidder: 'aardvark',
- params: {
- ai: '0000',
- sc: '1234'
- }
- }]
-
- }];
-```
diff --git a/modules/ablidaBidAdapter.js b/modules/ablidaBidAdapter.js
index cb4f4ef2724..9e322ba449b 100644
--- a/modules/ablidaBidAdapter.js
+++ b/modules/ablidaBidAdapter.js
@@ -45,7 +45,8 @@ export const spec = {
sizes: sizes,
bidId: bidRequest.bidId,
categories: bidRequest.params.categories,
- referer: bidderRequest.refererInfo.referer,
+ // TODO: should referer be 'ref'?
+ referer: bidderRequest.refererInfo.page,
jaySupported: jaySupported,
device: device,
adapterVersion: 5,
diff --git a/modules/adWMGBidAdapter.js b/modules/adWMGBidAdapter.js
index 7bf6c703a55..12dc36d694c 100644
--- a/modules/adWMGBidAdapter.js
+++ b/modules/adWMGBidAdapter.js
@@ -27,9 +27,10 @@ export const spec = {
buildRequests: (validBidRequests, bidderRequest) => {
const timeout = bidderRequest.timeout || 0;
const debug = config.getConfig('debug') || false;
- const referrer = bidderRequest.refererInfo.referer;
+ // TODO: is 'page' the right value here?
+ const referrer = bidderRequest.refererInfo.page;
const locale = window.navigator.language && window.navigator.language.length > 0 ? window.navigator.language.substr(0, 2) : '';
- const domain = config.getConfig('publisherDomain') || (window.location && window.location.host ? window.location.host : '');
+ const domain = bidderRequest.refererInfo.domain || '';
const ua = window.navigator.userAgent.toLowerCase();
const additional = spec.parseUserAgent(ua);
diff --git a/modules/adagioBidAdapter.js b/modules/adagioBidAdapter.js
index b98567878a8..a76046ad2db 100644
--- a/modules/adagioBidAdapter.js
+++ b/modules/adagioBidAdapter.js
@@ -19,14 +19,13 @@ import {
logInfo,
logWarn,
mergeDeep,
- parseUrl
} from '../src/utils.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {loadExternalScript} from '../src/adloader.js';
import {verify} from 'criteo-direct-rsa-validate/build/verify.js';
import {getStorageManager} from '../src/storageManager.js';
-import {getRefererInfo} from '../src/refererDetection.js';
+import {getRefererInfo, parseDomain} from '../src/refererDetection.js';
import {createEidsArray} from './userId/eids.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
@@ -270,12 +269,11 @@ function getDevice() {
function getSite(bidderRequest) {
const { refererInfo } = bidderRequest;
- const url = parseUrl(refererInfo.referer);
-
return {
- domain: url.hostname || '',
- page: refererInfo.referer || '',
- referrer: canAccessTopWindow() ? getWindowTop().document.referrer || '' : getWindowSelf().document.referrer || '',
+ // TODO: do these fallbacks make sense?
+ domain: refererInfo.domain || parseDomain(refererInfo.topmostLocation) || '',
+ page: refererInfo.page || refererInfo.topmostLocation || '',
+ referrer: refererInfo.ref || getWindowSelf().document.referrer || '',
top: refererInfo.reachedTop
};
};
@@ -621,7 +619,7 @@ export function setExtraParam(bid, paramName) {
}
const adgGlobalConf = config.getConfig('adagio') || {};
- const ortb2Conf = config.getConfig('ortb2');
+ const ortb2Conf = bid.ortb2;
const detected = adgGlobalConf[paramName] || deepAccess(ortb2Conf, `site.ext.data.${paramName}`, null);
if (detected) {
diff --git a/modules/adblender.md b/modules/adblender.md
deleted file mode 100644
index e70b2a4a8ed..00000000000
--- a/modules/adblender.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Overview
-
-Module Name: AdBlender Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: contact@ad-blender.com
-
-# Description
-
-Connects to AdBlender demand source to fetch bids.
-Banner and Video formats are supported.
-Please use ```adblender``` as the bidder code.
-#Bidder Config
-You can set an alternate endpoint url `pbjs.setBidderConfig` for the bidder `adblender`
-```
-pbjs.setBidderConfig({
- bidders: ["adblender"],
- config: {"adblender": { "endpoint_url": "https://inv-nets.admixer.net/adblender.1.1.aspx"}}
- })
-```
-# Ad Unit Example
-```
- var adUnits = [
- {
- code: 'desktop-banner-ad-div',
- sizes: [[300, 250]], // a display size
- bids: [
- {
- bidder: "adblender",
- params: {
- zone: 'fb3d34d0-7a88-4a4a-a5c9-8088cd7845f4'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/adbookpspBidAdapter.js b/modules/adbookpspBidAdapter.js
index de8a3598be1..198441975d8 100644
--- a/modules/adbookpspBidAdapter.js
+++ b/modules/adbookpspBidAdapter.js
@@ -123,9 +123,9 @@ function buildRequest(validBidRequests, bidderRequest) {
id: bidderRequest.bidderRequestId,
tmax: bidderRequest.timeout,
site: {
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidderRequest.refererInfo.referer,
+ domain: bidderRequest.refererInfo.domain,
+ page: bidderRequest.refererInfo.page,
+ ref: bidderRequest.refererInfo.ref,
},
source: buildSource(validBidRequests, bidderRequest),
device: buildDevice(),
diff --git a/modules/adbutlerBidAdapter.md b/modules/adbutlerBidAdapter.md
deleted file mode 100644
index 1921cc4046e..00000000000
--- a/modules/adbutlerBidAdapter.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Overview
-
-**Module Name**: AdButler Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: dan@sparklit.com
-
-# Description
-
-Module that connects to an AdButler zone to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'display-div',
- sizes: [[300, 250]], // a display size
- bids: [
- {
- bidder: "adbutler",
- params: {
- accountID: '167283',
- zoneID: '210093',
- keyword: 'red', //optional
- minCPM: '1.00', //optional
- maxCPM: '5.00' //optional
- extra: { // optional
- foo: "bar"
- }
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/addefendBidAdapter.js b/modules/addefendBidAdapter.js
index dcc453ef35a..f0a6852b084 100644
--- a/modules/addefendBidAdapter.js
+++ b/modules/addefendBidAdapter.js
@@ -21,7 +21,8 @@ export const spec = {
pageId: false,
gdpr_applies: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? bidderRequest.gdprConsent.gdprApplies : 'true',
gdpr_consent: bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString ? bidderRequest.gdprConsent.consentString : '',
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the correct item here?
+ referer: bidderRequest.refererInfo.page,
bids: [],
};
diff --git a/modules/adfBidAdapter.js b/modules/adfBidAdapter.js
index e21c4219baf..0b9c10bb38a 100644
--- a/modules/adfBidAdapter.js
+++ b/modules/adfBidAdapter.js
@@ -1,15 +1,11 @@
// jshint esversion: 6, es3: false, node: true
'use strict';
-import {
- registerBidder
-} from '../src/adapters/bidderFactory.js';
-import {
- NATIVE, BANNER, VIDEO
-} from '../src/mediaTypes.js';
-import { mergeDeep, _map, deepAccess, parseSizesInput, deepSetValue } from '../src/utils.js';
-import { config } from '../src/config.js';
-import { Renderer } from '../src/Renderer.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
+import {_map, deepAccess, deepSetValue, mergeDeep, parseSizesInput} from '../src/utils.js';
+import {config} from '../src/config.js';
+import {Renderer} from '../src/Renderer.js';
const { getConfig } = config;
@@ -66,7 +62,7 @@ export const spec = {
buildRequests: (validBidRequests, bidderRequest) => {
let app, site;
- const commonFpd = getConfig('ortb2') || {};
+ const commonFpd = bidderRequest.ortb2 || {};
let { user } = commonFpd;
if (typeof getConfig('app') === 'object') {
@@ -81,7 +77,7 @@ export const spec = {
}
if (!site.page) {
- site.page = bidderRequest.refererInfo.referer;
+ site.page = bidderRequest.refererInfo.page;
}
}
diff --git a/modules/adfinityBidAdapter.md b/modules/adfinityBidAdapter.md
deleted file mode 100644
index f67d4fddfe7..00000000000
--- a/modules/adfinityBidAdapter.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# Overview
-
-```
-Module Name: Adfinity Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: adfinity_prebid@i.ua
-```
-
-# Description
-
-Module that connects to Adfinity demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'placementid_0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]]
- }
- },
- bids: [{
- bidder: 'adfinity',
- params: {
- placement_id: 0,
- traffic: 'banner'
- }
- }
- ]
- },
- {
- code: 'placementid_0',
- mediaTypes: {
- native: {
-
- }
- },
- bids: [
- {
- bidder: 'adfinity',
- params: {
- placement_id: 0,
- traffic: 'native'
- }
- }
- ]
- },
- {
- code: 'placementid_0',
- mediaTypes: {
- video: {
- sizes: [[300, 250], [300,600]]
- }
- },
- bids: [
- {
- bidder: 'adfinity',
- params: {
- placement_id: 0,
- traffic: 'video'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js
index e0d3a881cad..94527c5d051 100644
--- a/modules/adgenerationBidAdapter.js
+++ b/modules/adgenerationBidAdapter.js
@@ -49,7 +49,8 @@ export const spec = {
if (!validReq.mediaTypes || !validReq.mediaTypes.native) {
data = tryAppendQueryString(data, 'imark', '1');
}
- data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.referer);
+ // TODO: is 'page' the right value here?
+ data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page);
if (isIos()) {
const hyperId = getHyperId(validReq);
if (hyperId != null) {
diff --git a/modules/adglareBidAdapter.md b/modules/adglareBidAdapter.md
deleted file mode 100644
index 845564473c7..00000000000
--- a/modules/adglareBidAdapter.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Overview
-
-```
-Module Name: AdGlare Ad Server Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@adglare.com
-```
-
-# Description
-
-Adapter that connects to your AdGlare Ad Server.
-Including support for your white label ad serving domain.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'your-div-id',
- mediaTypes: {
- banner: {
- sizes: [[300,250], [728,90]],
- }
- },
- bids: [
- {
- bidder: 'adglare',
- params: {
- domain: 'try.engine.adglare.net',
- zID: '475579334',
- type: 'banner'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/adhashBidAdapter.js b/modules/adhashBidAdapter.js
index 7f5af047993..977d161b214 100644
--- a/modules/adhashBidAdapter.js
+++ b/modules/adhashBidAdapter.js
@@ -103,7 +103,8 @@ export const spec = {
const bidRequests = [];
let referrer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referrer = bidderRequest.refererInfo.referer;
+ // TODO: is 'page' the right value here?
+ referrer = bidderRequest.refererInfo.page;
}
for (var i = 0; i < validBidRequests.length; i++) {
var index = Math.floor(Math.random() * validBidRequests[i].sizes.length);
diff --git a/modules/adheseBidAdapter.js b/modules/adheseBidAdapter.js
index 145b5605bc2..2d1426a2cda 100644
--- a/modules/adheseBidAdapter.js
+++ b/modules/adheseBidAdapter.js
@@ -26,7 +26,8 @@ export const spec = {
const adheseConfig = config.getConfig('adhese');
const gdprParams = (gdprConsent && gdprConsent.consentString) ? { xt: [gdprConsent.consentString] } : {};
- const refererParams = (refererInfo && refererInfo.referer) ? { xf: [base64urlEncode(refererInfo.referer)] } : {};
+ // TODO: is 'page' the right value here?
+ const refererParams = (refererInfo && refererInfo.page) ? { xf: [base64urlEncode(refererInfo.page)] } : {};
const globalCustomParams = (adheseConfig && adheseConfig.globalTargets) ? cleanTargets(adheseConfig.globalTargets) : {};
const commonParams = { ...globalCustomParams, ...gdprParams, ...refererParams };
const vastContentAsUrl = !(adheseConfig && adheseConfig.vastContentAsUrl == false);
diff --git a/modules/adkernelAdnAnalyticsAdapter.js b/modules/adkernelAdnAnalyticsAdapter.js
index de5d59ca6f8..d4aa3b035e0 100644
--- a/modules/adkernelAdnAnalyticsAdapter.js
+++ b/modules/adkernelAdnAnalyticsAdapter.js
@@ -381,6 +381,7 @@ export function ExpiringQueue(callback, ttl) {
}
}
+// TODO: this should reuse logic from refererDetection
function getNavigationInfo() {
try {
return getLocationAndReferrer(self.top);
diff --git a/modules/adkernelAdnBidAdapter.js b/modules/adkernelAdnBidAdapter.js
index 39f7b9fd2b2..4612310a9a4 100644
--- a/modules/adkernelAdnBidAdapter.js
+++ b/modules/adkernelAdnBidAdapter.js
@@ -1,4 +1,4 @@
-import { deepAccess, parseSizesInput, isArray, deepSetValue, parseUrl, isStr, isNumber, logInfo } from '../src/utils.js';
+import { deepAccess, parseSizesInput, isArray, deepSetValue, isStr, isNumber, logInfo } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
@@ -10,7 +10,7 @@ const DEFAULT_APIS = [1, 2];
const GVLID = 14;
function isRtbDebugEnabled(refInfo) {
- return refInfo.referer.indexOf('adk_debug=true') !== -1;
+ return refInfo.topmostLocation?.indexOf('adk_debug=true') !== -1;
}
function buildImp(bidRequest) {
@@ -83,13 +83,10 @@ function buildRequestParams(tags, bidderRequest) {
}
function buildSite(refInfo) {
- let loc = parseUrl(refInfo.referer);
- let result = {
- page: `${loc.protocol}://${loc.hostname}${loc.pathname}`,
- secure: ~~(loc.protocol === 'https')
- };
- if (self === top && document.referrer) {
- result.ref = document.referrer;
+ const result = {
+ page: refInfo.page,
+ secure: ~~(refInfo.page && refInfo.page.startsWith('https')),
+ ref: refInfo.ref
}
let keywords = document.getElementsByTagName('meta')['keywords'];
if (keywords && keywords.content) {
diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js
index c2d6ca4d4dd..da8633ba8d0 100644
--- a/modules/adkernelBidAdapter.js
+++ b/modules/adkernelBidAdapter.js
@@ -7,7 +7,6 @@ import {
deepSetValue,
getAdUnitSizes,
getDNT,
- inIframe,
isArray,
isArrayOfNums,
isEmpty,
@@ -15,8 +14,7 @@ import {
isPlainObject,
isStr,
mergeDeep,
- parseGPTSingleSizeArrayToRtbSize,
- parseUrl
+ parseGPTSingleSizeArrayToRtbSize
} from '../src/utils.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
@@ -226,7 +224,7 @@ registerBidder(spec);
* @param refererInfo {refererInfo}
*/
function groupImpressionsByHostZone(bidRequests, refererInfo) {
- let secure = (refererInfo && refererInfo.referer.indexOf('https:') === 0);
+ let secure = (refererInfo && refererInfo.page?.indexOf('https:') === 0);
return Object.values(
bidRequests.map(bidRequest => buildImp(bidRequest, secure))
.reduce((acc, curr, index) => {
@@ -506,7 +504,7 @@ function makeSyncInfo(bidderRequest) {
* @return {Object} Complete rtb request
*/
function buildRtbRequest(imps, bidderRequest, schain) {
- let fpd = config.getConfig('ortb2') || {};
+ let fpd = bidderRequest.ortb2 || {};
let req = mergeDeep(
makeBaseRequest(bidderRequest, imps, fpd),
@@ -535,14 +533,13 @@ function getLanguage() {
* Creates site description object
*/
function createSite(refInfo, fpd) {
- let url = parseUrl(refInfo.referer);
let site = {
- 'domain': url.hostname,
- 'page': `${url.protocol}://${url.hostname}${url.pathname}`
+ 'domain': refInfo.domain,
+ 'page': refInfo.page
};
mergeDeep(site, fpd.site);
- if (!inIframe() && document.referrer) {
- site.ref = document.referrer;
+ if (refInfo.ref != null) {
+ site.ref = refInfo.ref;
} else {
delete site.ref;
}
diff --git a/modules/adliveBidAdapter.md b/modules/adliveBidAdapter.md
deleted file mode 100644
index 4fc6a112e82..00000000000
--- a/modules/adliveBidAdapter.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Overview
-```
-Module Name: Adlive Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: traffic@adlive.io
-```
-
-# Description
-Module that connects to Adlive's server for bids.
-Currently module supports only banner mediaType.
-
-# Test Parameters
-```
- var adUnits = [{
- code: '/test/div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]]
- }
- },
- bids: [{
- bidder: 'adlive',
- params: {
- hashes: ['1e100887dd614b0909bf6c49ba7f69fdd1360437']
- }
- }]
- }];
-```
\ No newline at end of file
diff --git a/modules/adlooxAnalyticsAdapter.js b/modules/adlooxAnalyticsAdapter.js
index 095fb917597..a26a5e507e6 100644
--- a/modules/adlooxAnalyticsAdapter.js
+++ b/modules/adlooxAnalyticsAdapter.js
@@ -61,7 +61,7 @@ MACRO['creatype'] = function(b, c) {
};
MACRO['pageurl'] = function(b, c) {
const refererInfo = getRefererInfo();
- return (refererInfo.canonicalUrl || refererInfo.referer || '').substr(0, 300).split(/[?#]/)[0];
+ return (refererInfo.page || '').substr(0, 300).split(/[?#]/)[0];
};
MACRO['gpid'] = function(b, c) {
const adUnit = find(auctionManager.getAdUnits(), a => b.adUnitCode === a.code);
diff --git a/modules/adlooxRtdProvider.js b/modules/adlooxRtdProvider.js
index 489fadf91f4..8862ac8ac47 100644
--- a/modules/adlooxRtdProvider.js
+++ b/modules/adlooxRtdProvider.js
@@ -12,7 +12,6 @@
/* eslint prebid/validate-imports: "off" */
import {command as analyticsCommand, COMMAND} from './adlooxAnalyticsAdapter.js';
-import {config as _config} from '../src/config.js';
import {submodule} from '../src/hook.js';
import {ajax} from '../src/ajax.js';
import {getGlobal} from '../src/prebidGlobal.js';
@@ -229,9 +228,9 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
return config.params.thresholds.filter(t => t <= v);
}
- const ortb2 = _config.getConfig('ortb2') || {};
- const dataSite = _config.getConfig('ortb2.site.ext.data') || {};
- const dataUser = _config.getConfig('ortb2.user.ext.data') || {};
+ const ortb2 = reqBidsConfigObj.ortb2Fragments?.global || {};
+ const dataSite = deepAccess(ortb2, 'site.ext.data') || {};
+ const dataUser = deepAccess(ortb2, 'user.ext.data') || {};
_each(response, (v0, k0) => {
if (k0 == '_') return;
@@ -243,7 +242,7 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
deepSetValue(ortb2, 'site.ext.data', dataSite);
deepSetValue(ortb2, 'user.ext.data', dataUser);
- _config.setConfig({ ortb2 });
+ deepSetValue(reqBidsConfigObj, 'ortb2Fragments.global', ortb2);
adUnits.forEach((adUnit, i) => {
_each(response['_'][i], (v0, k0) => {
@@ -305,7 +304,7 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
[ 'imp', config.params.imps ],
[ 'fc_ip', config.params.freqcap_ip ],
[ 'fc_ipua', config.params.freqcap_ipua ],
- [ 'pn', (refererInfo.canonicalUrl || refererInfo.referer || '').substr(0, 300).split(/[?#]/)[0] ]
+ [ 'pn', (refererInfo.page || '').substr(0, 300).split(/[?#]/)[0] ]
];
if (!adUnits.length) {
@@ -363,7 +362,7 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
});
}
-function getTargetingData(adUnitArray, config, userConsent) {
+function getTargetingData(adUnitArray, config, userConsent, auction) {
function targetingNormalise(v) {
if (isArray(v) && v.length == 0) return undefined;
if (isBoolean(v)) v = ~~v;
@@ -371,10 +370,11 @@ function getTargetingData(adUnitArray, config, userConsent) {
return v;
}
- const dataSite = _config.getConfig(`ortb2.site.ext.data.${MODULE_NAME}_rtd`) || {};
+ const ortb2 = auction.getFPD().global || {};
+ const dataSite = deepAccess(ortb2, `site.ext.data.${MODULE_NAME}_rtd`) || {};
if (!dataSite.ok) return {};
- const dataUser = _config.getConfig(`ortb2.user.ext.data.${MODULE_NAME}_rtd`) || {};
+ const dataUser = deepAccess(ortb2, `user.ext.data.${MODULE_NAME}_rtd`) || {};
return getGlobal().adUnits.filter(adUnit => includes(adUnitArray, adUnit.code)).reduce((a, adUnit) => {
a[adUnit.code] = {};
diff --git a/modules/admanBidAdapter.js b/modules/admanBidAdapter.js
index 21bcb6cee26..4d47c4699ab 100644
--- a/modules/admanBidAdapter.js
+++ b/modules/admanBidAdapter.js
@@ -65,8 +65,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/admaticBidAdapter.md b/modules/admaticBidAdapter.md
deleted file mode 100644
index f6e822b9c06..00000000000
--- a/modules/admaticBidAdapter.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Overview
-
-```
-Module Name: AdMatic Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@admatic.com.tr
-```
-
-# Description
-
-Module that connects to AdMatic demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]], // a display size
- }
- },
- bids: [
- {
- bidder: "admatic",
- params: {
- pid: 193937152158, // publisher id without "adm-pub-" prefix
- wid: 104276324971, // website id
- priceType: 'gross', // default is net
- url: window.location.href || window.top.location.href //page url from js
- }
- }
- ]
- },{
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[320, 50]], // a mobile size
- }
- },
- bids: [
- {
- bidder: "admatic",
- params: {
- pid: 193937152158, // publisher id without "adm-pub-" prefix
- wid: 104276324971, // website id
- priceType: 'gross', // default is net
- url: window.location.href || window.top.location.href //page url from js
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/admediaBidAdapter.md b/modules/admediaBidAdapter.md
deleted file mode 100644
index a03a7b49529..00000000000
--- a/modules/admediaBidAdapter.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Overview
-
-```
-Module Name: Admedia Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: developers@admedia.com
-```
-
-# Description
-
-Admedia Bidder Adapter for Prebid.js.
-Only Banner format is supported.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div-0',
- sizes: [[300, 250]], // a display size
- bids: [
- {
- bidder: 'admedia',
- params: {
- aid: 86858
- }
- }
- ]
- },
- {
- code: 'test-div-1',
- sizes: [[300, 50]], // a mobile size
- bids: [
- {
- bidder: 'admedia',
- params: {
- aid: 86858
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/admixerBidAdapter.js b/modules/admixerBidAdapter.js
index dfb76a03804..b2f9c09aa84 100644
--- a/modules/admixerBidAdapter.js
+++ b/modules/admixerBidAdapter.js
@@ -32,15 +32,16 @@ export const spec = {
} while (w !== window.top);
const payload = {
imps: [],
- ortb2: config.getConfig('ortb2'),
+ ortb2: bidderRequest.ortb2,
docReferrer: docRef,
};
let endpointUrl;
if (bidderRequest) {
const {bidderCode} = bidderRequest;
endpointUrl = config.getConfig(`${bidderCode}.endpoint_url`);
- if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- payload.referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
+ // TODO: is 'page' the right value here?
+ if (bidderRequest.refererInfo?.page) {
+ payload.referrer = encodeURIComponent(bidderRequest.refererInfo.page);
}
if (bidderRequest.gdprConsent) {
payload.gdprConsent = {
diff --git a/modules/adnuntiusBidAdapter.js b/modules/adnuntiusBidAdapter.js
index 9e05ea664d8..fed69c48d18 100644
--- a/modules/adnuntiusBidAdapter.js
+++ b/modules/adnuntiusBidAdapter.js
@@ -55,7 +55,7 @@ export const spec = {
const bidRequests = {};
const requests = [];
const request = [];
- const ortb2 = config.getConfig('ortb2');
+ const ortb2 = bidderRequest.ortb2 || {};
const bidderConfig = config.getConfig();
const adnMeta = handleMeta()
@@ -81,7 +81,7 @@ export const spec = {
networks[network] = networks[network] || {};
networks[network].adUnits = networks[network].adUnits || [];
- if (bidderRequest && bidderRequest.refererInfo) networks[network].context = bidderRequest.refererInfo.referer;
+ if (bidderRequest && bidderRequest.refererInfo) networks[network].context = bidderRequest.refererInfo.page;
if (adnMeta) networks[network].metaData = adnMeta;
networks[network].adUnits.push({ ...targeting, auId: bid.params.auId, targetId: bid.bidId });
}
diff --git a/modules/adotBidAdapter.js b/modules/adotBidAdapter.js
index ac49f7ae32d..75dcef02b59 100644
--- a/modules/adotBidAdapter.js
+++ b/modules/adotBidAdapter.js
@@ -4,14 +4,13 @@ import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {isArray, isBoolean, isFn, isPlainObject, isStr, logError, replaceAuctionPrice} from '../src/utils.js';
import {find} from '../src/polyfill.js';
import {config} from '../src/config.js';
-import { OUTSTREAM } from '../src/video.js';
+import {OUTSTREAM} from '../src/video.js';
const BIDDER_CODE = 'adot';
const ADAPTER_VERSION = 'v2.0.0';
const BID_METHOD = 'POST';
const BIDDER_URL = 'https://dsp.adotmob.com/headerbidding{PUBLISHER_PATH}/bidrequest';
const REQUIRED_VIDEO_PARAMS = ['mimes', 'protocols'];
-const DOMAIN_REGEX = new RegExp('//([^/]*)');
const FIRST_PRICE = 1;
const IMP_BUILDER = { banner: buildBanner, video: buildVideo, native: buildNative };
const NATIVE_PLACEMENTS = {
@@ -43,19 +42,6 @@ function tryParse(data) {
}
}
-/**
- * Extract domain from given url
- *
- * @param {string} url
- * @returns {string|null} Extracted domain
- */
-function extractDomainFromURL(url) {
- if (!url || !isStr(url)) return null;
- const domain = url.match(DOMAIN_REGEX);
- if (isArray(domain) && domain.length === 2) return domain[1];
- return null;
-}
-
/**
* Create and return site OpenRtb object from given bidderRequest
*
@@ -65,13 +51,13 @@ function extractDomainFromURL(url) {
function getOpenRTBSiteObject(bidderRequest) {
if (!bidderRequest || !bidderRequest.refererInfo) return null;
- const domain = extractDomainFromURL(bidderRequest.refererInfo.referer);
+ const domain = bidderRequest.refererInfo.domain;
const publisherId = config.getConfig('adot.publisherId');
if (!domain) return null;
return {
- page: bidderRequest.refererInfo.referer,
+ page: bidderRequest.refererInfo.page,
domain: domain,
name: domain,
publisher: {
diff --git a/modules/adpartnerBidAdapter.js b/modules/adpartnerBidAdapter.js
index e8d8a43aa1b..471a0bba64a 100644
--- a/modules/adpartnerBidAdapter.js
+++ b/modules/adpartnerBidAdapter.js
@@ -15,12 +15,8 @@ export const spec = {
},
buildRequests: function (validBidRequests, bidderRequest) {
- let referer = window.location.href;
- try {
- referer = typeof bidderRequest.refererInfo === 'undefined'
- ? window.top.location.href
- : bidderRequest.refererInfo.referer;
- } catch (e) {}
+ // TODO does it make sense to fall back to window.location.href?
+ const referer = bidderRequest?.refererInfo?.page || window.location.href;
let bidRequests = [];
let beaconParams = {
diff --git a/modules/adplusBidAdapter.js b/modules/adplusBidAdapter.js
index 4707ca2ff5a..6fbe1fe1dde 100644
--- a/modules/adplusBidAdapter.js
+++ b/modules/adplusBidAdapter.js
@@ -127,6 +127,7 @@ function createBidRequest(bid) {
screenWidth: screen.width,
screenHeight: screen.height,
language: window.navigator.language || 'en-US',
+ // TODO: these should probably look at refererInfo
pageUrl: window.location.href,
domain: window.location.hostname,
referrer: window.location.referrer,
diff --git a/modules/adprimeBidAdapter.js b/modules/adprimeBidAdapter.js
index d64874c393e..4b53c8441ef 100644
--- a/modules/adprimeBidAdapter.js
+++ b/modules/adprimeBidAdapter.js
@@ -52,8 +52,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/adrelevantisBidAdapter.js b/modules/adrelevantisBidAdapter.js
index 3d4de7c7b9d..3a68513cde2 100644
--- a/modules/adrelevantisBidAdapter.js
+++ b/modules/adrelevantisBidAdapter.js
@@ -127,7 +127,8 @@ export const spec = {
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: this sends everything it finds to the backend, except for canonicalUrl
+ rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
@@ -135,13 +136,12 @@ export const spec = {
payload.referrer_detection = refererinfo;
}
- let fpdcfg = config.getLegacyFpd(config.getConfig('ortb2'));
- if (fpdcfg && fpdcfg.context) {
- let fdata = {
- keywords: fpdcfg.context.keywords || '',
- category: fpdcfg.context.data.category || ''
+ const ortb2Site = bidderRequest.ortb2?.site;
+ if (ortb2Site) {
+ payload.fpd = {
+ keywords: ortb2Site.keywords || '',
+ category: deepAccess(ortb2Site, 'ext.data.category') || ''
}
- payload.fpd = fdata;
}
const request = formatRequest(payload, bidderRequest);
@@ -445,6 +445,13 @@ function bidToTag(bid) {
tag.disable_psa = true;
if (bid.params.position) {
tag.position = {'above': 1, 'below': 2}[bid.params.position] || 0;
+ } else {
+ let mediaTypePos = deepAccess(bid, `mediaTypes.banner.pos`) || deepAccess(bid, `mediaTypes.video.pos`);
+ // only support unknown, atf, and btf values for position at this time
+ if (mediaTypePos === 0 || mediaTypePos === 1 || mediaTypePos === 3) {
+ // ortb spec treats btf === 3, but our system interprets btf === 2; so converting the ortb value here for consistency
+ tag.position = (mediaTypePos === 3) ? 2 : mediaTypePos;
+ }
}
if (bid.params.trafficSourceCode) {
tag.traffic_source_code = bid.params.trafficSourceCode;
diff --git a/modules/adrinoBidAdapter.js b/modules/adrinoBidAdapter.js
index 4520066c3e7..ed898c46cac 100644
--- a/modules/adrinoBidAdapter.js
+++ b/modules/adrinoBidAdapter.js
@@ -30,7 +30,8 @@ export const spec = {
bidId: validBidRequests[i].bidId,
nativeParams: validBidRequests[i].nativeParams,
placementHash: validBidRequests[i].params.hash,
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: bidderRequest.refererInfo.page,
userAgent: navigator.userAgent,
}
diff --git a/modules/adspendBidAdapter.md b/modules/adspendBidAdapter.md
deleted file mode 100644
index dc3409b0057..00000000000
--- a/modules/adspendBidAdapter.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Overview
-
-```
-Module Name: AdSpend Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: gaffoonster@gmail.com
-```
-
-# Description
-
-Connects to AdSpend bidder.
-AdSpend adapter supports only Banner at the moment. Video and Native will be add soon.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner
- {
- code: 'div-gpt-ad-1460505748561-0',
- mediaTypes: {
- banner: {
- // You can choose one of them
- sizes: [
- [300, 250],
- [300, 600],
- [240, 400],
- [728, 90],
- ]
- }
- },
- bids: [
- {
- bidder: "adspend",
- params: {
- bidfloor: 1,
- placement: 'test',
- tagId: 'test-ad',
- }
- }
- ]
- }
-];
-
-pbjs.que.push(() => {
- pbjs.setConfig({
- userSync: {
- syncEnabled: true,
- enabledBidders: ['adspend'],
- pixelEnabled: true,
- syncsPerBidder: 200,
- syncDelay: 100,
- },
- currency: {
- adServerCurrency: 'RUB' // We work only with rubles for now
- }
- });
-});
-```
-
-**It's a test banner, so you'll see some errors in console cause it will be trying to call our system's events.**
diff --git a/modules/adspiritBidAdapter.md b/modules/adspiritBidAdapter.md
deleted file mode 100644
index 688d0814882..00000000000
--- a/modules/adspiritBidAdapter.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Overview
-
-**Module Name**: AdSpirit Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: prebid@adspirit.de
-
-# Description
-
-Module that connects to an AdSpirit zone to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'display-div',
- sizes: [[300, 250]], // a display size
- bids: [
- {
- bidder: "adspirit",
- params: {
- placementId: '5',
- host: 'n1test.adspirit.de'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/adtargetBidAdapter.js b/modules/adtargetBidAdapter.js
index a07b0de0f67..c4f2bc65655 100644
--- a/modules/adtargetBidAdapter.js
+++ b/modules/adtargetBidAdapter.js
@@ -117,7 +117,8 @@ function parseResponse(serverResponse, adapterRequest) {
function bidToTag(bidRequests, adapterRequest) {
const tag = {
- Domain: deepAccess(adapterRequest, 'refererInfo.referer')
+ // TODO: is 'page' the right value here?
+ Domain: deepAccess(adapterRequest, 'refererInfo.page')
};
if (config.getConfig('coppa') === true) {
tag.Coppa = 1;
diff --git a/modules/adtelligentBidAdapter.js b/modules/adtelligentBidAdapter.js
index 13174ff337c..5269b1224c1 100644
--- a/modules/adtelligentBidAdapter.js
+++ b/modules/adtelligentBidAdapter.js
@@ -160,7 +160,8 @@ function parseRTBResponse(serverResponse, adapterRequest) {
function bidToTag(bidRequests, adapterRequest) {
// start publisher env
const tag = {
- Domain: deepAccess(adapterRequest, 'refererInfo.referer')
+ // TODO: is 'page' the right value here?
+ Domain: deepAccess(adapterRequest, 'refererInfo.page')
};
if (config.getConfig('coppa') === true) {
tag.Coppa = 1;
diff --git a/modules/adtrueBidAdapter.js b/modules/adtrueBidAdapter.js
index 283e1273150..b8cdb1f99aa 100644
--- a/modules/adtrueBidAdapter.js
+++ b/modules/adtrueBidAdapter.js
@@ -133,8 +133,9 @@ function _parseAdSlot(bid) {
function _initConf(refererInfo) {
return {
- pageURL: (refererInfo && refererInfo.referer) ? refererInfo.referer : window.location.href,
- refURL: window.document.referrer
+ // TODO: do the fallbacks make sense here?
+ pageURL: refererInfo?.page || window.location.href,
+ refURL: refererInfo?.ref || window.document.referrer
};
}
diff --git a/modules/aduptechBidAdapter.js b/modules/aduptechBidAdapter.js
index 1186e0410ab..8b45d19a022 100644
--- a/modules/aduptechBidAdapter.js
+++ b/modules/aduptechBidAdapter.js
@@ -1,7 +1,6 @@
-import { deepAccess, getWindowTop, getWindowSelf, getAdUnitSizes } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { BANNER, NATIVE } from '../src/mediaTypes.js'
+import {deepAccess, getAdUnitSizes} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {BANNER, NATIVE} from '../src/mediaTypes.js';
export const BIDDER_CODE = 'aduptech';
export const ENDPOINT_URL_PUBLISHER_PLACEHOLDER = '{PUBLISHER}';
@@ -37,19 +36,8 @@ export const internal = {
* @returns {string}
*/
extractPageUrl: (bidderRequest) => {
- if (bidderRequest && deepAccess(bidderRequest, 'refererInfo.canonicalUrl')) {
- return bidderRequest.refererInfo.canonicalUrl;
- }
-
- if (config && config.getConfig('pageUrl')) {
- return config.getConfig('pageUrl');
- }
-
- try {
- return getWindowTop().location.href;
- } catch (e) {
- return getWindowSelf().location.href;
- }
+ // TODO: does it make sense to fall back here?
+ return bidderRequest?.refererInfo?.page || window.location.href;
},
/**
@@ -59,15 +47,8 @@ export const internal = {
* @returns {string}
*/
extractReferrer: (bidderRequest) => {
- if (bidderRequest && deepAccess(bidderRequest, 'refererInfo.referer')) {
- return bidderRequest.refererInfo.referer;
- }
-
- try {
- return getWindowTop().document.referrer;
- } catch (e) {
- return getWindowSelf().document.referrer;
- }
+ // TODO: does it make sense to fall back here?
+ return bidderRequest?.refererInfo?.ref || window.document.referrer;
},
/**
diff --git a/modules/advangelistsBidAdapter.js b/modules/advangelistsBidAdapter.js
index 605e19cfc66..4963150caed 100755
--- a/modules/advangelistsBidAdapter.js
+++ b/modules/advangelistsBidAdapter.js
@@ -1,5 +1,4 @@
import {deepAccess, generateUUID, isEmpty, isFn, parseSizesInput, parseUrl} from '../src/utils.js';
-import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {find, includes} from '../src/polyfill.js';
@@ -200,12 +199,8 @@ function getBannerSizes(bid) {
return parseSizes(deepAccess(bid, 'mediaTypes.banner.sizes') || bid.sizes);
}
-function getTopWindowReferrer() {
- try {
- return window.top.document.referrer;
- } catch (e) {
- return '';
- }
+function getTopWindowReferrer(bidderRequest) {
+ return bidderRequest?.refererInfo?.ref || '';
}
function getVideoTargetingParams(bid) {
@@ -226,7 +221,7 @@ function getVideoTargetingParams(bid) {
function createVideoRequestData(bid, bidderRequest) {
let topLocation = getTopWindowLocation(bidderRequest);
- let topReferrer = getTopWindowReferrer();
+ let topReferrer = getTopWindowReferrer(bidderRequest);
let sizes = getVideoSizes(bid);
let firstSize = getFirstSize(sizes);
@@ -309,13 +304,12 @@ function createVideoRequestData(bid, bidderRequest) {
}
function getTopWindowLocation(bidderRequest) {
- let url = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
- return parseUrl(config.getConfig('pageUrl') || url, { decodeSearchAsString: true });
+ return parseUrl(bidderRequest?.refererInfo?.page, {decodeSearchAsString: true});
}
function createBannerRequestData(bid, bidderRequest) {
let topLocation = getTopWindowLocation(bidderRequest);
- let topReferrer = getTopWindowReferrer();
+ let topReferrer = getTopWindowReferrer(bidderRequest);
let sizes = getBannerSizes(bid);
let bidfloor = (getBannerBidFloor(bid) == null || typeof getBannerBidFloor(bid) == 'undefined') ? 2 : getBannerBidFloor(bid);
diff --git a/modules/advenueBidAdapter.md b/modules/advenueBidAdapter.md
deleted file mode 100644
index ec5287330db..00000000000
--- a/modules/advenueBidAdapter.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Overview
-
-```
-Module Name: Advenue SSP Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: dev.advenue@gmail.com
-```
-
-# Description
-
-Module that connects to Advenue SSP demand sources
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'placementCode',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'advenue',
- params: {
- placementId: 0,
- traffic: 'banner'
- }
- }]
- }
- ];
-```
diff --git a/modules/advertlyBidAdapter.md b/modules/advertlyBidAdapter.md
deleted file mode 100755
index b6cc3bfe71d..00000000000
--- a/modules/advertlyBidAdapter.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Overview
-
-```
-Module Name: Advertly Bid Adapter
-Module Type: Bidder Adapter
-Maintainer : support@advertly.com
-```
-
-# Description
-
-Connects to Advertly Ad Server for bids.
-
-advertly bid adapter supports Banner and Video.
-
-# Test Parameters
-```
- var adUnits = [
- //bannner object
- {
- code: 'banner-ad-slot',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [{
- bidder: 'advertly',
- params: {
- publisherId: 2
- }
- }]
-
- },
- //video object
- {
- code: 'video-ad-slot',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480],
- },
- },
- bids: [{
- bidder: "advertly",
- params: {
- publisherId: 2
- }
- }]
- }];
-```
diff --git a/modules/adxcgBidAdapter.js b/modules/adxcgBidAdapter.js
index 81872100cd1..9cfbc91b48b 100644
--- a/modules/adxcgBidAdapter.js
+++ b/modules/adxcgBidAdapter.js
@@ -2,19 +2,19 @@
'use strict';
import {registerBidder} from '../src/adapters/bidderFactory.js';
-import {NATIVE, BANNER, VIDEO} from '../src/mediaTypes.js';
+import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {
- mergeDeep,
_map,
deepAccess,
- getDNT,
- parseSizesInput,
deepSetValue,
- isStr,
+ getDNT,
isArray,
isPlainObject,
- parseUrl,
- replaceAuctionPrice, triggerPixel
+ isStr,
+ mergeDeep,
+ parseSizesInput,
+ replaceAuctionPrice,
+ triggerPixel
} from '../src/utils.js';
import {config} from '../src/config.js';
@@ -67,7 +67,7 @@ export const spec = {
buildRequests: (validBidRequests, bidderRequest) => {
let app, site;
- const commonFpd = getConfig('ortb2') || {};
+ const commonFpd = bidderRequest.ortb2 || {};
let { user } = commonFpd;
if (typeof getConfig('app') === 'object') {
@@ -82,8 +82,8 @@ export const spec = {
}
if (!site.page) {
- site.page = bidderRequest.refererInfo.referer;
- site.domain = parseUrl(bidderRequest.refererInfo.referer).hostname;
+ site.page = bidderRequest.refererInfo.page;
+ site.domain = bidderRequest.refererInfo.domain;
}
}
diff --git a/modules/adxpremiumAnalyticsAdapter.js b/modules/adxpremiumAnalyticsAdapter.js
index 9066c26fb00..f87cbdc37bf 100644
--- a/modules/adxpremiumAnalyticsAdapter.js
+++ b/modules/adxpremiumAnalyticsAdapter.js
@@ -95,7 +95,8 @@ function auctionInit(args) {
completeObject.auction_id = args.auctionId;
completeObject.publisher_id = adxpremiumAnalyticsAdapter.initOptions.pubId;
- try { completeObject.referer = encodeURI(args.bidderRequests[0].refererInfo.referer.split('?')[0]); } catch (e) { logError('AdxPremium Analytics - ' + e.message); }
+ // TODO: is 'page' the right value here?
+ try { completeObject.referer = encodeURI(args.bidderRequests[0].refererInfo.page.split('?')[0]); } catch (e) { logError('AdxPremium Analytics - ' + e.message); }
if (args.adUnitCodes && args.adUnitCodes.length > 0) {
elementIds = args.adUnitCodes;
}
diff --git a/modules/adyoulikeBidAdapter.js b/modules/adyoulikeBidAdapter.js
index 784afd6cfe1..5b3e885f2ed 100644
--- a/modules/adyoulikeBidAdapter.js
+++ b/modules/adyoulikeBidAdapter.js
@@ -1,6 +1,5 @@
import {buildUrl, deepAccess, parseSizesInput} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
-import {config} from '../src/config.js';
import {createEidsArray} from './userId/eids.js';
import {find} from '../src/polyfill.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
@@ -168,23 +167,6 @@ function getHostname(bidderRequest) {
return '';
}
-/* Get current page canonical url */
-function getCanonicalUrl() {
- let link;
- if (window.self !== window.top) {
- try {
- link = window.top.document.head.querySelector('link[rel="canonical"][href]');
- } catch (e) { }
- } else {
- link = document.head.querySelector('link[rel="canonical"][href]');
- }
-
- if (link) {
- return link.href;
- }
- return '';
-}
-
/* Get mediatype from bidRequest */
function getMediatype(bidRequest) {
if (deepAccess(bidRequest, 'mediaTypes.banner')) {
@@ -239,20 +221,21 @@ function createEndpointQS(bidderRequest) {
if (bidderRequest) {
const ref = bidderRequest.refererInfo;
- if (ref) {
- qs.RefererUrl = encodeURIComponent(ref.referer);
+ if (ref?.location) {
+ // TODO: is 'location' the right value here?
+ qs.RefererUrl = encodeURIComponent(ref.location);
if (ref.numIframes > 0) {
qs.SafeFrame = true;
}
}
}
- const can = getCanonicalUrl();
+ const can = bidderRequest?.refererInfo?.canonicalUrl;
if (can) {
qs.CanonicalUrl = encodeURIComponent(can);
}
- const domain = config.getConfig('publisherDomain');
+ const domain = bidderRequest?.refererInfo?.domain;
if (domain) {
qs.PublisherDomain = encodeURIComponent(domain);
}
diff --git a/modules/afpBidAdapter.js b/modules/afpBidAdapter.js
index 6565942bcc8..f690b70973d 100644
--- a/modules/afpBidAdapter.js
+++ b/modules/afpBidAdapter.js
@@ -7,6 +7,7 @@ export const IS_DEV = location.hostname === 'localhost'
export const BIDDER_CODE = 'afp'
export const SSP_ENDPOINT = 'https://ssp.afp.ai/api/prebid'
export const REQUEST_METHOD = 'POST'
+// TODO: test code should be kept in tests
export const TEST_PAGE_URL = 'https://rtbinsight.ru/smiert-bolshikh-dannykh-kto-na-novienkogo/'
const SDK_PATH = 'https://cdn.afp.ai/ssp/sdk.js?auto_initialization=false&deploy_to_parent_window=true'
const TTL = 60
@@ -96,7 +97,7 @@ export const spec = {
},
buildRequests(validBidRequests, {refererInfo, gdprConsent}) {
const payload = {
- pageUrl: IS_DEV ? TEST_PAGE_URL : refererInfo.referer,
+ pageUrl: IS_DEV ? TEST_PAGE_URL : refererInfo.page,
gdprConsent: gdprConsent,
bidRequests: validBidRequests.map(validBidRequest => {
const {bidId, transactionId, sizes, params: {
diff --git a/modules/airgridRtdProvider.js b/modules/airgridRtdProvider.js
index e9011343a74..3578cc4b87e 100644
--- a/modules/airgridRtdProvider.js
+++ b/modules/airgridRtdProvider.js
@@ -9,7 +9,6 @@ import { config } from '../src/config.js';
import { submodule } from '../src/hook.js';
import {
mergeDeep,
- isPlainObject,
deepSetValue,
deepAccess,
} from '../src/utils.js';
@@ -84,25 +83,15 @@ function setAudiencesToAppNexusAdUnits(adUnits, audiences) {
* Pass audience data to configured bidders, using ORTB2
* @param {Object} rtdConfig
* @param {Array} audiences
- * @return {void}
+ * @return {{}} a map from bidder code to ORTB2 config
*/
-export function setAudiencesUsingBidderOrtb2(rtdConfig, audiences) {
+export function getAudiencesAsBidderOrtb2(rtdConfig, audiences) {
const bidders = deepAccess(rtdConfig, 'params.bidders');
- if (!bidders || bidders.length === 0) return;
- const allBiddersConfig = config.getBidderConfig();
- const agOrtb2 = {};
+ if (!bidders || bidders.length === 0) return {};
+ const agOrtb2 = {}
deepSetValue(agOrtb2, 'ortb2.user.ext.data.airgrid', audiences || []);
- bidders.forEach((bidder) => {
- let bidderConfig = {};
- if (isPlainObject(allBiddersConfig[bidder])) {
- bidderConfig = allBiddersConfig[bidder];
- }
- config.setBidderConfig({
- bidders: [bidder],
- config: mergeDeep(bidderConfig, agOrtb2),
- });
- });
+ return Object.fromEntries(bidders.map(bidder => [bidder, agOrtb2]));
}
export function setAudiencesUsingAppNexusAuctionKeywords(audiences) {
@@ -142,7 +131,7 @@ export function passAudiencesToBidders(
const audiences = getMatchedAudiencesFromStorage();
if (audiences.length > 0) {
setAudiencesUsingAppNexusAuctionKeywords(audiences);
- setAudiencesUsingBidderOrtb2(rtdConfig, audiences);
+ mergeDeep(bidConfig?.ortb2Fragments?.bidder, getAudiencesAsBidderOrtb2(rtdConfig, audiences));
if (adUnits) {
setAudiencesToAppNexusAdUnits(adUnits, audiences);
}
diff --git a/modules/ajaBidAdapter.js b/modules/ajaBidAdapter.js
index a9364a7a05f..5991439740f 100644
--- a/modules/ajaBidAdapter.js
+++ b/modules/ajaBidAdapter.js
@@ -36,7 +36,7 @@ export const spec = {
*/
buildRequests: function(validBidRequests, bidderRequest) {
const bidRequests = [];
- const pageUrl = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) || undefined;
+ const pageUrl = bidderRequest?.refererInfo?.page || undefined;
for (let i = 0, len = validBidRequests.length; i < len; i++) {
const bidRequest = validBidRequests[i];
diff --git a/modules/akamaiDAPIdSystem.js b/modules/akamaiDAPIdSystem.js
deleted file mode 100644
index 5e3a607d5fd..00000000000
--- a/modules/akamaiDAPIdSystem.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * This module adds DAP to the User ID module
- * The {@link module:modules/userId} module is required
- * @module modules/akamaiDAPIdSubmodule
- * @requires module:modules/userId
- */
-
-import { logMessage, logError } from '../src/utils.js';
-import { ajax } from '../src/ajax.js';
-import { submodule } from '../src/hook.js';
-import { getStorageManager } from '../src/storageManager.js';
-import { uspDataHandler } from '../src/adapterManager.js';
-
-const MODULE_NAME = 'akamaiDAPId';
-const STORAGE_KEY = 'akamai_dap_token';
-
-export const storage = getStorageManager();
-
-/** @type {Submodule} */
-export const akamaiDAPIdSubmodule = {
- /**
- * used to link submodule with config
- * @type {string}
- */
- name: MODULE_NAME,
- /**
- * decode the stored id value for passing to bid requests
- * @function
- * @returns {{dapId:string}}
- */
- decode(value) {
- logMessage('akamaiDAPId [decode] value=', value);
- return { dapId: value };
- },
-
- /**
- * performs action to obtain id and return a value in the callback's response argument
- * @function
- * @param {ConsentData} [consentData]
- * @param {SubmoduleConfig} [config]
- * @returns {IdResponse|undefined}
- */
- getId(config, consentData) {
- const configParams = (config && config.params);
- if (!configParams) {
- logError('User ID - akamaiDAPId submodule requires a valid configParams');
- return;
- } else if (typeof configParams.apiHostname !== 'string') {
- logError('User ID - akamaiDAPId submodule requires a valid configParams.apiHostname');
- return;
- } else if (typeof configParams.domain !== 'string') {
- logError('User ID - akamaiDAPId submodule requires a valid configParams.domain');
- return;
- } else if (typeof configParams.type !== 'string') {
- logError('User ID - akamaiDAPId submodule requires a valid configParams.type');
- return;
- }
- const hasGdpr = (consentData && typeof consentData.gdprApplies === 'boolean' && consentData.gdprApplies) ? 1 : 0;
- const gdprConsentString = hasGdpr ? consentData.consentString : '';
- const uspConsent = uspDataHandler.getConsentData();
- if (hasGdpr && (!gdprConsentString || gdprConsentString === '')) {
- logError('User ID - akamaiDAPId submodule requires consent string to call API');
- return;
- }
- // XXX: retrieve first-party data here if needed
- let url = '';
- let postData;
- let tokenName = '';
- if (configParams.apiVersion === 'v1') {
- if (configParams.type.indexOf('dap-signature:') == 0) {
- let parts = configParams.type.split(':');
- let v = parts[1];
- url = `https://${configParams.apiHostname}/data-activation/v1/domain/${configParams.domain}/signature?v=${v}&gdpr=${hasGdpr}&gdpr_consent=${gdprConsentString}&us_privacy=${uspConsent}`;
- tokenName = 'SigToken';
- } else {
- url = `https://${configParams.apiHostname}/data-activation/v1/identity/tokenize?gdpr=${hasGdpr}&gdpr_consent=${gdprConsentString}&us_privacy=${uspConsent}`;
- postData = {
- 'version': 1,
- 'domain': configParams.domain,
- 'identity': configParams.identity,
- 'type': configParams.type
- };
- tokenName = 'PubToken';
- }
- } else {
- url = `https://${configParams.apiHostname}/data-activation/x1/domain/${configParams.domain}/identity/tokenize?gdpr=${hasGdpr}&gdpr_consent=${gdprConsentString}&us_privacy=${uspConsent}`;
- postData = {
- 'version': configParams.apiVersion,
- 'identity': configParams.identity,
- 'type': configParams.type,
- 'attributes': configParams.attributes
- };
- tokenName = 'x1Token';
- }
-
- let cb = {
- success: (response, request) => {
- var token = (response === '') ? request.getResponseHeader('Akamai-DAP-Token') : response;
- storage.setDataInLocalStorage(STORAGE_KEY, token);
- },
- error: error => {
- logError('akamaiDAPId [getId:ajax.error] failed to retrieve ' + tokenName, error);
- }
- };
-
- ajax(url, cb, JSON.stringify(postData), { contentType: 'application/json' });
-
- let token = storage.getDataFromLocalStorage(STORAGE_KEY);
- logMessage('akamaiDAPId [getId] returning', token);
-
- return { id: token };
- }
-};
-
-submodule('userId', akamaiDAPIdSubmodule);
diff --git a/modules/akamaiDAPIdSystem.md b/modules/akamaiDAPIdSystem.md
deleted file mode 100644
index 9b35709c3f2..00000000000
--- a/modules/akamaiDAPIdSystem.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# Akamai Data Activation Platform Audience Segment ID Targeting
-
-The Akamai Data Activation Platform (DAP) is a privacy-first system that protects end-user privacy by only allowing them to be targeted as part of a larger cohort. DAP views hiding individuals in large cohorts as the best mechanism to prevent unauthorized tracking.
-
-The integration of DAP into Prebid.JS consists of creating a UserID plugin that interacts with the DAP API. The UserID module tokenizes the end-user identity into an ephemeral, secure pseudonymization called a dapId. The dapId is then supplied to the bid-stream where the SSP partner looks up cohort membership for that token, and supplies the cohorts to the rest of the bid-stream.
-
-In this system, no end-user identifier is supplied to the bid-stream, only cohorts. This is a foundational privacy principle DAP is built upon.
-
-## Onboarding
-
-Please reach out to your Akamai account representative(Prebid@akamai.com) to get provisioned on the DAP platform.
-
-## DAP Configuration
-
-First, make sure to add the DAP submodule to your Prebid.js package with:
-
-```
-gulp build --modules=akamaiDAPIdSystem,userId
-```
-
-The following configuration parameters are available:
-
-```javascript
-pbjs.setConfig({
- userSync: {
- userIds: [{
- name: 'akamaiDAPId',
- params: {
- apiHostname: '',
- domain: 'your-domain.com',
- type: 'email' | 'mobile' | ... | 'dap-signature:1.0.0',
- identity: ‘your@email.com’ | ‘6175551234' | ...',
- apiVersion: 'v1' | 'x1',
- attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "...","last_name": "..." }'
- },
- }],
- auctionDelay: 50 // 50ms maximum auction delay, applies to all userId modules
- }
-});
-```
-
-In order to make use of v1 APIs, "apiVersion" needs to explicitly mentioned as 'v1'. The "apiVersion" defaults to x1 if not specified.
-"attributes" can be configured in x1 API only and not v1 APIs. Please ensure that the "attributes" value is in same format as shown above.
-
-Refer to the sample integration example present at below location
-Prebid.js/integrationExamples/gpt/akamaidap_email_example.html
-Prebid.js/integrationExamples/gpt/akamaidap_signature_example.html
-Prebid.js/integrationExamples/gpt/akamaidap_x1_example.html
diff --git a/modules/akamaiDapRtdProvider.js b/modules/akamaiDapRtdProvider.js
index 845c0f2e574..f167cb7f3ea 100644
--- a/modules/akamaiDapRtdProvider.js
+++ b/modules/akamaiDapRtdProvider.js
@@ -6,7 +6,6 @@
* @requires module:modules/realTimeData
*/
import {ajax} from '../src/ajax.js';
-import {config} from '../src/config.js';
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import {isPlainObject, mergeDeep, logMessage, logInfo, logError} from '../src/utils.js';
@@ -44,17 +43,16 @@ function mergeLazy(target, source) {
/**
* Add real-time data & merge segments.
- * @param {Object} bidConfig
+ * @param {Object} ortb2 destionation object to merge RTD into
* @param {Object} rtd
* @param {Object} rtdConfig
*/
-export function addRealTimeData(rtd) {
+export function addRealTimeData(ortb2, rtd) {
logInfo('DEBUG(addRealTimeData) - ENTER');
if (isPlainObject(rtd.ortb2)) {
- let ortb2 = config.getConfig('ortb2') || {};
logMessage('DEBUG(addRealTimeData): merging original: ', ortb2);
logMessage('DEBUG(addRealTimeData): merging in: ', rtd.ortb2);
- config.setConfig({ortb2: mergeLazy(ortb2, rtd.ortb2)});
+ mergeLazy(ortb2, rtd.ortb2);
}
logInfo('DEBUG(addRealTimeData) - EXIT');
}
@@ -117,7 +115,7 @@ export function generateRealTimeData(bidConfig, onDone, rtdConfig, userConsent)
}
if (jsonData) {
if (jsonData.rtd) {
- addRealTimeData(jsonData.rtd);
+ addRealTimeData(bidConfig.ortb2Fragments?.global, jsonData.rtd);
onDone();
logInfo('DEBUG(generateRealTimeData) - 1');
// Don't return - ensure the data is always fresh.
@@ -161,17 +159,18 @@ export const dapUtils = {
};
let refreshMembership = true;
let token = dapUtils.dapGetTokenFromLocalStorage();
+ const ortb2 = bidConfig.ortb2Fragments.global;
logMessage('token is: ', token);
if (token !== null) { // If token is not null then check the membership in storage and add the RTD object
if (config.segtax == 504) { // Follow the encrypted membership path
- dapUtils.dapRefreshEncryptedMembership(config, token, onDone) // Get the encrypted membership from server
+ dapUtils.dapRefreshEncryptedMembership(ortb2, config, token, onDone) // Get the encrypted membership from server
refreshMembership = false;
} else {
- dapUtils.dapRefreshMembership(config, token, onDone) // Get the membership from server
+ dapUtils.dapRefreshMembership(ortb2, config, token, onDone) // Get the membership from server
refreshMembership = false;
}
}
- dapUtils.dapRefreshToken(config, refreshMembership, onDone) // Refresh Token and membership in all the cases
+ dapUtils.dapRefreshToken(ortb2, config, refreshMembership, onDone) // Refresh Token and membership in all the cases
}
},
dapGetEntropy: function(resolve, reject) {
@@ -194,7 +193,7 @@ export const dapUtils = {
return token;
},
- dapRefreshToken: function(config, refreshMembership, onDone) {
+ dapRefreshToken: function(ortb2, config, refreshMembership, onDone) {
dapUtils.dapLog('Token missing or expired, fetching a new one...');
// Trigger a refresh
let now = Math.round(Date.now() / 1000.0); // in seconds
@@ -221,9 +220,9 @@ export const dapUtils = {
}
if (refreshMembership) {
if (config.segtax == 504) {
- dapUtils.dapRefreshEncryptedMembership(config, token, onDone);
+ dapUtils.dapRefreshEncryptedMembership(ortb2, config, token, onDone);
} else {
- dapUtils.dapRefreshMembership(config, token, onDone);
+ dapUtils.dapRefreshMembership(ortb2, config, token, onDone);
}
}
},
@@ -250,7 +249,7 @@ export const dapUtils = {
return membership;
},
- dapRefreshMembership: function(config, token, onDone) {
+ dapRefreshMembership: function(ortb2, config, token, onDone) {
let now = Math.round(Date.now() / 1000.0); // in seconds
let item = {}
let configAsync = {...config};
@@ -268,14 +267,14 @@ export const dapUtils = {
dapUtils.dapLog(item);
let data = dapUtils.dapGetRtdObj(item, config.segtax)
- dapUtils.checkAndAddRealtimeData(data, config.segtax);
+ dapUtils.checkAndAddRealtimeData(ortb2, data, config.segtax);
onDone();
},
function(xhr, status, error, onDone) {
logError('ERROR(' + error + '): failed to retrieve membership! ' + status);
if (status == 403 && dapRetryTokenize < DAP_MAX_RETRY_TOKENIZE) {
dapRetryTokenize++;
- dapUtils.dapRefreshToken(config, true, onDone);
+ dapUtils.dapRefreshToken(ortb2, config, true, onDone);
} else {
onDone();
}
@@ -297,7 +296,7 @@ export const dapUtils = {
return encMembership;
},
- dapRefreshEncryptedMembership: function(config, token, onDone) {
+ dapRefreshEncryptedMembership: function(ortb2, config, token, onDone) {
let now = Math.round(Date.now() / 1000.0); // in seconds
let item = {};
let configAsync = {...config};
@@ -314,14 +313,14 @@ export const dapUtils = {
dapUtils.dapLog(item);
let encData = dapUtils.dapGetEncryptedRtdObj(item, config.segtax);
- dapUtils.checkAndAddRealtimeData(encData, config.segtax);
+ dapUtils.checkAndAddRealtimeData(ortb2, encData, config.segtax);
onDone();
},
function(xhr, status, error, onDone) {
logError('ERROR(' + error + '): failed to retrieve encrypted membership! ' + status);
if (status == 403 && dapRetryTokenize < DAP_MAX_RETRY_TOKENIZE) {
dapRetryTokenize++;
- dapUtils.dapRefreshToken(config, true, onDone);
+ dapUtils.dapRefreshToken(ortb2, config, true, onDone);
} else {
onDone();
}
@@ -417,20 +416,19 @@ export const dapUtils = {
return encData;
},
- checkAndAddRealtimeData: function(data, segtax) {
+ checkAndAddRealtimeData: function(ortb2, data, segtax) {
if (data.rtd) {
- if (segtax == 504 && dapUtils.checkIfSegmentsAlreadyExist(data.rtd, 504)) {
+ if (segtax == 504 && dapUtils.checkIfSegmentsAlreadyExist(ortb2, data.rtd, 504)) {
logMessage('DEBUG(handleInit): rtb Object already added');
} else {
- addRealTimeData(data.rtd);
+ addRealTimeData(ortb2, data.rtd);
}
logInfo('DEBUG(checkAndAddRealtimeData) - 1');
}
},
- checkIfSegmentsAlreadyExist: function(rtd, segtax) {
+ checkIfSegmentsAlreadyExist: function(ortb2, rtd, segtax) {
let segmentsExist = false
- let ortb2 = config.getConfig('ortb2') || {};
if (ortb2.user && ortb2.user.data && ortb2.user.data.length > 0) {
for (let i = 0; i < ortb2.user.data.length; i++) {
let element = ortb2.user.data[i]
diff --git a/modules/alkimiBidAdapter.js b/modules/alkimiBidAdapter.js
index 261fd9dee68..1036e5d9371 100644
--- a/modules/alkimiBidAdapter.js
+++ b/modules/alkimiBidAdapter.js
@@ -38,7 +38,8 @@ export const spec = {
requestId: bidderRequest.auctionId,
signRequest: { bids, randomUUID: alkimiConfig && alkimiConfig.randomUUID },
bidIds,
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: bidderRequest.refererInfo.page,
signature: alkimiConfig && alkimiConfig.signature
}
diff --git a/modules/amxBidAdapter.js b/modules/amxBidAdapter.js
index d1754936d7f..dae7784b3bc 100644
--- a/modules/amxBidAdapter.js
+++ b/modules/amxBidAdapter.js
@@ -13,19 +13,9 @@ const VAST_RXP = /^\s*<\??(?:vast|xml)/i;
const TRACKING_ENDPOINT = 'https://1x1.a-mo.net/hbx/';
const AMUID_KEY = '__amuidpb';
-function getLocation (request) {
- const refInfo = request.refererInfo;
- if (refInfo == null) {
- return parseUrl(location.href);
- }
-
- if (refInfo.isAmp && refInfo.referer != null) {
- return parseUrl(refInfo.referer)
- }
-
- const topUrl = refInfo.numIframes > 0 && refInfo.stack[0] != null
- ? refInfo.stack[0] : location.href;
- return parseUrl(topUrl);
+function getLocation(request) {
+ // TODO: does it make sense to fall back to window.location?
+ return parseUrl(request.refererInfo?.topmostLocation || window.location.href)
};
const largestSize = (sizes, mediaTypes) => {
@@ -243,15 +233,16 @@ export const spec = {
gs: deepAccess(bidderRequest, 'gdprConsent.gdprApplies', ''),
gc: deepAccess(bidderRequest, 'gdprConsent.consentString', ''),
u: deepAccess(bidderRequest, 'refererInfo.canonicalUrl', loc.href),
+ // TODO: are these referer values correct?
do: loc.hostname,
- re: deepAccess(bidderRequest, 'refererInfo.referer'),
+ re: deepAccess(bidderRequest, 'refererInfo.ref'),
am: getUIDSafe(),
usp: bidderRequest.uspConsent || '1---',
smt: 1,
d: '',
m: createBidMap(bidRequests),
cpp: config.getConfig('coppa') ? 1 : 0,
- fpd2: config.getConfig('ortb2'),
+ fpd2: bidderRequest.ortb2,
tmax: config.getConfig('bidderTimeout'),
eids: values(bidRequests.reduce((all, bid) => {
// we only want unique ones in here
diff --git a/modules/amxIdSystem.js b/modules/amxIdSystem.js
index 28323b01188..9dbab496f2c 100644
--- a/modules/amxIdSystem.js
+++ b/modules/amxIdSystem.js
@@ -5,11 +5,11 @@
* @module modules/amxIdSystem
* @requires module:modules/userId
*/
-import { uspDataHandler } from '../src/adapterManager.js';
-import { ajaxBuilder } from '../src/ajax.js';
-import { submodule } from '../src/hook.js';
-import { getRefererInfo } from '../src/refererDetection.js';
-import { deepAccess, getWindowTop, logError } from '../src/utils.js';
+import {uspDataHandler} from '../src/adapterManager.js';
+import {ajaxBuilder} from '../src/ajax.js';
+import {submodule} from '../src/hook.js';
+import {getRefererInfo} from '../src/refererDetection.js';
+import {deepAccess, logError} from '../src/utils.js';
const NAME = 'amxId';
const GVL_ID = 737;
@@ -109,8 +109,9 @@ export const amxIdSubmodule = {
const params = {
tagId: deepAccess(config, 'params.tagId', ''),
- ref: ref.referer,
- u: ref.stack[0] || getWindowTop().location.href,
+ // TODO: are these referer values correct?
+ ref: ref.ref,
+ u: ref.location,
v: '$prebid.version$',
vg: '$$PREBID_GLOBAL$$',
us_privacy: usp,
diff --git a/modules/aniviewBidAdapter.js b/modules/aniviewBidAdapter.js
index 7760aa2b47b..e97a2531def 100644
--- a/modules/aniviewBidAdapter.js
+++ b/modules/aniviewBidAdapter.js
@@ -106,11 +106,8 @@ function buildRequests(validBidRequests, bidderRequest) {
if (s2sParams.AV_APPPKGNAME && !s2sParams.AV_URL) { s2sParams.AV_URL = s2sParams.AV_APPPKGNAME; }
if (!s2sParams.AV_IDFA && !s2sParams.AV_URL) {
- if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- s2sParams.AV_URL = bidderRequest.refererInfo.referer;
- } else {
- s2sParams.AV_URL = window.location.href;
- }
+ // TODO: does it make sense to fall back to window.location here?
+ s2sParams.AV_URL = bidderRequest?.refererInfo?.page || window.location.href;
}
if (s2sParams.AV_IDFA && !s2sParams.AV_AID) { s2sParams.AV_AID = s2sParams.AV_IDFA; }
if (s2sParams.AV_AID && !s2sParams.AV_IDFA) { s2sParams.AV_IDFA = s2sParams.AV_AID; }
diff --git a/modules/apacdexBidAdapter.js b/modules/apacdexBidAdapter.js
index d7b6b7c4020..a6ab1ea03da 100644
--- a/modules/apacdexBidAdapter.js
+++ b/modules/apacdexBidAdapter.js
@@ -1,6 +1,8 @@
import { deepAccess, isPlainObject, isArray, replaceAuctionPrice, isFn } from '../src/utils.js';
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'apacdex';
const ENDPOINT = 'https://useast.quantumdex.io/auction/pbjs'
const USERSYNC = 'https://sync.quantumdex.io/usersync/pbjs'
@@ -103,7 +105,8 @@ export const spec = {
payload.site = {};
payload.site.page = pageUrl
payload.site.referrer = _extractTopWindowReferrerFromBidderRequest(bidderRequest);
- payload.site.hostname = getDomain(pageUrl);
+ // TODO: does it make sense to fall back to window.location for the domain?
+ payload.site.hostname = bidderRequest.refererInfo?.domain || parseDomain(pageUrl);
// Apply GDPR parameters to request.
if (bidderRequest && bidderRequest.gdprConsent) {
@@ -283,18 +286,8 @@ function _getDoNotTrack() {
* @returns {string}
*/
function _extractTopWindowUrlFromBidderRequest(bidderRequest) {
- if (config.getConfig('pageUrl')) {
- return config.getConfig('pageUrl');
- }
- if (deepAccess(bidderRequest, 'refererInfo.referer')) {
- return bidderRequest.refererInfo.referer;
- }
-
- try {
- return window.top.location.href;
- } catch (e) {
- return window.location.href;
- }
+ // TODO: does it make sense to fall back to window.location?
+ return bidderRequest?.refererInfo?.page || window.location.href;
}
/**
@@ -304,34 +297,8 @@ function _extractTopWindowUrlFromBidderRequest(bidderRequest) {
* @returns {string}
*/
function _extractTopWindowReferrerFromBidderRequest(bidderRequest) {
- if (bidderRequest && deepAccess(bidderRequest, 'refererInfo.referer')) {
- return bidderRequest.refererInfo.referer;
- }
-
- try {
- return window.top.document.referrer;
- } catch (e) {
- return window.document.referrer;
- }
-}
-
-/**
- * Extracts the domain from given page url
- *
- * @param {string} url
- * @returns {string}
- */
-export function getDomain(pageUrl) {
- if (config.getConfig('publisherDomain')) {
- var publisherDomain = config.getConfig('publisherDomain');
- return publisherDomain.replace('http://', '').replace('https://', '').replace('www.', '').split(/[/?#:]/)[0];
- }
-
- if (!pageUrl) {
- return pageUrl;
- }
-
- return pageUrl.replace('http://', '').replace('https://', '').replace('www.', '').split(/[/?#:]/)[0];
+ // TODO: does it make sense to fall back to window.document.referrer?
+ return bidderRequest?.refererInfo?.ref || window.document.referrer;
}
/**
@@ -378,14 +345,4 @@ function getBidFloor(bid) {
return null;
}
-function hasPurpose1Consent(gdprConsent) {
- let result = true;
- if (gdprConsent) {
- if (gdprConsent.gdprApplies && gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
registerBidder(spec);
diff --git a/modules/appierBidAdapter.js b/modules/appierBidAdapter.js
index 1940233a0b4..12346d15130 100644
--- a/modules/appierBidAdapter.js
+++ b/modules/appierBidAdapter.js
@@ -43,7 +43,8 @@ export const spec = {
const bidderApiUrl = `//${server}${BIDDER_API_ENDPOINT}`
const payload = {
'bids': bidRequests,
- 'refererInfo': bidderRequest.refererInfo,
+ // TODO: please do not pass internal data structures over to the network
+ 'refererInfo': bidderRequest.refererInfo.legacy,
'version': ADAPTER_VERSION
};
return [{
diff --git a/modules/appnexusAnalyticsAdapter.js b/modules/appnexusAnalyticsAdapter.js
deleted file mode 100644
index 868b317d7d4..00000000000
--- a/modules/appnexusAnalyticsAdapter.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * appnexus.js - AppNexus Prebid Analytics Adapter
- */
-
-import adapter from '../src/AnalyticsAdapter.js';
-import adapterManager from '../src/adapterManager.js';
-
-var appnexusAdapter = adapter({
- global: 'AppNexusPrebidAnalytics',
- handler: 'on',
- analyticsType: 'bundle'
-});
-
-adapterManager.registerAnalyticsAdapter({
- adapter: appnexusAdapter,
- code: 'appnexus',
- gvlid: 32
-});
-
-export default appnexusAdapter;
diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js
index aa5b604781d..9a2d3fa0a50 100644
--- a/modules/appnexusBidAdapter.js
+++ b/modules/appnexusBidAdapter.js
@@ -33,6 +33,7 @@ import {find, includes} from '../src/polyfill.js';
import {INSTREAM, OUTSTREAM} from '../src/video.js';
import {getStorageManager} from '../src/storageManager.js';
import {bidderSettings} from '../src/bidderSettings.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'appnexus';
const URL = 'https://ib.adnxs.com/ut/v3/prebid';
@@ -92,7 +93,6 @@ export const spec = {
gvlid: GVLID,
aliases: [
{ code: 'appnexusAst', gvlid: 32 },
- { code: 'brealtime' },
{ code: 'emxdigital', gvlid: 183 },
{ code: 'pagescience' },
{ code: 'defymedia' },
@@ -100,7 +100,6 @@ export const spec = {
{ code: 'matomy' },
{ code: 'featureforward' },
{ code: 'oftmedia' },
- { code: 'districtm', gvlid: 144 },
{ code: 'adasta' },
{ code: 'beintoo', gvlid: 618 },
],
@@ -267,12 +266,13 @@ export const spec = {
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: are these the correct referer values?
+ rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
}
- let pubPageUrl = config.getConfig('pageUrl');
+ let pubPageUrl = bidderRequest.refererInfo.canonicalUrl;
if (isStr(pubPageUrl) && pubPageUrl !== '') {
refererinfo.rd_can = pubPageUrl;
}
@@ -292,7 +292,6 @@ export const spec = {
if (bidRequests[0].userId) {
let eids = [];
- addUserId(eids, deepAccess(bidRequests[0], `userId.flocId.id`), 'chrome.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.criteoId`), 'criteo.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.netId`), 'netid.de', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.idl_env`), 'liveramp.com', null);
@@ -386,7 +385,7 @@ export const spec = {
},
getUserSyncs: function (syncOptions, responses, gdprConsent) {
- if (syncOptions.iframeEnabled && hasPurpose1Consent({gdprConsent})) {
+ if (syncOptions.iframeEnabled && hasPurpose1Consent(gdprConsent)) {
return [{
type: 'iframe',
url: 'https://acdn.adnxs.com/dmp/async_usersync.html'
@@ -549,16 +548,6 @@ function getViewabilityScriptUrlFromPayload(viewJsPayload) {
return jsTrackerSrc;
}
-function hasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
function formatRequest(payload, bidderRequest) {
let request = [];
let options = {
@@ -567,7 +556,7 @@ function formatRequest(payload, bidderRequest) {
let endpointUrl = URL;
- if (!hasPurpose1Consent(bidderRequest)) {
+ if (!hasPurpose1Consent(bidderRequest?.gdprConsent)) {
endpointUrl = URL_SIMPLE;
}
diff --git a/modules/arteebeeBidAdapter.md b/modules/arteebeeBidAdapter.md
deleted file mode 100644
index 4c178d722b1..00000000000
--- a/modules/arteebeeBidAdapter.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Overview
-
-```
-Module Name: Arteebee Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: jeffyecn@gmail.com
-```
-
-# Description
-
-Module that connects to Arteebee's demand source
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'banner-ad-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: 'arteebee',
- params: {
- ssp: 'mock',
- pub: 'prebidtest',
- source: 'prebidtest',
- test: true
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/asealBidAdapter.js b/modules/asealBidAdapter.js
index 855aee65f34..abe0cf907ed 100644
--- a/modules/asealBidAdapter.js
+++ b/modules/asealBidAdapter.js
@@ -59,7 +59,8 @@ export const spec = {
const data = {
bids: validBidRequests,
- refererInfo: bidderRequest.refererInfo,
+ // TODO: please do not pass internal data structures over to the network
+ refererInfo: bidderRequest.refererInfo?.legacy,
device: {
webSessionId: getTrekWebSessionId(),
},
diff --git a/modules/asoBidAdapter.js b/modules/asoBidAdapter.js
index bf45b9ee48f..9469bc6b00c 100644
--- a/modules/asoBidAdapter.js
+++ b/modules/asoBidAdapter.js
@@ -1,8 +1,19 @@
-import { _each, deepAccess, logWarn, tryAppendQueryString, inIframe, getWindowTop, parseUrl, parseSizesInput, isFn, getDNT, deepSetValue } from '../src/utils.js';
+import {
+ _each,
+ deepAccess,
+ deepSetValue,
+ getDNT,
+ inIframe,
+ isFn,
+ logWarn,
+ parseSizesInput,
+ tryAppendQueryString
+} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'aso';
const DEFAULT_SERVER_URL = 'https://srv.aso1.net';
@@ -167,28 +178,13 @@ function createRenderer(bid, url) {
}
function getUrlsInfo(bidderRequest) {
- let page = '';
- let referrer = '';
-
- const {refererInfo} = bidderRequest;
-
- if (inIframe()) {
- page = refererInfo.referer;
- } else {
- const w = getWindowTop();
- page = w.location.href;
- referrer = w.document.referrer || '';
- }
-
- page = config.getConfig('pageUrl') || page;
- const url = parseUrl(page);
- const domain = url.hostname;
-
+ const {page, domain, ref} = bidderRequest.refererInfo;
return {
- domain,
- page,
- referrer
- };
+ // TODO: do the fallbacks make sense here?
+ page: page || bidderRequest.refererInfo?.topmostLocation,
+ referrer: ref || '',
+ domain: domain || parseDomain(bidderRequest?.refererInfo?.topmostLocation)
+ }
}
function getSize(paramSizes) {
diff --git a/modules/astraoneBidAdapter.js b/modules/astraoneBidAdapter.js
index c233e665499..d6bfa4b93ee 100644
--- a/modules/astraoneBidAdapter.js
+++ b/modules/astraoneBidAdapter.js
@@ -99,7 +99,7 @@ export const spec = {
*/
buildRequests(validBidRequests, bidderRequest) {
const payload = {
- url: bidderRequest.refererInfo.referer,
+ url: bidderRequest.refererInfo.page,
cmp: !!bidderRequest.gdprConsent,
bidRequests: buildBidRequests(validBidRequests)
};
diff --git a/modules/atomxBidAdapter.md b/modules/atomxBidAdapter.md
deleted file mode 100644
index 7f32b12fdfe..00000000000
--- a/modules/atomxBidAdapter.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Overview
-Module Name: Atomx Bidder Adapter Module
-Type: Bidder Adapter
-Maintainer: erik@atomx.com
-
-# Description
-Atomx Bidder Adapter for Prebid.js.
-
-# Test Parameters
-```
-var adUnits = [
-{
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: 'atomx',
- params: {
- id: 4025860,
- }
- }
- ]
-}
-];
-```
diff --git a/modules/audiencerunBidAdapter.js b/modules/audiencerunBidAdapter.js
index 2744e38e820..754a48ede75 100644
--- a/modules/audiencerunBidAdapter.js
+++ b/modules/audiencerunBidAdapter.js
@@ -71,12 +71,7 @@ function getPageReferer() {
* @return {string}
*/
function getPageUrl(bidderRequest) {
- return (
- config.getConfig('pageUrl') ||
- deepAccess(bidderRequest, 'refererInfo.referer') ||
- getPageReferer() ||
- null
- );
+ return bidderRequest?.refererInfo?.page
}
export const spec = {
@@ -127,10 +122,12 @@ export const spec = {
const payload = {
libVersion: this.version,
- pageUrl: config.getConfig('pageUrl'),
+ pageUrl: bidderRequest?.refererInfo?.page,
+ // TODO: does it make sense to find a half-way referer? what should these parameters pick
pageReferer: getPageReferer(),
- referer: deepAccess(bidderRequest, 'refererInfo.referer'),
- refererInfo: deepAccess(bidderRequest, 'refererInfo'),
+ referer: deepAccess(bidderRequest, 'refererInfo.topmostLocation'),
+ // TODO: please do not send internal data structures over the network
+ refererInfo: deepAccess(bidderRequest, 'refererInfo.legacy'),
currencyCode: config.getConfig('currency.adServerCurrency'),
timeout: config.getConfig('bidderTimeout'),
bids,
diff --git a/modules/automatadBidAdapter.js b/modules/automatadBidAdapter.js
index d3aeb204d5e..1174c2a9f38 100644
--- a/modules/automatadBidAdapter.js
+++ b/modules/automatadBidAdapter.js
@@ -61,9 +61,9 @@ export const spec = {
imp: impressions,
site: {
id: siteId,
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidderRequest.refererInfo ? bidderRequest.refererInfo.referer || null : null,
+ domain: bidderRequest.refererInfo?.domain,
+ page: bidderRequest.refererInfo?.page,
+ ref: bidderRequest.refererInfo?.ref
},
}
diff --git a/modules/avocetBidAdapter.md b/modules/avocetBidAdapter.md
deleted file mode 100644
index 95cb29303f2..00000000000
--- a/modules/avocetBidAdapter.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Overview
-
-```
-Module Name: Avocet Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: developers@avocet.io
-```
-
-# Description
-
-Module that connects to the Avocet advertising platform.
-
-# Parameters
-
-| Name | Scope | Description | Example |
-| :------------ | :------- | :---------------------------------- | :------------------------- |
-| `placement` | required | A Placement ID from Avocet. | "5ebd27607781b9af3ccc3332" |
-
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]], // a display size
- }
- },
- bids: [
- {
- bidder: "avct",
- params: {
- placement: "5ebd27607781b9af3ccc3332"
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/axonixBidAdapter.js b/modules/axonixBidAdapter.js
index a790a89a0c1..5435bf09059 100644
--- a/modules/axonixBidAdapter.js
+++ b/modules/axonixBidAdapter.js
@@ -25,12 +25,11 @@ function getBidFloor(bidRequest) {
}
function getPageUrl(bidRequest, bidderRequest) {
- let pageUrl = config.getConfig('pageUrl');
-
+ let pageUrl;
if (bidRequest.params.referrer) {
pageUrl = bidRequest.params.referrer;
- } else if (!pageUrl) {
- pageUrl = bidderRequest.refererInfo.referer;
+ } else {
+ pageUrl = bidderRequest.refererInfo.page;
}
return bidRequest.params.secure ? pageUrl.replace(/^http:/i, 'https:') : pageUrl;
diff --git a/modules/beachfrontBidAdapter.js b/modules/beachfrontBidAdapter.js
index 1c341e4dc51..f80481d66c8 100644
--- a/modules/beachfrontBidAdapter.js
+++ b/modules/beachfrontBidAdapter.js
@@ -9,7 +9,6 @@ import {
parseSizesInput,
parseUrl
} from '../src/utils.js';
-import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {Renderer} from '../src/Renderer.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
@@ -31,7 +30,7 @@ export const SUPPORTED_USER_IDS = [
{ key: 'tdid', source: 'adserver.org', rtiPartner: 'TDID', queryParam: 'tdid' },
{ key: 'idl_env', source: 'liveramp.com', rtiPartner: 'idl', queryParam: 'idl' },
{ key: 'uid2.id', source: 'uidapi.com', rtiPartner: 'UID2', queryParam: 'uid2' },
- { key: 'haloId', source: 'audigent.com', atype: 1, queryParam: 'haloid' }
+ { key: 'hadronId', source: 'audigent.com', atype: 1, queryParam: 'hadronid' }
];
let appId = '';
@@ -305,16 +304,7 @@ function isBannerBidValid(bid) {
}
function getTopWindowLocation(bidderRequest) {
- let url = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
- return parseUrl(config.getConfig('pageUrl') || url, { decodeSearchAsString: true });
-}
-
-function getTopWindowReferrer() {
- try {
- return window.top.document.referrer;
- } catch (e) {
- return '';
- }
+ return parseUrl(bidderRequest?.refererInfo?.page, { decodeSearchAsString: true });
}
function getEids(bid) {
@@ -369,7 +359,7 @@ function createVideoRequestData(bid, bidderRequest) {
let tagid = getVideoBidParam(bid, 'tagid');
let topLocation = getTopWindowLocation(bidderRequest);
let eids = getEids(bid);
- let ortb2 = deepClone(config.getConfig('ortb2'));
+ let ortb2 = deepClone(bidderRequest.ortb2);
let payload = {
isPrebid: true,
appId: appId,
@@ -433,7 +423,7 @@ function createVideoRequestData(bid, bidderRequest) {
function createBannerRequestData(bids, bidderRequest) {
let topLocation = getTopWindowLocation(bidderRequest);
- let topReferrer = getTopWindowReferrer();
+ let topReferrer = bidderRequest.refererInfo?.ref;
let slots = bids.map(bid => {
return {
slot: bid.adUnitCode,
@@ -443,7 +433,7 @@ function createBannerRequestData(bids, bidderRequest) {
sizes: getBannerSizes(bid)
};
});
- let ortb2 = deepClone(config.getConfig('ortb2'));
+ let ortb2 = deepClone(bidderRequest.ortb2);
let payload = {
slots: slots,
ortb2: ortb2,
diff --git a/modules/beopBidAdapter.js b/modules/beopBidAdapter.js
index ba960838395..b4ac0f2a5a3 100644
--- a/modules/beopBidAdapter.js
+++ b/modules/beopBidAdapter.js
@@ -38,7 +38,6 @@ export const spec = {
buildRequests: function(validBidRequests, bidderRequest) {
const slots = validBidRequests.map(beOpRequestSlotsMaker);
const pageUrl = getPageUrl(bidderRequest.refererInfo, window);
- const fpd = config.getLegacyFpd(config.getConfig('ortb2'));
const gdpr = bidderRequest.gdprConsent;
const firstSlot = slots[0];
const payloadObject = {
@@ -48,7 +47,7 @@ export const spec = {
pid: firstSlot.pid,
url: pageUrl,
lang: (window.navigator.language || window.navigator.languages[0]),
- kwds: (fpd && fpd.site && fpd.site.keywords) || [],
+ kwds: bidderRequest.ortb2?.site?.keywords || [],
dbg: false,
slts: slots,
is_amp: deepAccess(bidderRequest, 'referrerInfo.isAmp'),
diff --git a/modules/betweenBidAdapter.js b/modules/betweenBidAdapter.js
index e4907c15974..9e57d0f5cd3 100644
--- a/modules/betweenBidAdapter.js
+++ b/modules/betweenBidAdapter.js
@@ -1,7 +1,6 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
-import { getAdUnitSizes, parseSizesInput } from '../src/utils.js';
-import { getRefererInfo } from '../src/refererDetection.js';
-import {includes} from '../src/polyfill.js'
+import {getAdUnitSizes, parseSizesInput} from '../src/utils.js';
+import {includes} from '../src/polyfill.js';
const BIDDER_CODE = 'between';
let ENDPOINT = 'https://ads.betweendigital.com/adjson?t=prebid';
@@ -29,7 +28,7 @@ export const spec = {
buildRequests: function(validBidRequests, bidderRequest) {
let requests = [];
const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
- const refInfo = getRefererInfo();
+ const refInfo = bidderRequest?.refererInfo;
validBidRequests.forEach((i) => {
const video = i.mediaTypes && i.mediaTypes.video;
@@ -79,7 +78,8 @@ export const spec = {
params.schain = encodeToBase64WebSafe(JSON.stringify(i.schain));
}
- if (refInfo && refInfo.referer) params.ref = refInfo.referer;
+ // TODO: is 'page' the right value here?
+ if (refInfo && refInfo.page) params.ref = refInfo.page;
if (gdprConsent) {
if (typeof gdprConsent.gdprApplies !== 'undefined') {
diff --git a/modules/bidfluenceBidAdapter.md b/modules/bidfluenceBidAdapter.md
deleted file mode 100644
index 34dbb3d3a1c..00000000000
--- a/modules/bidfluenceBidAdapter.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Overview
-
-```
-Module Name: Bidfluence Adapter
-Module Type: Bidder Adapter
-Maintainer: integrations@bidfluence.com
-prebid_1_0_supported : true
-gdpr_supported: true
-```
-
-# Description
-
-Bidfluence adapter for prebid.
-
-# Test Parameters
-
-```
-var adUnits = [
- {
- code: 'test-prebid',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'bidfluence',
- params: {
- placementId: '1000',
- publisherId: '1000'
- }
- }]
- }
-]
-```
diff --git a/modules/bidlabBidAdapter.md b/modules/bidlabBidAdapter.md
deleted file mode 100644
index 3e5fe3128ed..00000000000
--- a/modules/bidlabBidAdapter.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Overview
-
-```
-Module Name: bidlab Bidder Adapter
-Module Type: bidlab Bidder Adapter
-```
-
-# Description
-
-Module that connects to bidlab demand sources
-
-# Test Parameters
-```
- var adUnits = [
- // Will return static test banner
- {
- code: 'placementId_0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [
- {
- bidder: 'bidlab',
- params: {
- placementId: 0,
- traffic: 'banner'
- }
- }
- ]
- },
- // Will return test vast xml. All video params are stored under placement in publishers UI
- {
- code: 'placementId_0',
- mediaTypes: {
- video: {
- playerSize: [640, 480],
- context: 'instream'
- }
- },
- bids: [
- {
- bidder: 'bidlab',
- params: {
- placementId: 0,
- traffic: 'video'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/bidphysicsBidAdapter.md b/modules/bidphysicsBidAdapter.md
deleted file mode 100644
index d7d8b355027..00000000000
--- a/modules/bidphysicsBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-```
-Module Name: BidPhysics Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: info@bidphysics.com
-```
-
-# Description
-
-Connects to BidPhysics exchange for bids.
-
-BidPhysics bid adapter supports Banner ads.
-
-# Test Parameters
-```
-var adUnits = [
- {
- code: 'banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]]
- }
- },
- bids: [{
- bidder: 'bidphysics',
- params: {
- unitId: 'bidphysics-test'
- }
- }]
- }
-];
-```
diff --git a/modules/bizzclickBidAdapter.js b/modules/bizzclickBidAdapter.js
index a798671cbaf..ce961867c59 100644
--- a/modules/bizzclickBidAdapter.js
+++ b/modules/bizzclickBidAdapter.js
@@ -63,7 +63,7 @@ export const spec = {
let winTop = window;
let location;
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/bliinkBidAdapter.js b/modules/bliinkBidAdapter.js
index 45b6c46c2df..962a61efad5 100644
--- a/modules/bliinkBidAdapter.js
+++ b/modules/bliinkBidAdapter.js
@@ -170,7 +170,7 @@ export const buildRequests = (_, bidderRequest) => {
if (!bidderRequest) return null
let data = {
- pageUrl: bidderRequest.refererInfo.referer,
+ pageUrl: bidderRequest.refererInfo.page,
pageDescription: getMetaValue(META_DESCRIPTION),
keywords: getKeywords().join(','),
gdpr: false,
@@ -184,7 +184,8 @@ export const buildRequests = (_, bidderRequest) => {
bidderRequestId: bidderRequest.bidderRequestId,
bidderCode: bidderRequest.bidderCode,
bids: bidderRequest.bids,
- refererInfo: bidderRequest.refererInfo,
+ // TODO: please do not send internal data structures over the network
+ refererInfo: bidderRequest.refererInfo.legacy,
}
if (bidderRequest.gdprConsent) {
diff --git a/modules/bluebillywigBidAdapter.js b/modules/bluebillywigBidAdapter.js
index d362dfa5fdb..27e310177f6 100644
--- a/modules/bluebillywigBidAdapter.js
+++ b/modules/bluebillywigBidAdapter.js
@@ -306,7 +306,7 @@ export const spec = {
if (getConfig('coppa') == true) deepSetValue(request, 'regs.coppa', 1);
// Enrich the request with any external data we may have
- BB_HELPERS.addSiteAppDevice(request, bidderRequest.refererInfo && bidderRequest.refererInfo.referer);
+ BB_HELPERS.addSiteAppDevice(request, bidderRequest.refererInfo && bidderRequest.refererInfo.page);
BB_HELPERS.addSchain(request, validBidRequests);
BB_HELPERS.addCurrency(request);
BB_HELPERS.addUserIds(request, validBidRequests);
diff --git a/modules/boldwinBidAdapter.js b/modules/boldwinBidAdapter.js
index fcff7134a92..33e99211e9b 100644
--- a/modules/boldwinBidAdapter.js
+++ b/modules/boldwinBidAdapter.js
@@ -51,8 +51,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/brainyBidAdapter.md b/modules/brainyBidAdapter.md
deleted file mode 100644
index 0f8308f6cc3..00000000000
--- a/modules/brainyBidAdapter.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Overview
-
-```
-Module Name: brainy Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: support@mg.brainy-inc.co.jp
-```
-
-# Description
-This module connects to brainy's demand sources. It supports display, and rich media formats.
-brainy will provide ``accountID`` and ``slotID`` that are specific to your ad type.
-Please reach out to ``support@mg.brainy-inc.co.jp`` to set up an brainy account and above ids.
-Use bidder code ```brainy``` for all brainy traffic.
-
-
-# Test Parameters
-
-```
- var adUnits = [{
- code: 'test-div',
- sizes: [[300, 250],
- bids: [{
- bidder: 'brainy',
- params: {
- accountID: "3481",
- slotID: "5569"
- }
- }]
- }
- ];
-```
diff --git a/modules/brandmetricsRtdProvider.js b/modules/brandmetricsRtdProvider.js
index 60d3c98f15e..53868eccc4c 100644
--- a/modules/brandmetricsRtdProvider.js
+++ b/modules/brandmetricsRtdProvider.js
@@ -5,10 +5,10 @@
* @module modules/brandmetricsRtdProvider
* @requires module:modules/realTimeData
*/
-import { config } from '../src/config.js'
-import { submodule } from '../src/hook.js'
-import { deepSetValue, mergeDeep, logError, deepAccess } from '../src/utils.js'
-import {loadExternalScript} from '../src/adloader.js'
+import {submodule} from '../src/hook.js';
+import {deepAccess, deepSetValue, logError, mergeDeep} from '../src/utils.js';
+import {loadExternalScript} from '../src/adloader.js';
+
const MODULE_NAME = 'brandmetrics'
const MODULE_CODE = MODULE_NAME
const RECEIVED_EVENTS = []
@@ -109,11 +109,8 @@ function processBrandmetricsEvents (reqBidsConfigObj, moduleConfig, callback) {
function setBidderTargeting (reqBidsConfigObj, moduleConfig, key, val) {
const bidders = deepAccess(moduleConfig, 'params.bidders')
if (bidders && bidders.length > 0) {
- const ortb2 = {}
- deepSetValue(ortb2, 'ortb2.user.ext.data.' + key, val)
- config.setBidderConfig({
- bidders: bidders,
- config: ortb2
+ bidders.forEach(bidder => {
+ deepSetValue(reqBidsConfigObj, `ortb2Fragments.bidder.${bidder}.user.ext.data.${key}`, val);
})
}
}
diff --git a/modules/braveBidAdapter.js b/modules/braveBidAdapter.js
index 18bad6b0f75..d29d58a2129 100644
--- a/modules/braveBidAdapter.js
+++ b/modules/braveBidAdapter.js
@@ -62,23 +62,9 @@ export const spec = {
return impObject;
});
- let w = window;
- let l = w.document.location.href;
- let r = w.document.referrer;
-
- let loopChecker = 0;
- while (w !== w.parent) {
- if (++loopChecker == 10) break;
- try {
- w = w.parent;
- l = w.location.href;
- r = w.document.referrer;
- } catch (e) {
- break;
- }
- }
-
- let page = l || bidderRequest.refererInfo.referer;
+ // TODO: do these values make sense?
+ let page = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
+ let r = bidderRequest.refererInfo.ref;
let data = {
id: bidderRequest.bidderRequestId,
diff --git a/modules/bridgewellBidAdapter.js b/modules/bridgewellBidAdapter.js
index b141763af8e..6af7f4fc8a0 100644
--- a/modules/bridgewellBidAdapter.js
+++ b/modules/bridgewellBidAdapter.js
@@ -72,7 +72,7 @@ export const spec = {
let topUrl = '';
if (bidderRequest && bidderRequest.refererInfo) {
- topUrl = bidderRequest.refererInfo.referer;
+ topUrl = bidderRequest.refererInfo.page;
}
return {
@@ -85,9 +85,10 @@ export const spec = {
},
inIframe: inIframe(),
url: topUrl,
- referrer: getTopWindowReferrer(),
+ referrer: bidderRequest.refererInfo.ref,
adUnits: adUnits,
- refererInfo: bidderRequest.refererInfo,
+ // TODO: please do not send internal data structures over the network
+ refererInfo: bidderRequest.refererInfo.legacy,
},
validBidRequests: validBidRequests
};
@@ -289,12 +290,4 @@ export const spec = {
}
};
-function getTopWindowReferrer() {
- try {
- return window.top.document.referrer;
- } catch (e) {
- return '';
- }
-}
-
registerBidder(spec);
diff --git a/modules/brightMountainMediaBidAdapter.js b/modules/brightMountainMediaBidAdapter.js
index d3ae1d9cf43..bfe1e8ecb29 100644
--- a/modules/brightMountainMediaBidAdapter.js
+++ b/modules/brightMountainMediaBidAdapter.js
@@ -149,6 +149,7 @@ export const spec = {
registerBidder(spec);
function buildSite(bidderRequest) {
+ // TODO: should name/domain be the domain?
let site = {
name: window.location.hostname,
publisher: {
@@ -160,12 +161,12 @@ function buildSite(bidderRequest) {
deepSetValue(
site,
'page',
- bidderRequest.refererInfo.referer.href ? bidderRequest.refererInfo.referer.href : '',
+ bidderRequest.refererInfo.page
);
deepSetValue(
site,
'ref',
- bidderRequest.refererInfo.referer ? bidderRequest.refererInfo.referer : '',
+ bidderRequest.refererInfo.ref
);
}
return site;
diff --git a/modules/brightcomBidAdapter.js b/modules/brightcomBidAdapter.js
index 4895f303973..64b3c3a9fc8 100644
--- a/modules/brightcomBidAdapter.js
+++ b/modules/brightcomBidAdapter.js
@@ -1,4 +1,4 @@
-import { getBidIdParameter, _each, isArray, getWindowTop, getUniqueIdentifierStr, parseUrl, deepSetValue, logError, logWarn, createTrackPixelHtml, getWindowSelf, isFn, isPlainObject } from '../src/utils.js';
+import { getBidIdParameter, _each, isArray, getWindowTop, getUniqueIdentifierStr, deepSetValue, logError, logWarn, createTrackPixelHtml, getWindowSelf, isFn, isPlainObject } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js';
import { config } from '../src/config.js';
@@ -19,7 +19,7 @@ function buildRequests(bidReqs, bidderRequest) {
try {
let referrer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referrer = bidderRequest.refererInfo.referer;
+ referrer = bidderRequest.refererInfo.page;
}
const brightcomImps = [];
const publisherId = getBidIdParameter('publisherId', bidReqs[0].params);
@@ -56,7 +56,7 @@ function buildRequests(bidReqs, bidderRequest) {
id: getUniqueIdentifierStr(),
imp: brightcomImps,
site: {
- domain: parseUrl(referrer).host,
+ domain: bidderRequest?.refererInfo?.domain || '',
page: referrer,
publisher: {
id: publisherId
diff --git a/modules/byplayBidAdapter.md b/modules/byplayBidAdapter.md
deleted file mode 100644
index 67fb9c40d35..00000000000
--- a/modules/byplayBidAdapter.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Overview
-
-```
-Module Name: ByPlay Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: byplayers@tsumikiinc.com
-```
-
-# Description
-
-Connects to ByPlay exchange for bids.
-
-ByPlay bid adapter supports Video.
-
-# Test Parameters
-```
- const adUnits = [
- {
- code: 'byplay-ad',
- mediaTypes: {
- video: {
- playerSize: [400, 225],
- context: 'outstream'
- }
- },
- bids: [
- {
- bidder: 'byplay',
- params: {
- sectionId: '7986',
- env: 'dev'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/c1xBidAdapter.md b/modules/c1xBidAdapter.md
deleted file mode 100644
index 83a4ff1ea81..00000000000
--- a/modules/c1xBidAdapter.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Overview
-
-Module Name: C1X Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: cathy@c1exchange.com
-
-# Description
-
-Module that connects to C1X's demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 600], [300, 250]],
- bids: [
- {
- bidder: 'c1x',
- params: {
- siteId: '9999',
- pixelId: '12345',
- floorPriceMap: {
- '300x250': 0.20,
- '300x600': 0.30
- }, //optional
- }
- }
- ]
- },
- ];
-```
\ No newline at end of file
diff --git a/modules/ccxBidAdapter.js b/modules/ccxBidAdapter.js
index 65d1ced30e2..7c6b0411023 100644
--- a/modules/ccxBidAdapter.js
+++ b/modules/ccxBidAdapter.js
@@ -1,7 +1,6 @@
-import { deepAccess, isArray, _each, logWarn, isEmpty } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js'
-import { config } from '../src/config.js'
-import { getStorageManager } from '../src/storageManager.js';
+import {_each, deepAccess, isArray, isEmpty, logWarn} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {getStorageManager} from '../src/storageManager.js';
const BIDDER_CODE = 'ccx'
const storage = getStorageManager({bidderCode: BIDDER_CODE});
@@ -20,7 +19,8 @@ function _getDeviceObj () {
function _getSiteObj (bidderRequest) {
let site = {}
- let url = config.getConfig('pageUrl') || deepAccess(window, 'location.href');
+ // TODO: does the fallback to window.location make sense?
+ let url = bidderRequest?.refererInfo?.page || window.location.href
if (url.length > 0) {
url = url.split('?')[0]
}
diff --git a/modules/cedatoBidAdapter.md b/modules/cedatoBidAdapter.md
deleted file mode 100644
index 088f8a4baef..00000000000
--- a/modules/cedatoBidAdapter.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Overview
-
-```
-Module Name: Cedato Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: alexk@cedato.com
-```
-
-# Description
-
-Connects to Cedato Bidder.
-Player ID must be replaced. You can approach your Cedato account manager to get one.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner
- {
- code: 'div-gpt-ad-1460505748561-0',
- mediaTypes: {
- banner: {
- // You can choose one of them
- sizes: [
- [300, 250],
- [300, 600],
- [240, 400],
- [728, 90],
- ]
- }
- },
- bids: [
- {
- bidder: "cedato",
- params: {
- player_id: 1450133326,
- }
- }
- ]
- }
-];
-
-pbjs.que.push(() => {
- pbjs.setConfig({
- userSync: {
- syncEnabled: true,
- enabledBidders: ['cedato'],
- pixelEnabled: true,
- syncsPerBidder: 200,
- syncDelay: 100,
- },
- });
-});
-```
diff --git a/modules/cleanmedianetBidAdapter.js b/modules/cleanmedianetBidAdapter.js
index 3fda9917715..f7d74c0df64 100644
--- a/modules/cleanmedianetBidAdapter.js
+++ b/modules/cleanmedianetBidAdapter.js
@@ -1,6 +1,5 @@
import {deepAccess, getDNT, inIframe, isArray, isNumber, logError, logWarn} from '../src/utils.js';
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 '../src/polyfill.js';
@@ -64,15 +63,14 @@ export const spec = {
params.supplyPartnerId
}/bidr?rformat=open_rtb&reqformat=rtb_json&bidder=prebid` +
(params.query ? '&' + params.query : '');
- let url =
- config.getConfig('pageUrl') || bidderRequest.refererInfo.referer;
+ let url = bidderRequest.refererInfo.page;
const rtbBidRequest = {
id: auctionId,
site: {
- domain: helper.getTopWindowDomain(url),
+ domain: bidderRequest.refererInfo.domain,
page: url,
- ref: bidderRequest.refererInfo.referer
+ ref: bidderRequest.refererInfo.ref
},
device: {
ua: navigator.userAgent,
@@ -111,7 +109,7 @@ export const spec = {
const imp = {
id: transactionId,
- instl: params.instl === 1 ? 1 : 0,
+ instl: deepAccess(bidRequest.ortb2Imp, 'instl') === 1 || params.instl === 1 ? 1 : 0,
tagid: adUnitCode,
bidfloor: 0,
bidfloorcur: 'USD',
diff --git a/modules/clicktripzBidAdapter.md b/modules/clicktripzBidAdapter.md
deleted file mode 100644
index 1de1e26f37a..00000000000
--- a/modules/clicktripzBidAdapter.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Overview
-
-```
-Module Name: Clicktripz Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: integration-support@clicktripz.com
-```
-
-# Description
-Our module makes it easy to integrate Clicktripz demand sources into your website.
-
-Supported Ad Fortmats:
-* Banner
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [
- {
- bidder: "clicktripz",
- params: {
- placementId: '4312c63f',
- siteId: 'prebid',
- }
- }
- ]
- }
- ];
diff --git a/modules/codefuelBidAdapter.js b/modules/codefuelBidAdapter.js
index b9da86ac24e..bde168a79e3 100644
--- a/modules/codefuelBidAdapter.js
+++ b/modules/codefuelBidAdapter.js
@@ -1,6 +1,7 @@
-import { deepAccess, isArray } from '../src/utils.js';
+import {deepAccess, isArray} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
-import { BANNER } from '../src/mediaTypes.js';
+import {BANNER} from '../src/mediaTypes.js';
+
const BIDDER_CODE = 'codefuel';
const CURRENCY = 'USD';
@@ -27,8 +28,8 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function(validBidRequests, bidderRequest) {
- const page = bidderRequest.refererInfo.referer;
- const domain = getDomainFromURL(page)
+ const page = bidderRequest.refererInfo.page;
+ const domain = bidderRequest.refererInfo.domain;
const ua = navigator.userAgent;
const devicetype = getDeviceType()
const publisher = setOnAny(validBidRequests, 'params.publisher');
@@ -128,12 +129,6 @@ export const spec = {
}
registerBidder(spec);
-function getDomainFromURL(url) {
- let anchor = document.createElement('a');
- anchor.href = url;
- return anchor.hostname;
-}
-
function getDeviceType() {
if ((/ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase()))) {
return 5; // 'tablet'
diff --git a/modules/cointrafficBidAdapter.js b/modules/cointrafficBidAdapter.js
index f61d58664ca..ce366cbecc8 100644
--- a/modules/cointrafficBidAdapter.js
+++ b/modules/cointrafficBidAdapter.js
@@ -50,7 +50,8 @@ export const spec = {
currency: currency,
sizes: sizes,
bidId: bidRequest.bidId,
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: bidderRequest.refererInfo.page,
};
return {
diff --git a/modules/coinzillaBidAdapter.js b/modules/coinzillaBidAdapter.js
index cd087daa8cb..7e9fb964a87 100644
--- a/modules/coinzillaBidAdapter.js
+++ b/modules/coinzillaBidAdapter.js
@@ -39,7 +39,8 @@ export const spec = {
width: width,
height: height,
bidId: bidRequest.bidId,
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: bidderRequest.refererInfo.page,
};
return {
method: 'POST',
diff --git a/modules/collectcentBidAdapter.md b/modules/collectcentBidAdapter.md
deleted file mode 100644
index 938bdc420cd..00000000000
--- a/modules/collectcentBidAdapter.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Overview
-
-```
-Module Name: Collectcent SSP Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: dev.collectcent@gmail.com
-```
-
-# Description
-
-Module that connects to Collectcent SSP demand sources
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'placementCode',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'collectcent',
- params: {
- placementId: 0,
- traffic: 'banner'
- }
- }]
- }
- ];
-```
diff --git a/modules/colombiaBidAdapter.md b/modules/colombiaBidAdapter.md
deleted file mode 100644
index c754e49771d..00000000000
--- a/modules/colombiaBidAdapter.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Overview
-
-```
-Module Name: COLOMBIA Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: colombiaonline@timesinteret.in
-```
-
-# Description
-
-Connect to COLOMBIA for bids.
-
-COLOMBIA adapter requires setup and approval from the COLOMBIA team. Please reach out to your account team or colombiaonline@timesinteret.in for more information.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'test-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250],[728,90],[320,50]]
- }
- },
- bids: [{
- bidder: 'colombia',
- params: {
- placementId: '307466'
- }
- }]
- }];
-```
diff --git a/modules/colossussspBidAdapter.js b/modules/colossussspBidAdapter.js
index 8fab37a433f..cd0721fa80f 100644
--- a/modules/colossussspBidAdapter.js
+++ b/modules/colossussspBidAdapter.js
@@ -75,7 +75,7 @@ export const spec = {
winLocation = window.location;
}
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const refferUrl = bidderRequest.refererInfo?.page;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
@@ -83,6 +83,7 @@ export const spec = {
logMessage(e);
}
+ // TODO: does the fallback to window.location make sense?
const location = refferLocation || winLocation;
let placements = [];
let request = {
diff --git a/modules/compassBidAdapter.js b/modules/compassBidAdapter.js
index 77f918276bc..e439e72d1d9 100644
--- a/modules/compassBidAdapter.js
+++ b/modules/compassBidAdapter.js
@@ -126,14 +126,14 @@ export const spec = {
winLocation = window.location;
}
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.page;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
} catch (e) {
logMessage(e);
}
-
+ // TODO: does the fallback make sense here?
let location = refferLocation || winLocation;
const language = (navigator && navigator.language) ? navigator.language.split('-')[0] : '';
const host = location.host;
diff --git a/modules/concertBidAdapter.js b/modules/concertBidAdapter.js
index 99e2492fb94..398248bfeab 100644
--- a/modules/concertBidAdapter.js
+++ b/modules/concertBidAdapter.js
@@ -36,7 +36,7 @@ export const spec = {
let payload = {
meta: {
prebidVersion: '$prebid.version$',
- pageUrl: bidderRequest.refererInfo.referer,
+ pageUrl: bidderRequest.refererInfo.page,
screen: [window.screen.width, window.screen.height].join('x'),
debug: debugTurnedOn(),
uid: getUid(bidderRequest),
@@ -57,7 +57,7 @@ export const spec = {
slotType: bidRequest.params.slotType,
adSlot: bidRequest.params.slot || bidRequest.adUnitCode,
placementId: bidRequest.params.placementId || '',
- site: bidRequest.params.site || bidderRequest.refererInfo.referer
+ site: bidRequest.params.site || bidderRequest.refererInfo.page
}
return slot;
diff --git a/modules/connectadBidAdapter.js b/modules/connectadBidAdapter.js
index 711afd98d0f..5185308eab0 100644
--- a/modules/connectadBidAdapter.js
+++ b/modules/connectadBidAdapter.js
@@ -35,9 +35,11 @@ export const spec = {
placements: [],
time: Date.now(),
user: {},
- url: (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) ? bidderRequest.refererInfo.referer : window.location.href,
- referrer: window.document.referrer,
- referrer_info: bidderRequest.refererInfo,
+ // TODO: does the fallback to window.location make sense?
+ url: bidderRequest.refererInfo?.page || window.location.href,
+ referrer: bidderRequest.refererInfo?.ref,
+ // TODO: please do not send internal data structures over the network
+ referrer_info: bidderRequest.refererInfo?.legacy,
screensize: getScreenSize(),
dnt: (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0,
language: navigator.language,
diff --git a/modules/consentManagement.js b/modules/consentManagement.js
index 5fbcc0f8ac1..71c47b62407 100644
--- a/modules/consentManagement.js
+++ b/modules/consentManagement.js
@@ -4,25 +4,20 @@
* and make it available for any GDPR supported adapters to read/pass this information to
* their system.
*/
-import {getAdUnitSizes, isFn, isNumber, isPlainObject, isStr, logError, logInfo, logWarn} from '../src/utils.js';
+import {isNumber, isPlainObject, isStr, logError, logInfo, logWarn} from '../src/utils.js';
import {config} from '../src/config.js';
import {gdprDataHandler} from '../src/adapterManager.js';
import {includes} from '../src/polyfill.js';
const DEFAULT_CMP = 'iab';
const DEFAULT_CONSENT_TIMEOUT = 10000;
-const DEFAULT_ALLOW_AUCTION_WO_CONSENT = true;
+const CMP_VERSION = 2;
-export const allowAuction = {
- value: DEFAULT_ALLOW_AUCTION_WO_CONSENT,
- definedInConfig: false
-}
export let userCMP;
export let consentTimeout;
export let gdprScope;
export let staticConsentData;
-let cmpVersion = 0;
let consentData;
let addedConsentHook = false;
@@ -46,24 +41,16 @@ function lookupStaticConsentData({onSuccess, onError}) {
* based on the appropriate result.
* @param {function({})} onSuccess acts as a success callback when CMP returns a value; pass along consentObjectfrom CMP
* @param {function(string, ...{}?)} cmpError acts as an error callback while interacting with CMP; pass along an error message (string) and any extra error arguments (purely for logging)
- * @param width
- * @param height size info passed to the SafeFrame API (used only for TCFv1 when Prebid is running within a safeframe)
*/
-function lookupIabConsent({onSuccess, onError, width, height}) {
+function lookupIabConsent({onSuccess, onError}) {
function findCMP() {
let f = window;
let cmpFrame;
let cmpFunction;
- while (!cmpFrame) {
+ while (true) {
try {
- if (typeof f.__tcfapi === 'function' || typeof f.__cmp === 'function') {
- if (typeof f.__tcfapi === 'function') {
- cmpVersion = 2;
- cmpFunction = f.__tcfapi;
- } else {
- cmpVersion = 1;
- cmpFunction = f.__cmp;
- }
+ if (typeof f.__tcfapi === 'function') {
+ cmpFunction = f.__tcfapi;
cmpFrame = f;
break;
}
@@ -72,15 +59,6 @@ function lookupIabConsent({onSuccess, onError, width, height}) {
// need separate try/catch blocks due to the exception errors thrown when trying to check for a frame that doesn't exist in 3rd party env
try {
if (f.frames['__tcfapiLocator']) {
- cmpVersion = 2;
- cmpFrame = f;
- break;
- }
- } catch (e) { }
-
- try {
- if (f.frames['__cmpLocator']) {
- cmpVersion = 1;
cmpFrame = f;
break;
}
@@ -95,7 +73,7 @@ function lookupIabConsent({onSuccess, onError, width, height}) {
};
}
- function v2CmpResponseCallback(tcfData, success) {
+ function cmpResponseCallback(tcfData, success) {
logInfo('Received a response from CMP', tcfData);
if (success) {
if (tcfData.gdprApplies === false || tcfData.eventStatus === 'tcloaded' || tcfData.eventStatus === 'useractioncomplete') {
@@ -106,31 +84,8 @@ function lookupIabConsent({onSuccess, onError, width, height}) {
}
}
- function handleV1CmpResponseCallbacks() {
- const cmpResponse = {};
-
- function afterEach() {
- if (cmpResponse.getConsentData && cmpResponse.getVendorConsents) {
- logInfo('Received all requested responses from CMP', cmpResponse);
- processCmpData(cmpResponse, {onSuccess, onError});
- }
- }
-
- return {
- consentDataCallback: function (consentResponse) {
- cmpResponse.getConsentData = consentResponse;
- afterEach();
- },
- vendorConsentsCallback: function (consentResponse) {
- cmpResponse.getVendorConsents = consentResponse;
- afterEach();
- }
- }
- }
-
- let v1CallbackHandler = handleV1CmpResponseCallbacks();
- let cmpCallbacks = {};
- let { cmpFrame, cmpFunction } = findCMP();
+ const cmpCallbacks = {};
+ const { cmpFrame, cmpFunction } = findCMP();
if (!cmpFrame) {
return onError('CMP not found.');
@@ -145,100 +100,47 @@ function lookupIabConsent({onSuccess, onError, width, height}) {
// else assume prebid may be inside an iframe and use the IAB CMP locator code to see if CMP's located in a higher parent window. this works in cross domain iframes
// if the CMP is not found, the iframe function will call the cmpError exit callback to abort the rest of the CMP workflow
- if (isFn(cmpFunction)) {
+ if (typeof cmpFunction === 'function') {
logInfo('Detected CMP API is directly accessible, calling it now...');
- if (cmpVersion === 1) {
- cmpFunction('getConsentData', null, v1CallbackHandler.consentDataCallback);
- cmpFunction('getVendorConsents', null, v1CallbackHandler.vendorConsentsCallback);
- } else if (cmpVersion === 2) {
- cmpFunction('addEventListener', cmpVersion, v2CmpResponseCallback);
- }
- } else if (cmpVersion === 1 && inASafeFrame() && typeof window.$sf.ext.cmp === 'function') {
- // this safeframe workflow is only supported with TCF v1 spec; the v2 recommends to use the iframe postMessage route instead (even if you are in a safeframe).
- logInfo('Detected Prebid.js is encased in a SafeFrame and CMP is registered, calling it now...');
- callCmpWhileInSafeFrame('getConsentData', v1CallbackHandler.consentDataCallback);
- callCmpWhileInSafeFrame('getVendorConsents', v1CallbackHandler.vendorConsentsCallback);
+ cmpFunction('addEventListener', CMP_VERSION, cmpResponseCallback);
} else {
logInfo('Detected CMP is outside the current iframe where Prebid.js is located, calling it now...');
- if (cmpVersion === 1) {
- callCmpWhileInIframe('getConsentData', cmpFrame, v1CallbackHandler.consentDataCallback);
- callCmpWhileInIframe('getVendorConsents', cmpFrame, v1CallbackHandler.vendorConsentsCallback);
- } else if (cmpVersion === 2) {
- callCmpWhileInIframe('addEventListener', cmpFrame, v2CmpResponseCallback);
- }
- }
-
- function inASafeFrame() {
- return !!(window.$sf && window.$sf.ext);
- }
-
- function callCmpWhileInSafeFrame(commandName, callback) {
- function sfCallback(msgName, data) {
- if (msgName === 'cmpReturn') {
- let responseObj = (commandName === 'getConsentData') ? data.vendorConsentData : data.vendorConsents;
- callback(responseObj);
- }
- }
-
- window.$sf.ext.register(width, height, sfCallback);
- window.$sf.ext.cmp(commandName);
+ callCmpWhileInIframe('addEventListener', cmpFrame, cmpResponseCallback);
}
function callCmpWhileInIframe(commandName, cmpFrame, moduleCallback) {
- let apiName = (cmpVersion === 2) ? '__tcfapi' : '__cmp';
+ const apiName = '__tcfapi';
- let callName = `${apiName}Call`;
+ const callName = `${apiName}Call`;
/* Setup up a __cmp function to do the postMessage and stash the callback.
This function behaves (from the caller's perspective identicially to the in-frame __cmp call */
- if (cmpVersion === 2) {
- window[apiName] = function (cmd, cmpVersion, callback, arg) {
- let callId = Math.random() + '';
- let msg = {
- [callName]: {
- command: cmd,
- version: cmpVersion,
- parameter: arg,
- callId: callId
- }
- };
-
- cmpCallbacks[callId] = callback;
- cmpFrame.postMessage(msg, '*');
- }
-
- /** when we get the return message, call the stashed callback */
- window.addEventListener('message', readPostMessageResponse, false);
+ window[apiName] = function (cmd, cmpVersion, callback, arg) {
+ const callId = Math.random() + '';
+ const msg = {
+ [callName]: {
+ command: cmd,
+ version: cmpVersion,
+ parameter: arg,
+ callId: callId
+ }
+ };
- // call CMP
- window[apiName](commandName, cmpVersion, moduleCallback);
- } else {
- window[apiName] = function (cmd, arg, callback) {
- let callId = Math.random() + '';
- let msg = {
- [callName]: {
- command: cmd,
- parameter: arg,
- callId: callId
- }
- };
-
- cmpCallbacks[callId] = callback;
- cmpFrame.postMessage(msg, '*');
- }
+ cmpCallbacks[callId] = callback;
+ cmpFrame.postMessage(msg, '*');
+ }
- /** when we get the return message, call the stashed callback */
- window.addEventListener('message', readPostMessageResponse, false);
+ /** when we get the return message, call the stashed callback */
+ window.addEventListener('message', readPostMessageResponse, false);
- // call CMP
- window[apiName](commandName, undefined, moduleCallback);
- }
+ // call CMP
+ window[apiName](commandName, CMP_VERSION, moduleCallback);
function readPostMessageResponse(event) {
- let cmpDataPkgName = `${apiName}Return`;
- let json = (typeof event.data === 'string' && includes(event.data, cmpDataPkgName)) ? JSON.parse(event.data) : event.data;
+ const cmpDataPkgName = `${apiName}Return`;
+ const json = (typeof event.data === 'string' && includes(event.data, cmpDataPkgName)) ? JSON.parse(event.data) : event.data;
if (json[cmpDataPkgName] && json[cmpDataPkgName].callId) {
- let payload = json[cmpDataPkgName];
+ const payload = json[cmpDataPkgName];
// TODO - clean up this logic (move listeners?); we have duplicate messages responses because 2 eventlisteners are active from the 2 cmp requests running in parallel
if (typeof cmpCallbacks[payload.callId] !== 'undefined') {
cmpCallbacks[payload.callId](payload.returnValue, payload.success);
@@ -253,11 +155,8 @@ function lookupIabConsent({onSuccess, onError, width, height}) {
*
* @param cb A callback that takes: a boolean that is true if the auction should be canceled; an error message and extra
* error arguments that will be undefined if there's no error.
- * @param width if we are running in an iframe, the TCFv1 spec requires us to use the SafeFrame API to find the CMP - which
- * in turn requires width and height.
- * @param height see width above
*/
-function loadConsentData(cb, width = 1, height = 1) {
+function loadConsentData(cb) {
let isDone = false;
let timer = null;
@@ -267,7 +166,7 @@ function loadConsentData(cb, width = 1, height = 1) {
}
isDone = true;
gdprDataHandler.setConsentData(consentData);
- if (cb != null) {
+ if (typeof cb === 'function') {
cb(shouldCancelAuction, errMsg, ...extraArgs);
}
}
@@ -280,38 +179,37 @@ function loadConsentData(cb, width = 1, height = 1) {
const callbacks = {
onSuccess: (data) => done(data, false),
onError: function (msg, ...extraArgs) {
- let consentData = null;
- let shouldCancelAuction = true;
- if (allowAuction.value && cmpVersion === 1) {
- // still set the consentData to undefined when there is a problem as per config options
- consentData = storeConsentData(undefined);
- shouldCancelAuction = false;
- }
- done(consentData, shouldCancelAuction, msg, ...extraArgs);
+ done(null, true, msg, ...extraArgs);
}
}
- cmpCallMap[userCMP]({
- width,
- height,
- ...callbacks
- });
+ cmpCallMap[userCMP](callbacks);
if (!isDone) {
if (consentTimeout === 0) {
- processCmpData(undefined, callbacks);
+ done(storeConsentData(undefined), false)
} else {
timer = setTimeout(function () {
- if (cmpVersion === 2) {
- // for TCFv2, we allow the auction to continue on timeout
- done(storeConsentData(undefined), false, `No response from CMP, continuing auction...`)
- } else {
- callbacks.onError('CMP workflow exceeded timeout threshold.');
- }
+ // on timeout, allow the auction to continue
+ done(storeConsentData(undefined), false, `No response from CMP, continuing auction...`)
}, consentTimeout);
}
}
}
+/**
+ * Like `loadConsentData`, but cache and re-use previously loaded data.
+ * @param cb
+ */
+function loadIfMissing(cb) {
+ if (consentData) {
+ logInfo('User consent information already known. Pulling internally stored information...');
+ // eslint-disable-next-line standard/no-callback-literal
+ cb(false);
+ } else {
+ loadConsentData(cb);
+ }
+}
+
/**
* If consentManagement module is enabled (ie included in setConfig), this hook function will attempt to fetch the
* user's encoded consent string from the supported CMP. Once obtained, the module will store this
@@ -321,36 +219,10 @@ function loadConsentData(cb, width = 1, height = 1) {
* @param {function} fn required; The next function in the chain, used by hook.js
*/
export function requestBidsHook(fn, reqBidsConfigObj) {
- const load = (() => {
- if (consentData) {
- logInfo('User consent information already known. Pulling internally stored information...');
- return function (cb) {
- // eslint-disable-next-line standard/no-callback-literal
- cb(false);
- }
- } else {
- // find sizes from adUnits object
- let adUnits = reqBidsConfigObj.adUnits || $$PREBID_GLOBAL$$.adUnits;
- let width = 1;
- let height = 1;
- if (Array.isArray(adUnits) && adUnits.length > 0) {
- let sizes = getAdUnitSizes(adUnits[0]);
- width = sizes?.[0]?.[0] || 1;
- height = sizes?.[0]?.[1] || 1;
- }
-
- return function (cb) {
- loadConsentData(cb, width, height);
- }
- }
- })();
-
- load(function (shouldCancelAuction, errMsg, ...extraArgs) {
+ loadIfMissing(function (shouldCancelAuction, errMsg, ...extraArgs) {
if (errMsg) {
let log = logWarn;
- if (cmpVersion === 1 && !shouldCancelAuction) {
- errMsg = `${errMsg} 'allowAuctionWithoutConsent' activated.`;
- } else if (shouldCancelAuction) {
+ if (shouldCancelAuction) {
log = logError;
errMsg = `${errMsg} Canceling auction as per consentManagement config.`;
}
@@ -375,23 +247,10 @@ export function requestBidsHook(fn, reqBidsConfigObj) {
* If it's good, then we store the value and call `onSuccess`
*/
function processCmpData(consentObject, {onSuccess, onError}) {
- function checkV1Data(consentObject) {
- let gdprApplies = consentObject && consentObject.getConsentData && consentObject.getConsentData.gdprApplies;
- return !!(
- (typeof gdprApplies !== 'boolean') ||
- (gdprApplies === true &&
- !(isStr(consentObject.getConsentData.consentData) &&
- isPlainObject(consentObject.getVendorConsents) &&
- Object.keys(consentObject.getVendorConsents).length > 1
- )
- )
- );
- }
-
- function checkV2Data() {
+ function checkData() {
// if CMP does not respond with a gdprApplies boolean, use defaultGdprScope (gdprScope)
- let gdprApplies = consentObject && typeof consentObject.gdprApplies === 'boolean' ? consentObject.gdprApplies : gdprScope;
- let tcString = consentObject && consentObject.tcString;
+ const gdprApplies = consentObject && typeof consentObject.gdprApplies === 'boolean' ? consentObject.gdprApplies : gdprScope;
+ const tcString = consentObject && consentObject.tcString;
return !!(
(typeof gdprApplies !== 'boolean') ||
(gdprApplies === true && !isStr(tcString))
@@ -400,24 +259,13 @@ function processCmpData(consentObject, {onSuccess, onError}) {
// do extra things for static config
if (userCMP === 'static') {
- cmpVersion = (consentObject.getConsentData) ? 1 : (consentObject.getTCData) ? 2 : 0;
- // remove extra layer in static v2 data object so it matches normal v2 CMP object for processing step
- if (cmpVersion === 2) {
- consentObject = consentObject.getTCData;
- }
+ consentObject = consentObject.getTCData;
}
- // determine which set of checks to run based on cmpVersion
- let checkFn = (cmpVersion === 1) ? checkV1Data : (cmpVersion === 2) ? checkV2Data : null;
-
- if (isFn(checkFn)) {
- if (checkFn(consentObject)) {
- onError(`CMP returned unexpected value during lookup process.`, consentObject);
- } else {
- onSuccess(storeConsentData(consentObject));
- }
+ if (checkData()) {
+ onError(`CMP returned unexpected value during lookup process.`, consentObject);
} else {
- onError('Unable to derive CMP version to process data. Consent object does not conform to TCF v1 or v2 specs.', consentObject);
+ onSuccess(storeConsentData(consentObject));
}
}
@@ -426,23 +274,15 @@ function processCmpData(consentObject, {onSuccess, onError}) {
* @param {object} cmpConsentObject required; an object representing user's consent choices (can be undefined in certain use-cases for this function only)
*/
function storeConsentData(cmpConsentObject) {
- if (cmpVersion === 1) {
- consentData = {
- consentString: (cmpConsentObject) ? cmpConsentObject.getConsentData.consentData : undefined,
- vendorData: (cmpConsentObject) ? cmpConsentObject.getVendorConsents : undefined,
- gdprApplies: (cmpConsentObject) ? cmpConsentObject.getConsentData.gdprApplies : gdprScope
- };
- } else {
- consentData = {
- consentString: (cmpConsentObject) ? cmpConsentObject.tcString : undefined,
- vendorData: (cmpConsentObject) || undefined,
- gdprApplies: cmpConsentObject && typeof cmpConsentObject.gdprApplies === 'boolean' ? cmpConsentObject.gdprApplies : gdprScope
- };
- if (cmpConsentObject && cmpConsentObject.addtlConsent && isStr(cmpConsentObject.addtlConsent)) {
- consentData.addtlConsent = cmpConsentObject.addtlConsent;
- };
+ consentData = {
+ consentString: (cmpConsentObject) ? cmpConsentObject.tcString : undefined,
+ vendorData: (cmpConsentObject) || undefined,
+ gdprApplies: cmpConsentObject && typeof cmpConsentObject.gdprApplies === 'boolean' ? cmpConsentObject.gdprApplies : gdprScope
+ };
+ if (cmpConsentObject && cmpConsentObject.addtlConsent && isStr(cmpConsentObject.addtlConsent)) {
+ consentData.addtlConsent = cmpConsentObject.addtlConsent;
}
- consentData.apiVersion = cmpVersion;
+ consentData.apiVersion = CMP_VERSION;
return consentData;
}
@@ -452,7 +292,7 @@ function storeConsentData(cmpConsentObject) {
export function resetConsentData() {
consentData = undefined;
userCMP = undefined;
- cmpVersion = 0;
+ consentTimeout = undefined;
gdprDataHandler.reset();
}
@@ -482,11 +322,6 @@ export function setConsentConfig(config) {
logInfo(`consentManagement config did not specify timeout. Using system default setting (${DEFAULT_CONSENT_TIMEOUT}).`);
}
- if (typeof config.allowAuctionWithoutConsent === 'boolean') {
- allowAuction.value = config.allowAuctionWithoutConsent;
- allowAuction.definedInConfig = true;
- }
-
// if true, then gdprApplies should be set to true
gdprScope = config.defaultGdprScope === true;
@@ -506,12 +341,5 @@ export function setConsentConfig(config) {
addedConsentHook = true;
gdprDataHandler.enable();
loadConsentData(); // immediately look up consent data to make it available without requiring an auction
-
- // Raise deprecation warning if 'allowAuctionWithoutConsent' is used with TCF 2.
- if (allowAuction.definedInConfig && cmpVersion === 2) {
- logWarn(`'allowAuctionWithoutConsent' ignored for TCF 2`);
- } else if (!allowAuction.definedInConfig && cmpVersion === 1) {
- logInfo(`'allowAuctionWithoutConsent' using system default: (${DEFAULT_ALLOW_AUCTION_WO_CONSENT}).`);
- }
}
config.getConfig('consentManagement', config => setConsentConfig(config.consentManagement));
diff --git a/modules/consentManagementUsp.js b/modules/consentManagementUsp.js
index d6bf913b366..0224d6ef2c0 100644
--- a/modules/consentManagementUsp.js
+++ b/modules/consentManagementUsp.js
@@ -7,13 +7,14 @@
import { isFn, logInfo, logWarn, isStr, isNumber, isPlainObject, logError } from '../src/utils.js';
import { config } from '../src/config.js';
import { uspDataHandler } from '../src/adapterManager.js';
+import {getGlobal} from '../src/prebidGlobal.js';
const DEFAULT_CONSENT_API = 'iab';
const DEFAULT_CONSENT_TIMEOUT = 50;
const USPAPI_VERSION = 1;
-export let consentAPI;
-export let consentTimeout;
+export let consentAPI = DEFAULT_CONSENT_API;
+export let consentTimeout = DEFAULT_CONSENT_TIMEOUT;
export let staticConsentData;
let consentData;
@@ -254,7 +255,10 @@ function storeUspConsentData(consentObject) {
export function resetConsentData() {
consentData = undefined;
consentAPI = undefined;
+ consentTimeout = undefined;
uspDataHandler.reset();
+ getGlobal().requestBids.getHooks({hook: requestBidsHook}).remove();
+ addedConsentHook = false;
}
/**
@@ -264,25 +268,21 @@ export function resetConsentData() {
export function setConsentConfig(config) {
config = config && config.usp;
if (!config || typeof config !== 'object') {
- logWarn('consentManagement.usp config not defined, exiting usp consent manager');
- return;
+ logWarn('consentManagement.usp config not defined, using defaults');
}
- if (isStr(config.cmpApi)) {
+ if (config && isStr(config.cmpApi)) {
consentAPI = config.cmpApi;
} else {
consentAPI = DEFAULT_CONSENT_API;
logInfo(`consentManagement.usp config did not specify cmpApi. Using system default setting (${DEFAULT_CONSENT_API}).`);
}
- if (isNumber(config.timeout)) {
+ if (config && isNumber(config.timeout)) {
consentTimeout = config.timeout;
} else {
consentTimeout = DEFAULT_CONSENT_TIMEOUT;
logInfo(`consentManagement.usp config did not specify timeout. Using system default setting (${DEFAULT_CONSENT_TIMEOUT}).`);
}
-
- logInfo('USPAPI consentManagement module has been activated...');
-
if (consentAPI === 'static') {
if (isPlainObject(config.consentData) && isPlainObject(config.consentData.getUSPData)) {
if (config.consentData.getUSPData.uspString) staticConsentData = { usPrivacy: config.consentData.getUSPData.uspString };
@@ -291,11 +291,17 @@ export function setConsentConfig(config) {
logError(`consentManagement config with cmpApi: 'static' did not specify consentData. No consents will be available to adapters.`);
}
}
+ enableConsentManagement(true);
+}
+
+function enableConsentManagement(configFromUser = false) {
if (!addedConsentHook) {
- $$PREBID_GLOBAL$$.requestBids.before(requestBidsHook, 50);
+ logInfo(`USPAPI consentManagement module has been activated${configFromUser ? '' : ` using default values (api: '${consentAPI}', timeout: ${consentTimeout}ms)`}`);
+ getGlobal().requestBids.before(requestBidsHook, 50);
}
addedConsentHook = true;
uspDataHandler.enable();
loadConsentData(); // immediately look up consent data to make it available without requiring an auction
}
config.getConfig('consentManagement', config => setConsentConfig(config.consentManagement));
+setTimeout(() => !addedConsentHook && enableConsentManagement())
diff --git a/modules/consumableBidAdapter.js b/modules/consumableBidAdapter.js
index de08fc8677a..afdf34b72c1 100644
--- a/modules/consumableBidAdapter.js
+++ b/modules/consumableBidAdapter.js
@@ -47,8 +47,8 @@ export const spec = {
const data = Object.assign({
placements: [],
time: Date.now(),
- url: bidderRequest.refererInfo.referer,
- referrer: document.referrer,
+ url: bidderRequest.refererInfo.page,
+ referrer: bidderRequest.refererInfo.ref,
source: [{
'name': 'prebidjs',
'version': '$prebid.version$'
@@ -123,7 +123,7 @@ export const spec = {
bid.creativeId = decision.adId;
bid.ttl = 30;
bid.netRevenue = true;
- bid.referrer = bidRequest.bidderRequest.refererInfo.referer;
+ bid.referrer = bidRequest.bidderRequest.refererInfo.page;
bid.meta = {
advertiserDomains: decision.adomain || []
diff --git a/modules/contentexchangeBidAdapter.js b/modules/contentexchangeBidAdapter.js
index b3a5056f816..906359252ee 100644
--- a/modules/contentexchangeBidAdapter.js
+++ b/modules/contentexchangeBidAdapter.js
@@ -127,7 +127,7 @@ export const spec = {
winLocation = window.location;
}
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.page;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
@@ -135,6 +135,7 @@ export const spec = {
logMessage(e);
}
+ // TODO: does the fallback to 'window.location' make sense?
let location = refferLocation || winLocation;
const language = (navigator && navigator.language) ? navigator.language.split('-')[0] : '';
const host = location.host;
diff --git a/modules/contentigniteBidAdapter.md b/modules/contentigniteBidAdapter.md
deleted file mode 100644
index 1f3a543b621..00000000000
--- a/modules/contentigniteBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-```
-Module Name: Content Ignite Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: jamie@contentignite.com
-```
-
-# Description
-
-Module that connects to Content Ignites bidder application.
-
-# Test Parameters
-
-```
- var adUnits = [{
- code: 'display-div',
- sizes: [[728, 90]], // a display size
- bids: [{
- bidder: "contentignite",
- params: {
- accountID: '168237',
- zoneID: '299680',
- keyword: 'business', //optional
- minCPM: '0.10', //optional
- maxCPM: '1.00' //optional
- }
- }]
- }];
-```
diff --git a/modules/conversantBidAdapter.js b/modules/conversantBidAdapter.js
index a6b631372e0..41a8200c6ea 100644
--- a/modules/conversantBidAdapter.js
+++ b/modules/conversantBidAdapter.js
@@ -2,7 +2,6 @@ import { logWarn, isStr, deepAccess, isArray, getBidIdParameter, deepSetValue, i
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {getStorageManager} from '../src/storageManager.js';
-import { config } from '../src/config.js';
const GVLID = 24;
@@ -55,7 +54,7 @@ export const spec = {
* @return {ServerRequest} Info describing the request to the server.
*/
buildRequests: function(validBidRequests, bidderRequest) {
- const page = (bidderRequest && bidderRequest.refererInfo) ? bidderRequest.refererInfo.referer : '';
+ const page = (bidderRequest && bidderRequest.refererInfo) ? bidderRequest.refererInfo.page : '';
let siteId = '';
let requestId = '';
let pubcid = null;
@@ -177,7 +176,7 @@ export const spec = {
payload.user = {ext: userExt};
}
- const firstPartyData = config.getConfig('ortb2') || {};
+ const firstPartyData = bidderRequest.ortb2 || {};
mergeDeep(payload, firstPartyData);
return {
diff --git a/modules/cosmosBidAdapter.md b/modules/cosmosBidAdapter.md
deleted file mode 100644
index 187a19ba17a..00000000000
--- a/modules/cosmosBidAdapter.md
+++ /dev/null
@@ -1,80 +0,0 @@
-# Overview
-
-```
-Module Name: Cosmos Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: dev@cosmoshq.com
-```
-
-# Description
-
-Module that connects to Cosmos server for bids.
-Supported Ad Fortmats:
-* Banner
-* Video
-
-# Configuration
-## Following configuration required for enabling user sync.
-```javascript
-pbjs.setConfig({
- userSync: {
- iframeEnabled: true,
- enabledBidders: ['cosmos'],
- syncDelay: 6000
- }});
-```
-## For Video ads, enable prebid cache
-```javascript
-pbjs.setConfig({
- cache: {
- url: 'https://prebid.adnxs.com/pbc/v1/cache'
- }
-});
-```
-
-# Test Parameters
-```
- var adUnits = [
- // Banner adUnit
- {
- code: 'banner-div',
- mediaTypes: {
- banner: { //supported as per the openRTB spec
- sizes: [[300, 250]] // required
- }
- },
- bids: [
- {
- bidder: "cosmos",
- params: {
- publisherId: 1001, // required
- tagId: 1 // optional
- }
- }
- ]
- },
- // Video adUnit
- {
- code: 'video-div',
- mediaTypes: {
- video: { // supported as per the openRTB spec
- sizes: [[300, 50]], // required
- mimes : ['video/mp4', 'application/javascript'], // required
- context: 'instream' // optional
- }
- },
- bids: [
- {
- bidder: "cosmos",
- params: {
- publisherId: 1001, // required
- tagId: 1, // optional
- video: { // supported as per the openRTB spec
-
- }
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/cpmstarBidAdapter.js b/modules/cpmstarBidAdapter.js
index 75a7007ee36..6e32c5c4713 100755
--- a/modules/cpmstarBidAdapter.js
+++ b/modules/cpmstarBidAdapter.js
@@ -46,7 +46,8 @@ export const spec = {
for (var i = 0; i < validBidRequests.length; i++) {
var bidRequest = validBidRequests[i];
- var referer = encodeURIComponent(bidderRequest.refererInfo.referer);
+ // TODO: is 'page' the right value here?
+ var referer = encodeURIComponent(bidderRequest.refererInfo.page);
var e = getBidIdParameter('endpoint', bidRequest.params);
var ENDPOINT = e == 'dev' ? ENDPOINT_DEV : e == 'staging' ? ENDPOINT_STAGING : ENDPOINT_PRODUCTION;
var mediaType = spec.getMediaType(bidRequest);
diff --git a/modules/craftBidAdapter.js b/modules/craftBidAdapter.js
index 61ca4f929e7..147e45d3d65 100644
--- a/modules/craftBidAdapter.js
+++ b/modules/craftBidAdapter.js
@@ -1,7 +1,6 @@
import {
convertCamelToUnderscore,
convertTypes,
- deepAccess,
getBidRequest,
isArray,
isEmpty,
@@ -14,6 +13,7 @@ import {auctionManager} from '../src/auctionManager.js';
import {find, includes} from '../src/polyfill.js';
import {getStorageManager} from '../src/storageManager.js';
import {ajax} from '../src/ajax.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'craft';
const URL_BASE = 'https://gacraft.jp/prebid-v3';
@@ -51,7 +51,8 @@ export const spec = {
}
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: bidderRequest.refererInfo.referer,
+ // TODO: this collects everything it finds, except for the canonical URL
+ rd_ref: bidderRequest.refererInfo.topmostLocation,
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
};
@@ -136,19 +137,9 @@ function deleteValues(keyPairObj) {
}
}
-function hasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
function formatRequest(payload, bidderRequest) {
let options = {};
- if (!hasPurpose1Consent(bidderRequest)) {
+ if (!hasPurpose1Consent(bidderRequest?.gdprConsent)) {
options = {
withCredentials: false
};
diff --git a/modules/criteoBidAdapter.js b/modules/criteoBidAdapter.js
index e6f648cad0c..dfcca535728 100644
--- a/modules/criteoBidAdapter.js
+++ b/modules/criteoBidAdapter.js
@@ -65,7 +65,7 @@ export const spec = {
buildRequests: (bidRequests, bidderRequest) => {
let url;
let data;
- let fpd = config.getConfig('ortb2') || {};
+ let fpd = bidderRequest.ortb2 || {};
Object.assign(bidderRequest, {
publisherExt: fpd.site?.ext,
@@ -224,9 +224,9 @@ function publisherTagAvailable() {
function buildContext(bidRequests, bidderRequest) {
let referrer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referrer = bidderRequest.refererInfo.referer;
+ referrer = bidderRequest.refererInfo.page;
}
- const queryString = parseUrl(referrer).search;
+ const queryString = parseUrl(bidderRequest?.refererInfo?.topmostLocation).search;
const context = {
url: referrer,
diff --git a/modules/criteoIdSystem.js b/modules/criteoIdSystem.js
index c73c4422a77..d7dff9949f4 100644
--- a/modules/criteoIdSystem.js
+++ b/modules/criteoIdSystem.js
@@ -90,7 +90,8 @@ function buildCriteoUsersyncUrl(topUrl, domain, bundle, areCookiesWriteable, isL
function callCriteoUserSync(parsedCriteoData, gdprString, callback) {
const cw = storage.cookiesAreEnabled();
const lsw = storage.localStorageIsEnabled();
- const topUrl = extractProtocolHost(getRefererInfo().referer);
+ const topUrl = extractProtocolHost(getRefererInfo().page);
+ // TODO: should domain really be extracted from the current frame?
const domain = extractProtocolHost(document.location.href, true);
const isPublishertagPresent = typeof criteo_pubtag !== 'undefined'; // eslint-disable-line camelcase
diff --git a/modules/cwireBidAdapter.js b/modules/cwireBidAdapter.js
index c0a24b49a3c..27ce764be58 100644
--- a/modules/cwireBidAdapter.js
+++ b/modules/cwireBidAdapter.js
@@ -1,5 +1,4 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
-import {getRefererInfo} from '../src/refererDetection.js';
import {getStorageManager} from '../src/storageManager.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {OUTSTREAM} from '../src/video.js';
@@ -170,7 +169,7 @@ export const spec = {
let slots = [];
let referer;
try {
- referer = getRefererInfo().referer;
+ referer = bidderRequest?.refererInfo?.page;
slots = mapSlotsData(validBidRequests);
} catch (e) {
logWarn(e);
diff --git a/modules/dailyhuntBidAdapter.js b/modules/dailyhuntBidAdapter.js
index ffa84ff88fd..590f3e79f85 100644
--- a/modules/dailyhuntBidAdapter.js
+++ b/modules/dailyhuntBidAdapter.js
@@ -96,7 +96,7 @@ const flatten = (arr) => {
const createOrtbRequest = (validBidRequests, bidderRequest) => {
let device = createOrtbDeviceObj(validBidRequests);
let user = createOrtbUserObj(validBidRequests)
- let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.referer)
+ let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.page)
return {
id: bidderRequest.auctionId,
imp: [],
diff --git a/modules/danmarketBidAdapter.md b/modules/danmarketBidAdapter.md
deleted file mode 100644
index 8ddc83d2cf6..00000000000
--- a/modules/danmarketBidAdapter.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Overview
-
-Module Name: Dentsu Aegis Network Marketplace Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: niels@baarsma.net
-
-# Description
-
-Module that connects to DAN Marketplace demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "danmarket",
- params: {
- uid: '4',
- priceType: 'gross' // by default is 'net'
- }
- }
- ]
- },{
- code: 'test-div',
- sizes: [[728, 90]],
- bids: [
- {
- bidder: "danmarket",
- params: {
- uid: 5,
- priceType: 'gross'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/datablocksBidAdapter.js b/modules/datablocksBidAdapter.js
index b240db1dd25..fb036d4ff0c 100644
--- a/modules/datablocksBidAdapter.js
+++ b/modules/datablocksBidAdapter.js
@@ -347,10 +347,11 @@ export const spec = {
// GENERATE SITE OBJECT
let site = {
domain: window.location.host,
- page: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ page: bidderRequest.refererInfo.page,
schain: validRequests[0].schain || {},
ext: {
- p_domain: config.getConfig('publisherDomain'),
+ p_domain: bidderRequest.refererInfo.domain,
rt: bidderRequest.refererInfo.reachedTop,
frames: bidderRequest.refererInfo.numIframes,
stack: bidderRequest.refererInfo.stack,
@@ -383,7 +384,7 @@ export const spec = {
gdpr: bidderRequest.gdprConsent || {},
usp: bidderRequest.uspConsent || {},
client_info: this.get_client_info(),
- ortb2: config.getConfig('ortb2') || {}
+ ortb2: bidderRequest.ortb2 || {}
}
};
diff --git a/modules/decenteradsBidAdapter.md b/modules/decenteradsBidAdapter.md
deleted file mode 100644
index 04260a9da58..00000000000
--- a/modules/decenteradsBidAdapter.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Overview
-
-```
-Module Name: DecenterAds Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: publishers@decenterads.com
-```
-
-# Description
-
-Module that connects to DecenterAds' demand sources
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'placementId_0',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'decenterads',
- params: {
- placementId: 0,
- traffic: 'banner'
- }
- }]
- }
- ];
-```
diff --git a/modules/deepintentBidAdapter.js b/modules/deepintentBidAdapter.js
index 94167b92bb0..e062686b320 100644
--- a/modules/deepintentBidAdapter.js
+++ b/modules/deepintentBidAdapter.js
@@ -262,21 +262,13 @@ function buildBanner(bid) {
function buildSite(bidderRequest) {
let site = {};
- if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- site.page = bidderRequest.refererInfo.referer;
- site.domain = getDomain(bidderRequest.refererInfo.referer);
+ if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ site.page = bidderRequest.refererInfo.page;
+ site.domain = bidderRequest.refererInfo.domain;
}
return site;
}
-function getDomain(referer) {
- if (referer) {
- let domainA = document.createElement('a');
- domainA.href = referer;
- return domainA.hostname;
- }
-}
-
function buildDevice() {
return {
ua: navigator.userAgent,
diff --git a/modules/deltaprojectsBidAdapter.js b/modules/deltaprojectsBidAdapter.js
index 33df5bd252e..e40ec58461c 100644
--- a/modules/deltaprojectsBidAdapter.js
+++ b/modules/deltaprojectsBidAdapter.js
@@ -1,8 +1,6 @@
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { BANNER } from '../src/mediaTypes.js';
-import {
- _each, _map, isFn, isNumber, createTrackPixelHtml, deepAccess, parseUrl, logWarn, logError
-} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {BANNER} from '../src/mediaTypes.js';
+import {_each, _map, createTrackPixelHtml, deepAccess, isFn, isNumber, logError, logWarn} from '../src/utils.js';
import {config} from '../src/config.js';
export const BIDDER_CODE = 'deltaprojects';
@@ -32,14 +30,13 @@ function buildRequests(validBidRequests, bidderRequest) {
const id = bidderRequest.auctionId;
// -- build site
- const loc = parseUrl(bidderRequest.refererInfo.referer);
const publisherId = setOnAny(validBidRequests, 'params.publisherId');
const siteId = setOnAny(validBidRequests, 'params.siteId');
const site = {
id: siteId,
- domain: loc.hostname,
- page: loc.href,
- ref: loc.href,
+ domain: bidderRequest.refererInfo.domain,
+ page: bidderRequest.refererInfo.page,
+ ref: bidderRequest.refererInfo.ref,
publisher: { id: publisherId },
};
diff --git a/modules/dgadsBidAdapter.md b/modules/dgadsBidAdapter.md
deleted file mode 100644
index b1544007a43..00000000000
--- a/modules/dgadsBidAdapter.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Overview
-
-```
-Module Name: Digital Garage Ads Platform Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer:dgads-support@garage.co.jp
-```
-
-# Description
-
-Connect to Digital Garage Ads Platform for bids.
-This adapter supports Banner and Native.
-
-# Test Parameters
-```
- var adUnits = [
- // Banner
- {
- code: 'banner-div',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'dgads',
- mediaTypes: 'banner',
- params: {
- location_id: '1',
- site_id: '1'
- }
- }]
- },
- // Native
- {
- code: 'native-div',
- sizes: [[300, 250]],
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 25
- },
- body: {
- required: true,
- len: 140
- },
- sponsoredBy: {
- required: true,
- len: 40
- },
- image: {
- required: true
- },
- clickUrl: {
- required: true
- },
- }
- },
- bids: [{
- bidder: 'dgads',
- params: {
- location_id: '10',
- site_id: '1'
- }
- }]
- },
- ];
-```
diff --git a/modules/dgkeywordRtdProvider.js b/modules/dgkeywordRtdProvider.js
index 26a8257077a..171766ac4ce 100644
--- a/modules/dgkeywordRtdProvider.js
+++ b/modules/dgkeywordRtdProvider.js
@@ -7,7 +7,7 @@
* @requires module:modules/realTimeData
*/
-import { logMessage, deepSetValue, logError, logInfo } from '../src/utils.js';
+import {logMessage, deepSetValue, logError, logInfo, mergeDeep} from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import { getGlobal } from '../src/prebidGlobal.js';
@@ -62,8 +62,7 @@ export function getDgKeywordsAndSet(reqBidsConfigObj, callback, moduleConfig, us
let addOrtb2 = {};
deepSetValue(addOrtb2, 'site.keywords', keywords);
deepSetValue(addOrtb2, 'user.keywords', keywords);
- const ortb2 = {ortb2: addOrtb2};
- reqBidsConfigObj.setBidderConfig({ bidders: Object.keys(targetBidKeys), config: ortb2 });
+ mergeDeep(reqBidsConfigObj.ortb2Fragments.bidder, Object.fromEntries(Object.keys(targetBidKeys).map(bidder => [bidder, addOrtb2])));
}
}
}
diff --git a/modules/displayioBidAdapter.js b/modules/displayioBidAdapter.js
index 55a2f4a8604..e039d461fc7 100644
--- a/modules/displayioBidAdapter.js
+++ b/modules/displayioBidAdapter.js
@@ -88,9 +88,10 @@ export const spec = {
keywords: params.keywords ? params.keywords.split(',').map(k => k.trim()) : [],
lang_content: document.documentElement.lang,
lang: window.navigator.language,
- domain: window.location.hostname,
- page: window.location.href,
- ref: refererInfo.referer,
+ // TODO: are these the correct refererInfo values?
+ domain: refererInfo.domain,
+ page: refererInfo.page,
+ ref: refererInfo.ref,
userids: _getUserIDs(),
geo: '',
},
diff --git a/modules/districtmDMXBidAdapter.js b/modules/districtmDMXBidAdapter.js
deleted file mode 100644
index f909a1f1329..00000000000
--- a/modules/districtmDMXBidAdapter.js
+++ /dev/null
@@ -1,433 +0,0 @@
-import { isArray, generateUUID, deepAccess, isStr } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { BANNER, VIDEO } from '../src/mediaTypes.js';
-
-const BIDDER_CODE = 'districtmDMX';
-
-const DMXURI = 'https://dmx.districtm.io/b/v1';
-
-const GVLID = 144;
-const VIDEO_MAPPING = {
- playback_method: {
- 'auto_play_sound_on': 1,
- 'auto_play_sound_off': 2,
- 'click_to_play': 3,
- 'mouse_over': 4,
- 'viewport_sound_on': 5,
- 'viewport_sound_off': 6
- }
-};
-export const spec = {
- code: BIDDER_CODE,
- gvlid: GVLID,
- aliases: ['dmx'],
- supportedFormat: [BANNER, VIDEO],
- supportedMediaTypes: [VIDEO, BANNER],
- isBidRequestValid(bid) {
- return !!(bid.params.memberid);
- },
- interpretResponse(response, bidRequest) {
- response = response.body || {};
- if (response.seatbid) {
- if (isArray(response.seatbid)) {
- const { seatbid } = response;
- let winners = seatbid.reduce((bid, ads) => {
- let ad = ads.bid.reduce(function (oBid, nBid) {
- if (oBid.price < nBid.price) {
- const bid = matchRequest(nBid.impid, bidRequest);
- const { width, height } = defaultSize(bid);
- nBid.cpm = parseFloat(nBid.price).toFixed(2);
- nBid.bidId = nBid.impid;
- nBid.requestId = nBid.impid;
- nBid.width = nBid.w || width;
- nBid.height = nBid.h || height;
- nBid.ttl = 300;
- nBid.mediaType = bid.mediaTypes && bid.mediaTypes.video ? 'video' : 'banner';
- if (nBid.mediaType === 'video') {
- nBid.vastXml = cleanVast(nBid.adm, nBid.nurl);
- nBid.ttl = 3600;
- }
- if (nBid.dealid) {
- nBid.dealId = nBid.dealid;
- }
- nBid.uuid = nBid.bidId;
- nBid.ad = nBid.adm;
- nBid.netRevenue = true;
- nBid.creativeId = nBid.crid;
- nBid.currency = 'USD';
- nBid.meta = nBid.meta || {};
- if (nBid.adomain && nBid.adomain.length > 0) {
- nBid.meta.advertiserDomains = nBid.adomain;
- }
- return nBid;
- } else {
- oBid.cpm = oBid.price;
- return oBid;
- }
- }, { price: 0 });
- if (ad.adm) {
- bid.push(ad)
- }
- return bid;
- }, [])
- let winnersClean = winners.filter(w => {
- if (w.bidId) {
- return true;
- }
- return false;
- });
- return winnersClean;
- } else {
- return [];
- }
- } else {
- return [];
- }
- },
- buildRequests(bidRequest, bidderRequest) {
- let timeout = config.getConfig('bidderTimeout');
- let schain = null;
- let dmxRequest = {
- id: generateUUID(),
- cur: ['USD'],
- tmax: (timeout - 300),
- test: this.test() || 0,
- site: {
- publisher: { id: String(bidRequest[0].params.memberid) || null }
- }
- }
-
- try {
- let params = config.getConfig('dmx');
- dmxRequest.user = params.user || {};
- let site = params.site || {};
- dmxRequest.site = { ...dmxRequest.site, ...site }
- } catch (e) {
-
- }
-
- let eids = [];
- if (bidRequest[0] && bidRequest[0].userId) {
- bindUserId(eids, deepAccess(bidRequest[0], `userId.idl_env`), 'liveramp.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.id5id.uid`), 'id5-sync.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.pubcid`), 'pubcid.org', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.tdid`), 'adserver.org', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.criteoId`), 'criteo.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.britepoolid`), 'britepool.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.lipb.lipbid`), 'liveintent.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.intentiqid`), 'intentiq.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.lotamePanoramaId`), 'lotame.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.parrableId`), 'parrable.com', 1);
- bindUserId(eids, deepAccess(bidRequest[0], `userId.netId`), 'netid.de', 1);
- dmxRequest.user = dmxRequest.user || {};
- dmxRequest.user.ext = dmxRequest.user.ext || {};
- dmxRequest.user.ext.eids = eids;
- }
- if (!dmxRequest.test) {
- delete dmxRequest.test;
- }
- if (bidderRequest.gdprConsent) {
- dmxRequest.regs = {};
- dmxRequest.regs.ext = {};
- dmxRequest.regs.ext.gdpr = bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0;
-
- if (bidderRequest.gdprConsent.gdprApplies === true) {
- dmxRequest.user = {};
- dmxRequest.user.ext = {};
- dmxRequest.user.ext.consent = bidderRequest.gdprConsent.consentString;
- }
- }
- dmxRequest.regs = dmxRequest.regs || {};
- dmxRequest.regs.coppa = config.getConfig('coppa') === true ? 1 : 0;
- if (bidderRequest && bidderRequest.uspConsent) {
- dmxRequest.regs = dmxRequest.regs || {};
- dmxRequest.regs.ext = dmxRequest.regs.ext || {};
- dmxRequest.regs.ext.us_privacy = bidderRequest.uspConsent;
- }
- try {
- schain = bidRequest[0].schain;
- dmxRequest.source = {};
- dmxRequest.source.ext = {};
- dmxRequest.source.ext.schain = schain || {}
- } catch (e) { }
- let tosendtags = bidRequest.map(dmx => {
- var obj = {};
- obj.id = dmx.bidId;
- obj.tagid = String(dmx.params.dmxid || dmx.adUnitCode);
- obj.secure = 1;
- obj.bidfloor = getFloor(dmx);
- if (dmx.mediaTypes && dmx.mediaTypes.video) {
- obj.video = {
- topframe: 1,
- skip: dmx.mediaTypes.video.skip || 0,
- linearity: dmx.mediaTypes.video.linearity || 1,
- minduration: dmx.mediaTypes.video.minduration || 5,
- maxduration: dmx.mediaTypes.video.maxduration || 60,
- playbackmethod: dmx.mediaTypes.video.playbackmethod || [2],
- api: getApi(dmx.mediaTypes.video),
- mimes: dmx.mediaTypes.video.mimes || ['video/mp4'],
- protocols: getProtocols(dmx.mediaTypes.video),
- h: dmx.mediaTypes.video.playerSize[0][1],
- w: dmx.mediaTypes.video.playerSize[0][0]
- };
- } else {
- obj.banner = {
- topframe: 1,
- w: cleanSizes(dmx.sizes, 'w'),
- h: cleanSizes(dmx.sizes, 'h'),
- format: cleanSizes(dmx.sizes).map(s => {
- return { w: s[0], h: s[1] };
- }).filter(obj => typeof obj.w === 'number' && typeof obj.h === 'number')
- };
- }
- return obj;
- });
-
- if (tosendtags.length <= 5) {
- dmxRequest.imp = tosendtags;
- return {
- method: 'POST',
- url: DMXURI,
- data: JSON.stringify(dmxRequest),
- bidderRequest
- }
- } else {
- return upto5(tosendtags, dmxRequest, bidderRequest, DMXURI);
- }
- },
- test() {
- return window.location.href.indexOf('dmTest=true') !== -1 ? 1 : 0;
- },
- getUserSyncs(optionsType, serverResponses, gdprConsent, uspConsent) {
- let query = [];
- let url = 'https://cdn.districtm.io/ids/index.html'
- if (gdprConsent && gdprConsent.gdprApplies && typeof gdprConsent.consentString === 'string') {
- query.push(['gdpr', gdprConsent.consentString])
- }
- if (uspConsent) {
- query.push(['ccpa', uspConsent])
- }
- if (query.length > 0) {
- url += '?' + query.map(q => q.join('=')).join('&')
- }
- if (optionsType.iframeEnabled) {
- return [{
- type: 'iframe',
- url: url
- }];
- }
- }
-}
-
-export function getFloor(bid) {
- let floor = null;
- if (typeof bid.getFloor === 'function') {
- const floorInfo = bid.getFloor({
- currency: 'USD',
- mediaType: bid.mediaTypes.video ? 'video' : 'banner',
- size: bid.sizes.map(size => {
- return {
- w: size[0],
- h: size[1]
- }
- })
- });
- if (typeof floorInfo === 'object' &&
- floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) {
- floor = parseFloat(floorInfo.floor);
- }
- }
- return floor !== null ? floor : bid.params.floor;
-}
-
-export function cleanSizes(sizes, value) {
- const supportedSize = [
- {
- size: [300, 250],
- s: 100
- },
- {
- size: [728, 90],
- s: 95
- },
- {
- size: [320, 50],
- s: 90
- },
- {
- size: [160, 600],
- s: 88
- },
- {
- size: [300, 600],
- s: 85
- },
- {
- size: [300, 50],
- s: 80
- },
- {
- size: [970, 250],
- s: 75
- },
- {
- size: [970, 90],
- s: 60
- },
- ];
- let newArray = shuffle(sizes, supportedSize);
- switch (value) {
- case 'w':
- return newArray[0][0] || 0;
- case 'h':
- return newArray[0][1] || 0;
- case 'size':
- return newArray;
- default:
- return newArray;
- }
-}
-
-export function shuffle(sizes, list) {
- let removeSizes = sizes.filter(size => {
- return list.map(l => `${l.size[0]}x${l.size[1]}`).indexOf(`${size[0]}x${size[1]}`) === -1
- })
- let reOrder = sizes.reduce((results, current) => {
- if (results.length === 0) {
- results.push(current);
- return results;
- }
- results.push(current);
- results = list.filter(l => results.map(r => `${r[0]}x${r[1]}`).indexOf(`${l.size[0]}x${l.size[1]}`) !== -1);
- results = results.sort(function (a, b) {
- return b.s - a.s;
- })
- return results.map(r => r.size);
- }, [])
- return removeDuplicate([...reOrder, ...removeSizes]);
-}
-
-export function removeDuplicate(arrayValue) {
- return arrayValue.filter((elem, index) => {
- return arrayValue.map(e => `${e[0]}x${e[1]}`).indexOf(`${elem[0]}x${elem[1]}`) === index
- })
-}
-
-export function upto5(allimps, dmxRequest, bidderRequest, DMXURI) {
- let start = 0;
- let step = 5;
- let req = [];
- while (allimps.length !== 0) {
- if (allimps.length >= 5) {
- req.push(allimps.splice(start, step))
- } else {
- req.push(allimps.splice(start, allimps.length))
- }
- }
- return req.map(r => {
- dmxRequest.imp = r;
- return {
- method: 'POST',
- url: DMXURI,
- data: JSON.stringify(dmxRequest),
- bidderRequest
- }
- })
-}
-
-/**
- * Function matchRequest(id: string, BidRequest: object)
- * @param id
- * @type string
- * @param bidRequest
- * @type Object
- * @returns Object
- *
- */
-export function matchRequest(id, bidRequest) {
- const { bids } = bidRequest.bidderRequest;
- const [returnValue] = bids.filter(bid => bid.bidId === id);
- return returnValue;
-}
-export function checkDeepArray(Arr) {
- if (Array.isArray(Arr)) {
- if (Array.isArray(Arr[0])) {
- return Arr[0];
- } else {
- return Arr;
- }
- } else {
- return Arr;
- }
-}
-export function defaultSize(thebidObj) {
- const { sizes } = thebidObj;
- const returnObject = {};
- returnObject.width = checkDeepArray(sizes)[0];
- returnObject.height = checkDeepArray(sizes)[1];
- return returnObject;
-}
-
-export function bindUserId(eids, value, source, atype) {
- if (isStr(value) && Array.isArray(eids)) {
- eids.push({
- source,
- uids: [
- {
- id: value,
- atype
- }
- ]
- })
- }
-}
-
-export function getApi({ api }) {
- let defaultValue = [2];
- if (api && Array.isArray(api) && api.length > 0) {
- return api
- } else {
- return defaultValue;
- }
-}
-export function getPlaybackmethod(playback) {
- if (Array.isArray(playback) && playback.length > 0) {
- return playback.map(label => {
- return VIDEO_MAPPING.playback_method[label]
- })
- }
- return [2]
-}
-
-export function getProtocols({ protocols }) {
- let defaultValue = [2, 3, 5, 6, 7, 8];
- if (protocols && Array.isArray(protocols) && protocols.length > 0) {
- return protocols;
- } else {
- return defaultValue;
- }
-}
-
-export function cleanVast(str, nurl) {
- try {
- const toberemove = /]*?src\s*=\s*['\"]([^'\"]*?)['\"][^>]*?>/
- const [img, url] = str.match(toberemove)
- str = str.replace(toberemove, '')
- if (img) {
- if (url) {
- const insrt = ``
- str = str.replace('', `${insrt}`)
- }
- }
- return str;
- } catch (e) {
- if (!nurl) {
- return str
- }
- const insrt = ``
- str = str.replace('', `${insrt}`)
- return str
- }
-}
-registerBidder(spec);
diff --git a/modules/districtmDmxBidAdapter.md b/modules/districtmDmxBidAdapter.md
deleted file mode 100644
index 5d5dd2affe6..00000000000
--- a/modules/districtmDmxBidAdapter.md
+++ /dev/null
@@ -1,203 +0,0 @@
-```
-Module Name: district m Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: Steve Alliance (steve@districtm.net)
-```
-
-# Overview
-
-The `districtmDmxAdapter` module allows publishers to include DMX Exchange demand using Prebid 1.0+.
-
-## Attributes
-
-* Single Request
-* Multi-Size Support
-* GDPR Compliant
-* CCPA Compliant
-* COPPA Compliant
-* Bids returned in **NET**
-
- ## Media Types
-
-* Banner
-* Video
-## Bidder Parameters
-
-| Key | Scope | Type | Description
-| --- | --- | --- | ---
-| `dmxid` | Mandatory | Integer | Unique identifier of the placement, dmxid can be obtained in the district m Boost platform.
-| `memberid` | Mandatory | Integer | Unique identifier for your account, memberid can be obtained in the district m Boost platform.
-| `floor` | Optional | float | Most placement can have floor set in our platform, but this can now be set on the request too.
-
-# Ad Unit Configuration Example
-
-```javascript
- var adUnits = [{
- code: 'div-gpt-ad-1460505748561-0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [{
- bidder: 'districtmDMX',
- params: {
- dmxid: 100001,
- memberid: 100003
- }
- }]
- }];
-```
-
-# Ad Unit Configuration Example for video request
-
-```javascript
- var videoAdUnit = {
- code: 'video1',
- sizes: [640,480],
- mediaTypes: { video: {context: 'instream', //or 'outstream'
- playerSize: [[640, 480]],
- skipppable: true,
- minduration: 5,
- maxduration: 45,
- playback_method: ['auto_play_sound_off', 'viewport_sound_off'],
- mimes: ["application/javascript",
- "video/mp4"],
-
- } },
- bids: [
- {
- bidder: 'districtmDMX',
- params: {
- dmxid: '100001',
- memberid: '100003',
- }
- }
-
- ]
- };
-```
-
-
-# Ad Unit Configuration when COPPA is needed
-
-
-# Quick Start Guide
-
-###### 1. Including the `districtmDmxAdapter` in your build process.
-
-Add the adapter as an argument to gulp build.
-
-```
-gulp build --modules=districtmDmxAdapter,ixBidAdapter,appnexusBidAdapter
-```
-
-*Adding `"districtmDmxAdapter"` as an entry in a JSON file with your bidders is also acceptable.*
-
-```
-[
- "districtmDmxAdapter",
- "ixBidAdapter",
- "appnexusBidAdapter"
-]
-```
-
-*Proceed to build with the JSON file.*
-
-```
-gulp build --modules=bidderModules.json
-```
-
-###### 2. Configure the ad unit object
-
-Once Prebid is ready you may use the below example to create the adUnits object and begin building the configuration.
-
-```javascript
-var adUnits = [{
- code: 'div-gpt-ad-1460505748561-0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300, 600], [728, 90]],
- }
- },
- bids: []
- }
-];
-```
-
-###### 3. Add the bidder
-
-Our demand and adapter supports multiple sizes per placement, as such a single dmxid may be used for all sizes of a single domain.
-
-```javascript
- var adUnits = [{
- code: 'div-gpt-ad-1460505748561-0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300, 600], [728, 90]],
- }
- },
- bids: [{
- bidder: 'districtmDMX',
- params: {
- dmxid: 100001,
- memberid: 100003
- }
- }]
- }];
-```
-
-Our bidder only supports instream context at the moment and we strongly like to put the media types and setting in the ad unit settings.
-If no value is set the default value will be applied.
-
-```javascript
- var videoAdUnit = {
- code: 'video1',
- sizes: [640,480],
- mediaTypes: { video: {context: 'instream', //or 'outstream'
- playerSize: [[640, 480]],
- skipppable: true,
- minduration: 5,
- maxduration: 45,
- playback_method: ['auto_play_sound_off', 'viewport_sound_off'],
- mimes: ["application/javascript",
- "video/mp4"],
-
- } },
- bids: [
- {
- bidder: 'districtmDMX',
- params: {
- dmxid: '250258',
- memberid: '100600',
- }
- }
- ]
- };
-```
-
-###### 4. Implementation Checking
-
-Once the bidder is live in your Prebid configuration you may confirm it is making requests to our end point by looking for requests to `https://dmx.districtm.io/b/v1`.
-
-
-###### 5. Setting first party data
-
-```code
-pbjs.setConfig({
- dmx: {
- user: {
- 'gender': 'M',
- 'yob': 1992,
- // keywords example
- 'keywords': 'automotive,dodge,engine,car'
-
- },
- site: {
- cat: ['IAB-12'],
- pagecat: ['IAB-14'],
- sectioncat: ['IAB-24']
- }
- }
-});
-```
diff --git a/modules/distroscaleBidAdapter.js b/modules/distroscaleBidAdapter.js
index 822bea3603a..005dd3e67d6 100644
--- a/modules/distroscaleBidAdapter.js
+++ b/modules/distroscaleBidAdapter.js
@@ -129,7 +129,8 @@ export const spec = {
},
buildRequests: (validBidRequests, bidderRequest) => {
- var pageUrl = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) || window.location.href;
+ // TODO: does the fallback to window.location make sense?
+ var pageUrl = bidderRequest?.refererInfo?.page || window.location.href;
var payload = {
id: '' + (new Date()).getTime(),
@@ -197,7 +198,7 @@ export const spec = {
}
// First Party Data
- const commonFpd = config.getConfig('ortb2') || {};
+ const commonFpd = bidderRequest.ortb2 || {};
if (commonFpd.site) {
mergeDeep(payload, {site: commonFpd.site});
}
diff --git a/modules/divreachBidAdapter.md b/modules/divreachBidAdapter.md
deleted file mode 100644
index 643845782b8..00000000000
--- a/modules/divreachBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-Module Name: DivReach Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: Zeke@divreach.com
-
-# Description
-
-Connects to DivReach demand source to fetch bids.
-Please use ```divreach``` as the bidder code.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'desktop-banner-ad-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "divreach",
- params: {
- accountID: '167283',
- zoneID: '335105',
- domain: 'ad.divreach.com',
- }
- }
- ]
- },
- ];
-```
diff --git a/modules/djaxBidAdapter.md b/modules/djaxBidAdapter.md
deleted file mode 100644
index d597eb59b58..00000000000
--- a/modules/djaxBidAdapter.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Overview
-
-```
-Module Name: djax Bid Adapter
-Module Type: Bidder Adapter
-Maintainer : support@djaxtech.com
-```
-
-# Description
-
-Connects to Djax Ad Server for bids.
-
-djax bid adapter supports Banner and Video.
-
-# Test Parameters
-```
- var adUnits = [
- //bannner object
- {
- code: 'banner-ad-slot',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [{
- bidder: 'djax',
- params: {
- publisherId: 2
- }
- }]
-
- },
- //video object
- {
- code: 'video-ad-slot',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480],
- },
- },
- bids: [{
- bidder: "djax",
- params: {
- publisherId: 2
- }
- }]
- }];
-```
\ No newline at end of file
diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js
index 737a9f707db..524f464cee3 100644
--- a/modules/docereeBidAdapter.js
+++ b/modules/docereeBidAdapter.js
@@ -24,6 +24,7 @@ export const spec = {
buildRequests: (validBidRequests) => {
const serverRequests = [];
const { data } = config.getConfig('doceree.user')
+ // TODO: this should probably look at refererInfo
const { page, domain, token } = config.getConfig('doceree.context')
const encodedUserInfo = window.btoa(encodeURIComponent(JSON.stringify(data)))
diff --git a/modules/dspxBidAdapter.js b/modules/dspxBidAdapter.js
index da73fdd0177..6af0236d3bb 100644
--- a/modules/dspxBidAdapter.js
+++ b/modules/dspxBidAdapter.js
@@ -22,7 +22,7 @@ export const spec = {
const placementId = params.placement;
const rnd = Math.floor(Math.random() * 99999999999);
- const referrer = bidderRequest.refererInfo.referer;
+ const referrer = bidderRequest.refererInfo.page;
const bidId = bidRequest.bidId;
const isDev = params.devMode || false;
const pbcode = bidRequest.adUnitCode || false; // div id
@@ -70,7 +70,7 @@ export const spec = {
}
if (params.bcat !== undefined) {
- payload.bcat = params.bcat;
+ payload.bcat = deepAccess(bidderRequest.ortb2Imp, 'bcat') || params.bcat;
}
if (params.dvt !== undefined) {
payload.dvt = params.dvt;
diff --git a/modules/e_volutionBidAdapter.js b/modules/e_volutionBidAdapter.js
index 63332db8725..a4372fc5dec 100644
--- a/modules/e_volutionBidAdapter.js
+++ b/modules/e_volutionBidAdapter.js
@@ -66,8 +66,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/edgequeryxBidAdapter.md b/modules/edgequeryxBidAdapter.md
deleted file mode 100644
index 265120dfaba..00000000000
--- a/modules/edgequeryxBidAdapter.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Overview
-
-```
-Module Name: Edge Query X Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: contact@edgequery.com
-```
-
-# Description
-
-Connect to Edge Query X for bids.
-
-The Edge Query X adapter requires setup and approval from the Edge Query team.
-Please reach out to your Technical account manager for more information.
-
-# Test Parameters
-
-## Web
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[1, 1]]
- }
- },
- bids: [
- {
- bidder: "edgequeryx",
- params: {
- accountId: "test",
- widgetId: "test"
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/emoteevBidAdapter.md b/modules/emoteevBidAdapter.md
deleted file mode 100644
index 226a8374369..00000000000
--- a/modules/emoteevBidAdapter.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Overview
-
-```
-Module Name: Emoteev Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: engineering@emoteev.io
-```
-
-# Description
-
-Module that connects to Emoteev's demand sources
-
-# Test Parameters
-
-``` javascript
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[720, 90]],
- }
- },
- bids: [
- {
- bidder: 'emoteev',
- params: {
- adSpaceId: 5084,
- context: 'footer',
- externalId: 42,
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/emx_digitalBidAdapter.js b/modules/emx_digitalBidAdapter.js
index 66fd2eb2ac1..d904ebda9c8 100644
--- a/modules/emx_digitalBidAdapter.js
+++ b/modules/emx_digitalBidAdapter.js
@@ -7,13 +7,13 @@ import {
isPlainObject,
isStr,
logError,
- logWarn,
- parseUrl
+ logWarn
} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
import {find, includes} from '../src/polyfill.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'emx_digital';
const ENDPOINT = 'hb.emxdgt.com';
@@ -140,19 +140,12 @@ export const emxAdapter = {
logError('emx_digitalBidAdapter', 'error', err);
}
},
- getReferrer: () => {
- try {
- return window.top.document.referrer;
- } catch (err) {
- return document.referrer;
- }
- },
getSite: (refInfo) => {
- let url = parseUrl(refInfo.referer);
+ // TODO: do the fallbacks make sense?
return {
- domain: url.hostname,
- page: refInfo.referer,
- ref: emxAdapter.getReferrer()
+ domain: refInfo.domain || parseDomain(refInfo.topmostLocation),
+ page: refInfo.page || refInfo.topmostLocation,
+ ref: refInfo.ref || window.document.referrer
}
},
getGdpr: (bidRequests, emxData) => {
diff --git a/modules/engageyaBidAdapter.js b/modules/engageyaBidAdapter.js
index 95ab8ecbd03..ceec1de8fe7 100644
--- a/modules/engageyaBidAdapter.js
+++ b/modules/engageyaBidAdapter.js
@@ -13,9 +13,10 @@ function getPageUrl(bidRequest, bidderRequest) {
if (bidRequest.params.pageUrl && bidRequest.params.pageUrl != '[PAGE_URL]') {
return bidRequest.params.pageUrl;
}
- if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- return bidderRequest.refererInfo.referer;
+ if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ return bidderRequest.refererInfo.page;
}
+ // TODO: does this fallback make sense?
const pageUrl = (isInIframe() && document.referrer)
? document.referrer
: window.location.href;
diff --git a/modules/enrichmentFpdModule.js b/modules/enrichmentFpdModule.js
index 9268c81c033..139b03d6189 100644
--- a/modules/enrichmentFpdModule.js
+++ b/modules/enrichmentFpdModule.js
@@ -5,7 +5,7 @@
*/
import { timestamp, mergeDeep } from '../src/utils.js';
import { submodule } from '../src/hook.js';
-import { getRefererInfo } from '../src/refererDetection.js';
+import {getRefererInfo, parseDomain} from '../src/refererDetection.js';
import { getCoreStorageManager } from '../src/storageManager.js';
let ortb2 = {};
@@ -70,30 +70,21 @@ export function findRootDomain(fullDomain = window.location.hostname) {
* Checks for referer and if exists merges into ortb2 global data
*/
function setReferer() {
- if (getRefererInfo().referer) mergeDeep(ortb2, { site: { ref: getRefererInfo().referer } });
+ if (getRefererInfo().ref) mergeDeep(ortb2, { site: { ref: getRefererInfo().ref } });
}
/**
* Checks for canonical url and if exists merges into ortb2 global data
*/
function setPage() {
- if (getRefererInfo().canonicalUrl) mergeDeep(ortb2, { site: { page: getRefererInfo().canonicalUrl } });
+ if (getRefererInfo().page) mergeDeep(ortb2, { site: { page: getRefererInfo().page } });
}
/**
* Checks for canonical url and if exists retrieves domain and merges into ortb2 global data
*/
function setDomain() {
- let parseDomain = function(url) {
- if (!url || typeof url !== 'string' || url.length === 0) return;
-
- var match = url.match(/^(?:https?:\/\/)?(?:www\.)?(.*?(?=(\?|\#|\/|$)))/i);
-
- return match && match[1];
- };
-
- let domain = parseDomain(getRefererInfo().canonicalUrl)
-
+ const domain = parseDomain(getRefererInfo().page, {noLeadingWww: true});
if (domain) {
mergeDeep(ortb2, { site: { domain: domain } });
mergeDeep(ortb2, { site: { publisher: { domain: findRootDomain(domain) } } });
@@ -151,17 +142,19 @@ function runEnrichments() {
/**
* Sets default values to ortb2 if exists and adds currency and ortb2 setConfig callbacks on init
*/
-export function initSubmodule(fpdConf, data) {
+export function processFpd(fpdConf, {global}) {
resetOrtb2();
- return (!fpdConf.skipEnrichments) ? mergeDeep(runEnrichments(), data) : data;
+ return {
+ global: (!fpdConf.skipEnrichments) ? mergeDeep(runEnrichments(), global) : global
+ };
}
/** @type {firstPartyDataSubmodule} */
export const enrichmentsSubmodule = {
name: 'enrichments',
queue: 2,
- init: initSubmodule
+ processFpd
}
submodule('firstPartyData', enrichmentsSubmodule)
diff --git a/modules/envivoBidAdapter.md b/modules/envivoBidAdapter.md
deleted file mode 100644
index 3ecc8a251f3..00000000000
--- a/modules/envivoBidAdapter.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Overview
-
-```
-Module Name: envivo Bid Adapter
-Module Type: Bidder Adapter
-Maintainer : adtech@nvivo.tv
-```
-
-# Description
-
-Connects to Envivo Ad Server for bids.
-
-envivo bid adapter supports Banner and Video.
-
-# Test Parameters
-```
- var adUnits = [
- //bannner object
- {
- code: 'banner-ad-slot',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [{
- bidder: 'envivo',
- params: {
- publisherId: 14
- }
- }]
-
- },
- //video object
- {
- code: 'video-ad-slot',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480],
- },
- },
- bids: [{
- bidder: "envivo",
- params: {
- publisherId: 14
- }
- }]
- }];
-```
diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js
index 780531964ad..ca2cbfd9908 100644
--- a/modules/eplanningBidAdapter.js
+++ b/modules/eplanningBidAdapter.js
@@ -1,7 +1,7 @@
-import { isEmpty, getWindowSelf, parseSizesInput } from '../src/utils.js';
-import { getGlobal } from '../src/prebidGlobal.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { getStorageManager } from '../src/storageManager.js';
+import {getWindowSelf, isEmpty, parseSizesInput} from '../src/utils.js';
+import {getGlobal} from '../src/prebidGlobal.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {getStorageManager} from '../src/storageManager.js';
const BIDDER_CODE = 'eplanning';
export const storage = getStorageManager({bidderCode: BIDDER_CODE});
@@ -36,18 +36,16 @@ export const spec = {
const urlConfig = getUrlConfig(bidRequests);
const pcrs = getCharset();
const spaces = getSpaces(bidRequests, urlConfig.ml);
- const pageUrl = bidderRequest.refererInfo.referer;
- const getDomain = (url) => {
- let anchor = document.createElement('a');
- anchor.href = url;
- return anchor.hostname;
- }
+ // TODO: do the fallbacks make sense here?
+ const pageUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
+ const domain = bidderRequest.refererInfo.domain || window.location.host
if (urlConfig.t) {
url = 'https://' + urlConfig.isv + '/layers/t_pbjs_2.json';
params = {};
} else {
- url = 'https://' + (urlConfig.sv || DEFAULT_SV) + '/pbjs/1/' + urlConfig.ci + '/' + dfpClientId + '/' + getDomain(pageUrl) + '/' + sec;
- const referrerUrl = bidderRequest.refererInfo.referer.reachedTop ? window.top.document.referrer : bidderRequest.refererInfo.referer;
+ url = 'https://' + (urlConfig.sv || DEFAULT_SV) + '/pbjs/1/' + urlConfig.ci + '/' + dfpClientId + '/' + domain + '/' + sec;
+ // TODO: does the fallback make sense here?
+ const referrerUrl = bidderRequest.refererInfo.ref || bidderRequest.refererInfo.topmostLocation
if (storage.hasLocalStorage()) {
registerViewabilityAllBids(bidRequests);
diff --git a/modules/etargetBidAdapter.js b/modules/etargetBidAdapter.js
index f7d552b1b09..b290a62420c 100644
--- a/modules/etargetBidAdapter.js
+++ b/modules/etargetBidAdapter.js
@@ -1,5 +1,4 @@
import { deepSetValue, isFn, isPlainObject } from '../src/utils.js';
-import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
@@ -91,7 +90,7 @@ export const spec = {
mts['title'] = [(document.getElementsByTagName('title')[0] || []).innerHTML];
mts['base'] = [(document.getElementsByTagName('base')[0] || {}).href];
mts['referer'] = [document.location.href];
- mts['ortb2'] = (config.getConfig('ortb2') || {});
+ mts['ortb2'] = (bidderRequest.ortb2 || {});
} catch (e) {
mts.error = e;
}
diff --git a/modules/eywamediaBidAdapter.md b/modules/eywamediaBidAdapter.md
deleted file mode 100644
index 76b9b032c1b..00000000000
--- a/modules/eywamediaBidAdapter.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Overview
-
-```
-Module Name: Eywamedia Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: sharath@eywamedia.com
-Note: Our ads will only render in mobile and desktop
-```
-
-# Description
-
-Connects to Eywamedia Ad Server for bids.
-
-Eywamedia bid adapter supports Banners.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner adUnit
- {
- code: 'div-gpt-ad-1460505748561-0',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'eywamedia',
- params: {
- publisherId: 'f63a2362-5aa4-4829-bbd2-2678ced8b63e', //Required - GUID (may include numbers and characters)
- bidFloor: 0.50, // optional
- cats: ["iab1-1","iab23-2"], // optional
- keywords: ["sports", "cricket"], // optional
- lat: 12.33333, // optional
- lon: 77.32322, // optional
- locn: "country$region$city$zip" // optional
- }
- }]
- }
-];
-```
diff --git a/modules/fabrickIdSystem.js b/modules/fabrickIdSystem.js
index 08eb2d4f043..24eac8517b0 100644
--- a/modules/fabrickIdSystem.js
+++ b/modules/fabrickIdSystem.js
@@ -73,7 +73,7 @@ export const fabrickIdSubmodule = {
url = url.slice(0, -1)
const referer = _getRefererInfo(configParams);
const refs = new Map();
- _setReferrer(refs, referer.referer);
+ _setReferrer(refs, referer.topmostLocation);
if (referer.stack && referer.stack[0]) {
_setReferrer(refs, referer.stack[0]);
}
diff --git a/modules/fairtradeBidAdapter.md b/modules/fairtradeBidAdapter.md
deleted file mode 100644
index 56abb84d15a..00000000000
--- a/modules/fairtradeBidAdapter.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Overview
-
-Module Name: FairTrade Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: Tammy.l@VaticDigital.com
-
-# Description
-
-Module that connects to FairTrade demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "fairtrade",
- params: {
- uid: '166',
- priceType: 'gross' // by default is 'net'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/feedadBidAdapter.js b/modules/feedadBidAdapter.js
index 6fb39c49ec8..d695292bb4a 100644
--- a/modules/feedadBidAdapter.js
+++ b/modules/feedadBidAdapter.js
@@ -206,7 +206,8 @@ function buildRequests(validBidRequests, bidderRequest) {
})
});
data.bids.forEach(bid => BID_METADATA[bid.bidId] = {
- referer: data.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: data.refererInfo.page,
transactionId: bid.transactionId
});
if (bidderRequest.gdprConsent) {
diff --git a/modules/fidelityBidAdapter.md b/modules/fidelityBidAdapter.md
deleted file mode 100644
index 0af75689bd6..00000000000
--- a/modules/fidelityBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-**Module Name**: Fidelity Media fmxSSP Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: on@fidelity-media.com
-
-# Description
-
-Connects to Fidelity Media fmxSSP demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [{
- bidder: 'fidelity',
- params: {
- zoneid: '27248',
- floor: 0.005,
- server: 'x.fidelity-media.com'
- }
- }]
- }];
-
-```
\ No newline at end of file
diff --git a/modules/flocIdSystem.js b/modules/flocIdSystem.js
index 3fddbaa7129..e69de29bb2d 100644
--- a/modules/flocIdSystem.js
+++ b/modules/flocIdSystem.js
@@ -1,105 +0,0 @@
-/**
- * This module adds flocId to the User ID module
- * The {@link module:modules/userId} module is required
- * @module modules/flocId
- * @requires module:modules/userId
- */
-
-import { logInfo, logError } from '../src/utils.js';
-import {submodule} from '../src/hook.js'
-
-const MODULE_NAME = 'flocId';
-
-/**
- * Add meta tag to support enabling of floc origin trial
- * @function
- * @param {string} token - configured token for origin-trial
- */
-function enableOriginTrial(token) {
- const tokenElement = document.createElement('meta');
- tokenElement.httpEquiv = 'origin-trial';
- tokenElement.content = token;
- document.head.appendChild(tokenElement);
-}
-
-/**
- * Get the interest cohort.
- * @param successCallback
- * @param errorCallback
- */
-function getFlocData(successCallback, errorCallback) {
- errorCallback('The Floc has flown');
-}
-
-/**
- * Encode the id
- * @param value
- * @returns {string|*}
- */
-function encodeId(value) {
- const result = {};
- if (value) {
- result.flocId = value;
- logInfo('Decoded value ' + JSON.stringify(result));
- return result;
- }
- return undefined;
-}
-
-/** @type {Submodule} */
-export const flocIdSubmodule = {
- /**
- * used to link submodule with config
- * @type {string}
- */
- name: MODULE_NAME,
-
- /**
- * decode the stored id value for passing to bid requests
- * @function
- * @param {string} value
- * @returns {{flocId:{ id: string }} or undefined if value doesn't exists
- */
- decode(value) {
- return (value) ? encodeId(value) : undefined;
- },
- /**
- * If chrome and cohort enabled performs action to obtain id and return a value in the callback's response argument
- * @function
- * @param {SubmoduleConfig} [config]
- * @returns {IdResponse|undefined}
- */
- getId(config) {
- // Block usage of storage of cohort ID
- const checkStorage = (config && config.storage);
- if (checkStorage) {
- logError('User ID - flocId submodule storage should not defined');
- return;
- }
- // Validate feature is enabled
- const isFlocEnabled = false;
-
- if (isFlocEnabled) {
- const configParams = (config && config.params) || {};
- if (configParams && (typeof configParams.token === 'string')) {
- // Insert meta-tag with token from configuration
- enableOriginTrial(configParams.token);
- }
- // Example expected output { "id": "14159", "version": "chrome.1.0" }
- let returnCallback = (cb) => {
- getFlocData((data) => {
- returnCallback = () => { return data; }
- logInfo('Cohort id: ' + JSON.stringify(data));
- cb(data);
- }, (err) => {
- logInfo(err);
- cb(undefined);
- });
- };
-
- return {callback: returnCallback};
- }
- }
-};
-
-submodule('userId', flocIdSubmodule);
diff --git a/modules/flocIdSystem.md b/modules/flocIdSystem.md
deleted file mode 100644
index 07184700a14..00000000000
--- a/modules/flocIdSystem.md
+++ /dev/null
@@ -1,34 +0,0 @@
-## FloC ID User ID Submodule
-
-### Building Prebid with Floc Id Support
-Your Prebid build must include the modules for both **userId** and **flocIdSystem** submodule. Follow the build instructions for Prebid as
-explained in the top level README.md file of the Prebid source tree.
-
-ex: $ gulp build --modules=userId,flocIdSystem
-
-### Prebid Params
-
-Individual params may be set for the FloC ID User ID Submodule.
-```
-pbjs.setConfig({
- userSync: {
- userIds: [{
- name: 'flocId',
- params: {
- token: "Registered token or default sharedid.org token"
- }
- }]
- }
-});
-```
-
-### Parameter Descriptions for the `userSync` Configuration Section
-The below parameters apply only to the FloC ID User ID Module integration.
-
-| Params under usersync.userIds[]| Scope | Type | Description | Example |
-| --- | --- | --- | --- | --- |
-| name | Required | String | ID value for the Floc ID module - `"flocId"` | `"flocId"` |
-| params | Optional | Object | Details for flocId syncing. | |
-| params.token | Optional | Object | Publisher registered token.To get new token, register https://developer.chrome.com/origintrials/#/trials/active for Federated Learning of Cohorts. Default sharedid.org token: token: "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"| token: "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
- |
-| storage | Not Allowed | Object | Will ask browser for cohort everytime. Setting storage will fail id lookup ||
diff --git a/modules/fluctBidAdapter.js b/modules/fluctBidAdapter.js
index 44b9f3bf217..ea634027dbe 100644
--- a/modules/fluctBidAdapter.js
+++ b/modules/fluctBidAdapter.js
@@ -39,7 +39,8 @@ export const spec = {
*/
buildRequests: (validBidRequests, bidderRequest) => {
const serverRequests = [];
- const referer = bidderRequest.refererInfo.referer;
+ // TODO: is 'page' the right value here?
+ const referer = bidderRequest.refererInfo.page;
_each(validBidRequests, (request) => {
const data = Object();
diff --git a/modules/fpdModule/index.js b/modules/fpdModule/index.js
index 427547a4e4d..aa658a5be4c 100644
--- a/modules/fpdModule/index.js
+++ b/modules/fpdModule/index.js
@@ -4,55 +4,38 @@
*/
import { config } from '../../src/config.js';
import { module, getHook } from '../../src/hook.js';
-import { getGlobal } from '../../src/prebidGlobal.js';
-import { addBidderRequests } from '../../src/auction.js';
let submodules = [];
/**
* enable submodule in User ID
- * @param {RtdSubmodule} submodule
*/
export function registerSubmodules(submodule) {
submodules.push(submodule);
}
-export function init() {
+export function processFpd({global = {}, bidder = {}} = {}) {
let modConf = config.getConfig('firstPartyData') || {};
- let ortb2 = config.getConfig('ortb2') || {};
submodules.sort((a, b) => {
return ((a.queue || 1) - (b.queue || 1));
}).forEach(submodule => {
- ortb2 = submodule.init(modConf, ortb2);
+ ({global = global, bidder = bidder} = submodule.processFpd(modConf, {global, bidder}));
});
- config.setConfig({ortb2});
+ return {global, bidder};
}
-/**
- * BidderRequests hook to intiate module and reset modules ortb2 data object
- */
-function addBidderRequestHook(fn, bidderRequests) {
- init();
- fn.call(this, bidderRequests);
- // Removes hook after run
- addBidderRequests.getHooks({ hook: addBidderRequestHook }).remove();
+function startAuctionHook(fn, req) {
+ Object.assign(req, processFpd({global: req.ortb2, bidder: req.bidderOrtb2}));
+ fn.call(this, req);
}
-/**
- * Sets bidderRequests hook
- */
function setupHook() {
- getHook('addBidderRequests').before(addBidderRequestHook);
+ getHook('startAuction').before(startAuctionHook, 10);
}
module('firstPartyData', registerSubmodules);
// Runs setupHook on initial load
setupHook();
-
-/**
- * Global function to reinitiate module
- */
-(getGlobal()).refreshFpd = setupHook;
diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js
index eca31dd5a95..91453fdcf5d 100644
--- a/modules/freewheel-sspBidAdapter.js
+++ b/modules/freewheel-sspBidAdapter.js
@@ -326,8 +326,8 @@ export const spec = {
}
}
}
-
- var location = (bidderRequest && bidderRequest.refererInfo) ? bidderRequest.refererInfo.referer : getTopMostWindow().location.href;
+ // TODO: is 'page' the right value here?
+ var location = bidderRequest?.refererInfo?.page;
if (isValidUrl(location)) {
requestParams.loc = location;
}
diff --git a/modules/futureads.md b/modules/futureads.md
deleted file mode 100644
index 7b1c1d55b7f..00000000000
--- a/modules/futureads.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# Overview
-Module Name: Future Ads Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: contact@futureads.io
-# Description
-Connects to Future Ads demand source to fetch bids.
-Banner and Video formats are supported.
-Please use ```futureads``` as the bidder code.
-# Test Parameters
-```
-var adUnits = [
- {
- code: 'desktop-banner-ad-div',
- sizes: [[300, 250]], // a display size
- bids: [
- {
- bidder: "futureads",
- params: {
- zone: '2eb6bd58-865c-47ce-af7f-a918108c3fd2'
- }
- }
- ]
- },{
- code: 'mobile-banner-ad-div',
- sizes: [[300, 50]], // a mobile size
- bids: [
- {
- bidder: "futureads",
- params: {
- zone: '62211486-c50b-4356-9f0f-411778d31fcc'
- }
- }
- ]
- },{
- code: 'video-ad',
- sizes: [[300, 50]],
- mediaType: 'video',
- bids: [
- {
- bidder: "futureads",
- params: {
- zone: 'ebeb1e79-8cb4-4473-b2d0-2e24b7ff47fd'
- }
- }
- ]
- },
-];
-```
diff --git a/modules/fyberBidAdapter.md b/modules/fyberBidAdapter.md
deleted file mode 100644
index c394addadfe..00000000000
--- a/modules/fyberBidAdapter.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Overview
-
-```
-Module Name: Fyber Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: uri@inner-active.com
-```
-
-# Description
-
-Module that connects to Fyber's demand sources
-
-# Test Parameters
-```
-var adUnits = [
-{
-code: 'test-div',
-mediaTypes: {
-banner: {
-sizes: [[300, 250]], // a display rectangle size
-}
-},
-bids: [
-{
-bidder: 'fyber',
- params: {
- APP_ID: 'MyCompany_MyApp',
- spotType: 'rectangle',
- customParams: {
- portal: 7002
- }
- }
-}
-]
-},{
-code: 'test-div',
-mediaTypes: {
-banner: {
-sizes: [[320, 50]], // a banner size
-}
-},
-bids: [
-{
-bidder: 'fyber',
- params: {
- APP_ID: 'MyCompany_MyApp',
- spotType: 'banner',
- customParams: {
- portal: 7001
- }
- }
-}
-]
-}
-];
-```
diff --git a/modules/gammaBidAdapter.js b/modules/gammaBidAdapter.js
index 3e1298b7e23..279eb78812e 100644
--- a/modules/gammaBidAdapter.js
+++ b/modules/gammaBidAdapter.js
@@ -27,7 +27,7 @@ export const spec = {
*/
buildRequests: function(bidRequests, bidderRequest) {
const serverRequests = [];
- const bidderRequestReferer = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) || '';
+ const bidderRequestReferer = bidderRequest?.refererInfo?.page || '';
for (var i = 0, len = bidRequests.length; i < len; i++) {
const gaxObjParams = bidRequests[i];
serverRequests.push({
diff --git a/modules/gamoshiBidAdapter.js b/modules/gamoshiBidAdapter.js
index 22a70db0fab..26afe6e6b87 100644
--- a/modules/gamoshiBidAdapter.js
+++ b/modules/gamoshiBidAdapter.js
@@ -12,7 +12,6 @@ import {
logWarn
} from '../src/utils.js';
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 '../src/polyfill.js';
@@ -34,11 +33,6 @@ export const helper = {
startsWith: function (str, search) {
return str.substr(0, search.length) === search;
},
- getTopWindowDomain: function (url) {
- const domainStart = url.indexOf('://') + '://'.length;
- return url.substring(domainStart, url.indexOf('/', domainStart) < 0 ? url.length : url.indexOf('/', domainStart));
- },
-
getMediaType: function (bid) {
if (bid.ext) {
if (bid.ext.media_type) {
@@ -89,14 +83,12 @@ export const spec = {
const {adUnitCode, auctionId, mediaTypes, params, sizes, transactionId} = bidRequest;
const baseEndpoint = params['rtbEndpoint'] || ENDPOINTS['gamoshi'];
const rtbEndpoint = `${baseEndpoint}/r/${params.supplyPartnerId}/bidr?rformat=open_rtb&reqformat=rtb_json&bidder=prebid` + (params.query ? '&' + params.query : '');
- let url = config.getConfig('pageUrl') || bidderRequest.refererInfo.referer;
-
const rtbBidRequest = {
id: auctionId,
site: {
- domain: helper.getTopWindowDomain(url),
- page: url,
- ref: bidderRequest.refererInfo.referer
+ domain: bidderRequest.refererInfo.domain,
+ page: bidderRequest.refererInfo.page,
+ ref: bidderRequest.refererInfo.ref
},
device: {
ua: navigator.userAgent,
@@ -127,7 +119,7 @@ export const spec = {
const imp = {
id: transactionId,
- instl: params.instl === 1 ? 1 : 0,
+ instl: deepAccess(bidderRequest.ortb2Imp, 'instl') === 1 || params.instl === 1 ? 1 : 0,
tagid: adUnitCode,
bidfloor: helper.getBidFloor(bidRequest) || 0,
bidfloorcur: 'USD',
@@ -143,7 +135,7 @@ export const spec = {
banner: {
w: sizes.length ? sizes[0][0] : 300,
h: sizes.length ? sizes[0][1] : 250,
- pos: params.pos || 0,
+ pos: deepAccess(bidderRequest, 'mediaTypes.banner.pos') || params.pos || 0,
topframe: inIframe() ? 0 : 1
}
});
@@ -157,7 +149,7 @@ export const spec = {
const videoImp = Object.assign({}, imp, {
video: {
protocols: bidRequest.mediaTypes.video.protocols || params.protocols || [1, 2, 3, 4, 5, 6],
- pos: params.pos || 0,
+ pos: deepAccess(bidRequest, 'mediaTypes.video.pos') || params.pos || 0,
ext: {
context: mediaTypes.video.context
},
diff --git a/modules/gdprEnforcement.js b/modules/gdprEnforcement.js
index 4a54367a2a2..c29d216509f 100644
--- a/modules/gdprEnforcement.js
+++ b/modules/gdprEnforcement.js
@@ -45,7 +45,7 @@ const storageBlocked = [];
const biddersBlocked = [];
const analyticsBlocked = [];
-let addedDeviceAccessHook = false;
+let hooksAdded = false;
// Helps in stubbing these functions in unit tests.
export const internal = {
@@ -180,29 +180,23 @@ export function deviceAccessHook(fn, gvlid, moduleName, moduleType, result) {
} else {
const consentData = gdprDataHandler.getConsentData();
if (consentData && consentData.gdprApplies) {
- if (consentData.apiVersion === 2) {
- const curBidder = config.getCurrentBidder();
- // Bidders have a copy of storage object with bidder code binded. Aliases will also pass the same bidder code when invoking storage functions and hence if alias tries to access device we will try to grab the gvl id for alias instead of original bidder
- if (curBidder && (curBidder != moduleName) && adapterManager.aliasRegistry[curBidder] === moduleName) {
- gvlid = getGvlid(curBidder);
- } else {
- gvlid = getGvlid(moduleName) || gvlid;
- }
- const curModule = moduleName || curBidder;
- let isAllowed = validateRules(purpose1Rule, consentData, curModule, gvlid, moduleType);
- if (isAllowed) {
- result.valid = true;
- fn.call(this, gvlid, moduleName, moduleType, result);
- } else {
- curModule && logWarn(`TCF2 denied device access for ${curModule}`);
- result.valid = false;
- storageBlocked.push(curModule);
- fn.call(this, gvlid, moduleName, moduleType, result);
- }
+ const curBidder = config.getCurrentBidder();
+ // Bidders have a copy of storage object with bidder code binded. Aliases will also pass the same bidder code when invoking storage functions and hence if alias tries to access device we will try to grab the gvl id for alias instead of original bidder
+ if (curBidder && (curBidder != moduleName) && adapterManager.aliasRegistry[curBidder] === moduleName) {
+ gvlid = getGvlid(curBidder);
} else {
- // The module doesn't enforce TCF1.1 strings
+ gvlid = getGvlid(moduleName) || gvlid;
+ }
+ const curModule = moduleName || curBidder;
+ let isAllowed = validateRules(purpose1Rule, consentData, curModule, gvlid, moduleType);
+ if (isAllowed) {
result.valid = true;
fn.call(this, gvlid, moduleName, moduleType, result);
+ } else {
+ curModule && logWarn(`TCF2 denied device access for ${curModule}`);
+ result.valid = false;
+ storageBlocked.push(curModule);
+ fn.call(this, gvlid, moduleName, moduleType, result);
}
} else {
result.valid = true;
@@ -219,19 +213,14 @@ export function deviceAccessHook(fn, gvlid, moduleName, moduleType, result) {
export function userSyncHook(fn, ...args) {
const consentData = gdprDataHandler.getConsentData();
if (consentData && consentData.gdprApplies) {
- if (consentData.apiVersion === 2) {
- const curBidder = config.getCurrentBidder();
- const gvlid = getGvlid(curBidder);
- let isAllowed = validateRules(purpose1Rule, consentData, curBidder, gvlid);
- if (isAllowed) {
- fn.call(this, ...args);
- } else {
- logWarn(`User sync not allowed for ${curBidder}`);
- storageBlocked.push(curBidder);
- }
- } else {
- // The module doesn't enforce TCF1.1 strings
+ const curBidder = config.getCurrentBidder();
+ const gvlid = getGvlid(curBidder);
+ let isAllowed = validateRules(purpose1Rule, consentData, curBidder, gvlid);
+ if (isAllowed) {
fn.call(this, ...args);
+ } else {
+ logWarn(`User sync not allowed for ${curBidder}`);
+ storageBlocked.push(curBidder);
}
} else {
fn.call(this, ...args);
@@ -246,24 +235,19 @@ export function userSyncHook(fn, ...args) {
*/
export function userIdHook(fn, submodules, consentData) {
if (consentData && consentData.gdprApplies) {
- if (consentData.apiVersion === 2) {
- let userIdModules = submodules.map((submodule) => {
- const gvlid = getGvlid(submodule.submodule);
- const moduleName = submodule.submodule.name;
- let isAllowed = validateRules(purpose1Rule, consentData, moduleName, gvlid);
- if (isAllowed) {
- return submodule;
- } else {
- logWarn(`User denied permission to fetch user id for ${moduleName} User id module`);
- storageBlocked.push(moduleName);
- }
- return undefined;
- }).filter(module => module)
- fn.call(this, userIdModules, { ...consentData, hasValidated: true });
- } else {
- // The module doesn't enforce TCF1.1 strings
- fn.call(this, submodules, consentData);
- }
+ let userIdModules = submodules.map((submodule) => {
+ const gvlid = getGvlid(submodule.submodule);
+ const moduleName = submodule.submodule.name;
+ let isAllowed = validateRules(purpose1Rule, consentData, moduleName, gvlid);
+ if (isAllowed) {
+ return submodule;
+ } else {
+ logWarn(`User denied permission to fetch user id for ${moduleName} User id module`);
+ storageBlocked.push(moduleName);
+ }
+ return undefined;
+ }).filter(module => module)
+ fn.call(this, userIdModules, { ...consentData, hasValidated: true });
} else {
fn.call(this, submodules, consentData);
}
@@ -278,25 +262,20 @@ export function userIdHook(fn, submodules, consentData) {
export function makeBidRequestsHook(fn, adUnits, ...args) {
const consentData = gdprDataHandler.getConsentData();
if (consentData && consentData.gdprApplies) {
- if (consentData.apiVersion === 2) {
- adUnits.forEach(adUnit => {
- adUnit.bids = adUnit.bids.filter(bid => {
- const currBidder = bid.bidder;
- const gvlId = getGvlid(currBidder);
- if (includes(biddersBlocked, currBidder)) return false;
- const isAllowed = !!validateRules(purpose2Rule, consentData, currBidder, gvlId);
- if (!isAllowed) {
- logWarn(`TCF2 blocked auction for ${currBidder}`);
- biddersBlocked.push(currBidder);
- }
- return isAllowed;
- });
+ adUnits.forEach(adUnit => {
+ adUnit.bids = adUnit.bids.filter(bid => {
+ const currBidder = bid.bidder;
+ const gvlId = getGvlid(currBidder);
+ if (includes(biddersBlocked, currBidder)) return false;
+ const isAllowed = !!validateRules(purpose2Rule, consentData, currBidder, gvlId);
+ if (!isAllowed) {
+ logWarn(`TCF2 blocked auction for ${currBidder}`);
+ biddersBlocked.push(currBidder);
+ }
+ return isAllowed;
});
- fn.call(this, adUnits, ...args);
- } else {
- // The module doesn't enforce TCF1.1 strings
- fn.call(this, adUnits, ...args);
- }
+ });
+ fn.call(this, adUnits, ...args);
} else {
fn.call(this, adUnits, ...args);
}
@@ -311,25 +290,20 @@ export function makeBidRequestsHook(fn, adUnits, ...args) {
export function enableAnalyticsHook(fn, config) {
const consentData = gdprDataHandler.getConsentData();
if (consentData && consentData.gdprApplies) {
- if (consentData.apiVersion === 2) {
- if (!isArray(config)) {
- config = [config]
- }
- config = config.filter(conf => {
- const analyticsAdapterCode = conf.provider;
- const gvlid = getGvlid(analyticsAdapterCode);
- const isAllowed = !!validateRules(purpose7Rule, consentData, analyticsAdapterCode, gvlid);
- if (!isAllowed) {
- analyticsBlocked.push(analyticsAdapterCode);
- logWarn(`TCF2 blocked analytics adapter ${conf.provider}`);
- }
- return isAllowed;
- });
- fn.call(this, config);
- } else {
- // This module doesn't enforce TCF1.1 strings
- fn.call(this, config);
+ if (!isArray(config)) {
+ config = [config]
}
+ config = config.filter(conf => {
+ const analyticsAdapterCode = conf.provider;
+ const gvlid = getGvlid(analyticsAdapterCode);
+ const isAllowed = !!validateRules(purpose7Rule, consentData, analyticsAdapterCode, gvlid);
+ if (!isAllowed) {
+ analyticsBlocked.push(analyticsAdapterCode);
+ logWarn(`TCF2 blocked analytics adapter ${conf.provider}`);
+ }
+ return isAllowed;
+ });
+ fn.call(this, config);
} else {
fn.call(this, config);
}
@@ -386,20 +360,32 @@ export function setEnforcementConfig(config) {
purpose2Rule = DEFAULT_RULES[1];
}
- if (purpose1Rule && !addedDeviceAccessHook) {
- addedDeviceAccessHook = true;
- validateStorageEnforcement.before(deviceAccessHook, 49);
- registerSyncInner.before(userSyncHook, 48);
- // Using getHook as user id and gdprEnforcement are both optional modules. Using import will auto include the file in build
- getHook('validateGdprEnforcement').before(userIdHook, 47);
- }
- if (purpose2Rule) {
- getHook('makeBidRequests').before(makeBidRequestsHook);
+ if (!hooksAdded) {
+ if (purpose1Rule) {
+ hooksAdded = true;
+ validateStorageEnforcement.before(deviceAccessHook, 49);
+ registerSyncInner.before(userSyncHook, 48);
+ // Using getHook as user id and gdprEnforcement are both optional modules. Using import will auto include the file in build
+ getHook('validateGdprEnforcement').before(userIdHook, 47);
+ }
+ if (purpose2Rule) {
+ getHook('makeBidRequests').before(makeBidRequestsHook);
+ }
+ if (purpose7Rule) {
+ getHook('enableAnalyticsCb').before(enableAnalyticsHook);
+ }
}
+}
- if (purpose7Rule) {
- getHook('enableAnalyticsCb').before(enableAnalyticsHook);
- }
+export function uninstall() {
+ [
+ validateStorageEnforcement.getHooks({hook: deviceAccessHook}),
+ registerSyncInner.getHooks({hook: userSyncHook}),
+ getHook('validateGdprEnforcement').getHooks({hook: userIdHook}),
+ getHook('makeBidRequests').getHooks({hook: makeBidRequestsHook}),
+ getHook('enableAnalyticsCb').getHooks({hook: enableAnalyticsHook}),
+ ].forEach(hook => hook.remove());
+ hooksAdded = false;
}
config.getConfig('consentManagement', config => setEnforcementConfig(config.consentManagement));
diff --git a/modules/giantsBidAdapter.md b/modules/giantsBidAdapter.md
deleted file mode 100644
index 8d7cdd81184..00000000000
--- a/modules/giantsBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-```
-Module Name: Giants Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: info@prebid.org
-```
-
-# Description
-
-Connects to Giants exchange for bids.
-
-Giants bid adapter supports Banner.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner adUnit
- {
- code: 'banner-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'giants',
- params: {
- zoneId: '584072408'
- }
- }]
- }
-];
-```
\ No newline at end of file
diff --git a/modules/gjirafaBidAdapter.js b/modules/gjirafaBidAdapter.js
index 48b2cd43c3b..af70c0c67f0 100644
--- a/modules/gjirafaBidAdapter.js
+++ b/modules/gjirafaBidAdapter.js
@@ -45,7 +45,7 @@ export const spec = {
if (!propertyId) { propertyId = bidRequest.params.propertyId; }
if (!pageViewGuid && bidRequest.params) { pageViewGuid = bidRequest.params.pageViewGuid || ''; }
if (!bidderRequestId) { bidderRequestId = bidRequest.bidderRequestId; }
- if (!url && bidderRequest) { url = bidderRequest.refererInfo.referer; }
+ if (!url && bidderRequest) { url = bidderRequest.refererInfo.page; }
if (!contents.length && bidRequest.params.contents && bidRequest.params.contents.length) { contents = bidRequest.params.contents; }
if (Object.keys(data).length === 0 && bidRequest.params.data && Object.keys(bidRequest.params.data).length !== 0) { data = bidRequest.params.data; }
diff --git a/modules/glimpseBidAdapter.js b/modules/glimpseBidAdapter.js
index 35aaf56c604..bbb4dbb30cd 100644
--- a/modules/glimpseBidAdapter.js
+++ b/modules/glimpseBidAdapter.js
@@ -49,7 +49,7 @@ export const spec = {
const auth = getVaultJwt();
const referer = getReferer(bidderRequest);
const imp = validBidRequests.map(processBidRequest);
- const fpd = getFirstPartyData();
+ const fpd = getFirstPartyData(bidderRequest.ortb2);
const data = {
auth,
@@ -95,7 +95,8 @@ function getVaultJwt() {
}
function getReferer(bidderRequest) {
- return bidderRequest?.refererInfo?.referer || '';
+ // TODO: is 'page' the right value here?
+ return bidderRequest?.refererInfo?.page || '';
}
function buildQuery(bidderRequest) {
@@ -160,8 +161,8 @@ function normalizeSizes(sizes) {
return sizes;
}
-function getFirstPartyData() {
- let fpd = config.getConfig('ortb2') || {};
+function getFirstPartyData(ortb2) {
+ let fpd = ortb2 || {};
optimizeObject(fpd);
return fpd;
}
diff --git a/modules/glomexBidAdapter.js b/modules/glomexBidAdapter.js
index 5cabd2515a9..32c2036a748 100644
--- a/modules/glomexBidAdapter.js
+++ b/modules/glomexBidAdapter.js
@@ -26,10 +26,11 @@ export const spec = {
data: {
auctionId: bidderRequest.auctionId,
refererInfo: {
+ // TODO: this collects everything it finds, except for canonicalUrl
isAmp: refererInfo.isAmp,
numIframes: refererInfo.numIframes,
reachedTop: refererInfo.reachedTop,
- referer: refererInfo.referer
+ referer: refererInfo.topmostLocation,
},
gdprConsent: {
consentString: gdprConsent.consentString,
diff --git a/modules/gmosspBidAdapter.js b/modules/gmosspBidAdapter.js
index 087f74906fb..9bc1a15b60b 100644
--- a/modules/gmosspBidAdapter.js
+++ b/modules/gmosspBidAdapter.js
@@ -1,7 +1,18 @@
-import { deepAccess, getDNT, getBidIdParameter, tryAppendQueryString, isEmpty, createTrackPixelHtml, logError, deepSetValue, getWindowTop, getWindowLocation } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { BANNER } from '../src/mediaTypes.js';
+import {
+ createTrackPixelHtml,
+ deepAccess,
+ deepSetValue,
+ getBidIdParameter,
+ getDNT,
+ getWindowTop,
+ isEmpty,
+ logError,
+ tryAppendQueryString
+} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {config} from '../src/config.js';
+import {BANNER} from '../src/mediaTypes.js';
+
const BIDDER_CODE = 'gmossp';
const ENDPOINT = 'https://sp.gmossp-sp.jp/hb/prebid/query.ad';
@@ -155,9 +166,10 @@ function getUrlInfo(refererInfo) {
}
return {
- url: getUrl(refererInfo),
canonicalLink: canonicalLink,
- ref: getReferrer(),
+ // TODO: are these the right refererInfo values?
+ url: refererInfo.topmostLocation,
+ ref: refererInfo.ref || window.document.referrer,
};
}
@@ -169,24 +181,4 @@ function getMetaElements() {
}
}
-function getUrl(refererInfo) {
- if (refererInfo && refererInfo.referer) {
- return refererInfo.referer;
- }
-
- try {
- return getWindowTop.location.href;
- } catch (e) {
- return getWindowLocation.href;
- }
-}
-
-function getReferrer() {
- try {
- return getWindowTop.document.referrer;
- } catch (e) {
- return document.referrer;
- }
-}
-
registerBidder(spec);
diff --git a/modules/gnetBidAdapter.js b/modules/gnetBidAdapter.js
index 274e8db2b50..8bab043d0db 100644
--- a/modules/gnetBidAdapter.js
+++ b/modules/gnetBidAdapter.js
@@ -31,7 +31,8 @@ export const spec = {
*/
buildRequests: function (validBidRequests, bidderRequest) {
const bidRequests = [];
- const referer = bidderRequest.refererInfo.referer;
+ // TODO: is 'page' the right value?
+ const referer = bidderRequest.refererInfo.page;
_each(validBidRequests, (request) => {
const data = {};
diff --git a/modules/go2net.md b/modules/go2net.md
deleted file mode 100644
index acea57b1c55..00000000000
--- a/modules/go2net.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Overview
-
-Module Name: Go2Net Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: vprytuzhalova@go2net.com.ua
-
-# Description
-
-Connects to Go2Net demand source to fetch bids.
-Banner and Video formats are supported.
-Please use ```go2net``` as the bidder code.
-
-# Ad Unit Example
-```
- var adUnits = [
- {
- code: 'desktop-banner-ad-div',
- sizes: [[300, 250]], // a display size
- bids: [
- {
- bidder: "go2net",
- params: {
- zone: 'fb3d34d0-7a88-4a4a-a5c9-8088cd7845f4'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/goldbachBidAdapter.js b/modules/goldbachBidAdapter.js
index 46ae3054188..9d5f6d71c6a 100644
--- a/modules/goldbachBidAdapter.js
+++ b/modules/goldbachBidAdapter.js
@@ -29,6 +29,7 @@ import {ADPOD, BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {auctionManager} from '../src/auctionManager.js';
import {find, includes} from '../src/polyfill.js';
import {INSTREAM, OUTSTREAM} from '../src/video.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'goldbach';
const URL = 'https://ib.adnxs.com/ut/v3/prebid';
@@ -246,7 +247,8 @@ export const spec = {
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: this collects everything it finds, except for topmostLocation
+ rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
@@ -267,7 +269,6 @@ export const spec = {
if (bidRequests[0].userId) {
let eids = [];
- addUserId(eids, deepAccess(bidRequests[0], `userId.flocId.id`), 'chrome.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.criteoId`), 'criteo.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.netId`), 'netid.de', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.idl_env`), 'liveramp.com', null);
@@ -533,16 +534,6 @@ function getViewabilityScriptUrlFromPayload(viewJsPayload) {
return jsTrackerSrc;
}
-function hasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
function formatRequest(payload, bidderRequest) {
let request = [];
let options = {
@@ -551,7 +542,7 @@ function formatRequest(payload, bidderRequest) {
let endpointUrl = URL;
- if (!hasPurpose1Consent(bidderRequest)) {
+ if (!hasPurpose1Consent(bidderRequest?.gdprConsent)) {
endpointUrl = URL_SIMPLE;
}
diff --git a/modules/gothamadsBidAdapter.js b/modules/gothamadsBidAdapter.js
index 1993f0c9b64..5f2d3c4f36a 100644
--- a/modules/gothamadsBidAdapter.js
+++ b/modules/gothamadsBidAdapter.js
@@ -74,8 +74,9 @@ export const spec = {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/gridBidAdapter.js b/modules/gridBidAdapter.js
index 993ddd927b0..40b79784595 100644
--- a/modules/gridBidAdapter.js
+++ b/modules/gridBidAdapter.js
@@ -25,11 +25,21 @@ const LOG_ERROR_MESS = {
hasNoArrayOfBids: 'Seatbid from response has no array of bid objects - '
};
+const ALIAS_CONFIG = {
+ 'trustx': {
+ endpoint: 'https://grid.bidswitch.net/hbjson?sp=trustx',
+ syncurl: 'https://x.bidswitch.net/sync?ssp=themediagrid',
+ bidResponseExternal: {
+ netRevenue: false
+ }
+ }
+};
+
let hasSynced = false;
export const spec = {
code: BIDDER_CODE,
- aliases: ['playwire', 'adlivetech'],
+ aliases: ['playwire', 'adlivetech', 'trustx'],
supportedMediaTypes: [ BANNER, VIDEO ],
/**
* Determines whether or not the given bid request is valid.
@@ -58,9 +68,12 @@ export const spec = {
let userIdAsEids = null;
let user = null;
let userExt = null;
+ let endpoint = null;
+ let forceBidderName = false;
let {bidderRequestId, auctionId, gdprConsent, uspConsent, timeout, refererInfo} = bidderRequest || {};
- const referer = refererInfo ? encodeURIComponent(refererInfo.referer) : '';
+ // TODO: is 'page' the right value here?
+ const referer = refererInfo ? encodeURIComponent(refererInfo.page) : '';
const imp = [];
const bidsMap = {};
@@ -77,7 +90,10 @@ export const spec = {
if (!userIdAsEids) {
userIdAsEids = bid.userIdAsEids;
}
- const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp} = bid;
+ if (!endpoint) {
+ endpoint = ALIAS_CONFIG[bid.bidder] && ALIAS_CONFIG[bid.bidder].endpoint;
+ }
+ const { params: { uid, keywords, forceBidder }, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp } = bid;
bidsMap[bidId] = bid;
const bidFloor = _getFloor(mediaTypes || {}, bid);
const jwTargeting = rtd && rtd.jwplayer && rtd.jwplayer.targeting;
@@ -136,8 +152,19 @@ export const spec = {
if (impObj.banner || impObj.video) {
imp.push(impObj);
}
+
+ if (!forceBidderName && forceBidder && ALIAS_CONFIG[forceBidder]) {
+ forceBidderName = forceBidder;
+ }
});
+ forceBidderName = config.getConfig('forceBidderName') || forceBidderName;
+
+ if (forceBidderName && ALIAS_CONFIG[forceBidderName]) {
+ endpoint = ALIAS_CONFIG[forceBidderName].endpoint;
+ this.forceBidderName = forceBidderName;
+ }
+
const source = {
tid: auctionId && auctionId.toString(),
ext: {
@@ -176,7 +203,7 @@ export const spec = {
};
}
- const ortb2UserData = config.getConfig('ortb2.user.data');
+ const ortb2UserData = deepAccess(bidderRequest, 'ortb2.user.data');
if (ortb2UserData && ortb2UserData.length) {
if (!user) {
user = { data: [] };
@@ -190,7 +217,7 @@ export const spec = {
userExt = {consent: gdprConsent.consentString};
}
- const ortb2UserExtDevice = config.getConfig('ortb2.user.ext.device');
+ const ortb2UserExtDevice = deepAccess(bidderRequest, 'ortb2.user.ext.device');
if (ortb2UserExtDevice) {
userExt = userExt || {};
userExt.device = { ...ortb2UserExtDevice };
@@ -217,8 +244,8 @@ export const spec = {
request.user = user;
}
- const userKeywords = deepAccess(config.getConfig('ortb2.user'), 'keywords') || null;
- const siteKeywords = deepAccess(config.getConfig('ortb2.site'), 'keywords') || null;
+ const userKeywords = deepAccess(bidderRequest, 'ortb2.user.keywords') || null;
+ const siteKeywords = deepAccess(bidderRequest, 'ortb2.site.keywords') || null;
if (userKeywords) {
pageKeywords = pageKeywords || {};
@@ -272,7 +299,7 @@ export const spec = {
request.regs.coppa = 1;
}
- const site = config.getConfig('ortb2.site');
+ const site = deepAccess(bidderRequest, 'ortb2.site');
if (site) {
const pageCategory = [...(site.cat || []), ...(site.pagecat || [])].filter((category) => {
return category && typeof category === 'string'
@@ -297,9 +324,8 @@ export const spec = {
return {
method: 'POST',
- url: ENDPOINT_URL,
+ url: endpoint || ENDPOINT_URL,
data: JSON.stringify(request),
- newFormat: true,
bidsMap
};
},
@@ -308,9 +334,10 @@ export const spec = {
*
* @param {*} serverResponse A successful response from the server.
* @param {*} bidRequest
+ * @param {*} RendererConst
* @return {Bid[]} An array of bids which were nested inside the server.
*/
- interpretResponse: function(serverResponse, bidRequest) {
+ interpretResponse: function(serverResponse, bidRequest, RendererConst = Renderer) {
serverResponse = serverResponse && serverResponse.body;
const bidResponses = [];
@@ -321,15 +348,18 @@ export const spec = {
errorMessage = LOG_ERROR_MESS.hasEmptySeatbidArray;
}
+ const bidderCode = this.forceBidderName || this.code;
+
if (!errorMessage && serverResponse.seatbid) {
serverResponse.seatbid.forEach(respItem => {
- _addBidResponse(_getBidFromResponse(respItem), bidRequest, bidResponses);
+ _addBidResponse(_getBidFromResponse(respItem), bidRequest, bidResponses, RendererConst, bidderCode);
});
}
if (errorMessage) logError(errorMessage);
return bidResponses;
},
- getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
+ getUserSyncs: function (...args) {
+ const [syncOptions,, gdprConsent, uspConsent] = args;
if (!hasSynced && syncOptions.pixelEnabled) {
let params = '';
@@ -345,10 +375,13 @@ export const spec = {
params += `&us_privacy=${uspConsent}`;
}
+ const bidderCode = this.forceBidderName || this.code;
+ const syncUrl = (ALIAS_CONFIG[bidderCode] && ALIAS_CONFIG[bidderCode].syncurl) || SYNC_URL;
+
hasSynced = true;
return {
type: 'image',
- url: SYNC_URL + params
+ url: syncUrl + params
};
}
}
@@ -392,7 +425,7 @@ function _getBidFromResponse(respItem) {
return respItem && respItem.bid && respItem.bid[0];
}
-function _addBidResponse(serverBid, bidRequest, bidResponses) {
+function _addBidResponse(serverBid, bidRequest, bidResponses, RendererConst, bidderCode) {
if (!serverBid) return;
let errorMessage;
if (!serverBid.auid) errorMessage = LOG_ERROR_MESS.noAuid + JSON.stringify(serverBid);
@@ -434,13 +467,14 @@ function _addBidResponse(serverBid, bidRequest, bidResponses) {
bidResponse.renderer = createRenderer(bidResponse, {
id: bid.bidId,
url: RENDERER_URL
- });
+ }, RendererConst);
}
} else {
bidResponse.ad = serverBid.adm;
bidResponse.mediaType = BANNER;
}
- bidResponses.push(bidResponse);
+ const bidResponseExternal = (ALIAS_CONFIG[bidderCode] && ALIAS_CONFIG[bidderCode].bidResponseExternal) || {};
+ bidResponses.push(mergeDeep(bidResponse, bidResponseExternal));
}
}
if (errorMessage) {
@@ -568,8 +602,8 @@ function outstreamRender (bid) {
});
}
-function createRenderer (bid, rendererParams) {
- const renderer = Renderer.install({
+function createRenderer (bid, rendererParams, RendererConst) {
+ const renderer = RendererConst.install({
id: rendererParams.id,
url: rendererParams.url,
loaded: false
diff --git a/modules/gridNMBidAdapter.js b/modules/gridNMBidAdapter.js
index 3c46b25b8e1..63c42f60933 100644
--- a/modules/gridNMBidAdapter.js
+++ b/modules/gridNMBidAdapter.js
@@ -67,7 +67,7 @@ export const spec = {
const requests = [];
let { bidderRequestId, auctionId, gdprConsent, uspConsent, timeout, refererInfo } = bidderRequest || {};
- const referer = refererInfo ? encodeURIComponent(refererInfo.referer) : '';
+ const referer = refererInfo ? encodeURIComponent(refererInfo.page) : '';
bids.forEach(bid => {
let user;
diff --git a/modules/growadvertisingBidAdapter.js b/modules/growadvertisingBidAdapter.js
index 286d27607c5..0fdca8265c6 100644
--- a/modules/growadvertisingBidAdapter.js
+++ b/modules/growadvertisingBidAdapter.js
@@ -101,7 +101,8 @@ export const spec = {
netRevenue: true,
ttl: response.ttl,
adUnitCode: request.adUnitCode,
- referrer: deepAccess(request, 'refererInfo.referer')
+ // TODO: is 'page' the right value here?
+ referrer: deepAccess(request, 'refererInfo.page')
};
if (response.hasOwnProperty(NATIVE)) {
diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js
index f7662f54fae..cf6c390d494 100644
--- a/modules/gumgumBidAdapter.js
+++ b/modules/gumgumBidAdapter.js
@@ -294,7 +294,7 @@ function buildRequests(validBidRequests, bidderRequest) {
const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
const uspConsent = bidderRequest && bidderRequest.uspConsent;
const timeout = config.getConfig('bidderTimeout');
- const topWindowUrl = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const topWindowUrl = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page;
_each(validBidRequests, bidRequest => {
const {
bidId,
diff --git a/modules/gxoneBidAdapter.md b/modules/gxoneBidAdapter.md
deleted file mode 100644
index 3168d297da3..00000000000
--- a/modules/gxoneBidAdapter.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Overview
-
-Module Name: GXOne Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: olivier@geronimo.co
-
-# Description
-
-Module that connects to GXOne demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "gxone",
- params: {
- uid: '2',
- priceType: 'gross' // by default is 'net'
- }
- }
- ]
- },{
- code: 'test-div',
- sizes: [[728, 90]],
- bids: [
- {
- bidder: "gxone",
- params: {
- uid: 9,
- priceType: 'gross'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/h12mediaBidAdapter.js b/modules/h12mediaBidAdapter.js
index 9a6244a9e82..29d8bfa5e0f 100644
--- a/modules/h12mediaBidAdapter.js
+++ b/modules/h12mediaBidAdapter.js
@@ -70,8 +70,9 @@ export const spec = {
gdpr_cs: deepAccess(bidderRequest, 'gdprConsent.consentString', ''),
usp: !!deepAccess(bidderRequest, 'uspConsent', false),
usp_cs: deepAccess(bidderRequest, 'uspConsent', ''),
- topLevelUrl: deepAccess(bidderRequest, 'refererInfo.referer', ''),
- refererUrl: windowTop.document.referrer,
+ topLevelUrl: deepAccess(bidderRequest, 'refererInfo.page', ''),
+ // TODO: does the fallback make sense here?
+ refererUrl: deepAccess(bidderRequest, 'refererInfo.ref', window.document.referrer),
isiframe,
version: '$prebid.version$',
ExtUserIDs: bidRequest.userId,
diff --git a/modules/hadronAnalyticsAdapter.js b/modules/hadronAnalyticsAdapter.js
index bc112989426..c0e39925b4a 100644
--- a/modules/hadronAnalyticsAdapter.js
+++ b/modules/hadronAnalyticsAdapter.js
@@ -36,10 +36,7 @@ var pageView = {
timezoneOffset: new Date().getTimezoneOffset(),
language: window.navigator.language,
vendor: window.navigator.vendor,
- pageUrl: (() => {
- const ri = getRefererInfo();
- return ri.canonicalUrl || ri.referer;
- })(),
+ pageUrl: getRefererInfo().page,
screenWidth: x,
screenHeight: y
};
diff --git a/modules/hadronRtdProvider.js b/modules/hadronRtdProvider.js
index a99edbe6951..83babef8986 100644
--- a/modules/hadronRtdProvider.js
+++ b/modules/hadronRtdProvider.js
@@ -118,27 +118,13 @@ export function addRealTimeData(bidConfig, rtd, rtdConfig) {
if (rtdConfig.params && rtdConfig.params.handleRtd) {
rtdConfig.params.handleRtd(bidConfig, rtd, rtdConfig, config);
} else {
+ // TODO: this and haloRtdProvider are a copy-paste of each other
if (isPlainObject(rtd.ortb2)) {
- let ortb2 = config.getConfig('ortb2') || {};
- config.setConfig({ortb2: mergeLazy(ortb2, rtd.ortb2)});
+ mergeLazy(bidConfig.ortb2Fragments?.global, rtd.ortb2);
}
if (isPlainObject(rtd.ortb2b)) {
- let bidderConfig = config.getBidderConfig();
-
- Object.keys(rtd.ortb2b).forEach(bidder => {
- let rtdOptions = rtd.ortb2b[bidder] || {};
-
- let bidderOptions = {};
- if (isPlainObject(bidderConfig[bidder])) {
- bidderOptions = bidderConfig[bidder];
- }
-
- config.setBidderConfig({
- bidders: [bidder],
- config: mergeLazy(bidderOptions, rtdOptions)
- });
- });
+ mergeLazy(bidConfig.ortb2Fragments?.bidder, Object.fromEntries(Object.entries(rtd.ortb2b).map(([_, cfg]) => [_, cfg.ortb2])));
}
}
}
@@ -165,11 +151,13 @@ export function getRealTimeData(bidConfig, onDone, rtdConfig, userConsent) {
}
}
- const userIds = (getGlobal()).getUserIds();
+ const userIds = typeof getGlobal().getUserIds === 'function' ? (getGlobal()).getUserIds() : {};
let hadronId = storage.getDataFromLocalStorage(HALOID_LOCAL_NAME);
if (isStr(hadronId)) {
- (getGlobal()).refreshUserIds({submoduleNames: 'hadronId'});
+ if (typeof getGlobal().refreshUserIds === 'function') {
+ (getGlobal()).refreshUserIds({submoduleNames: 'hadronId'});
+ }
userIds.hadronId = hadronId;
getRealTimeDataAsync(bidConfig, onDone, rtdConfig, userConsent, userIds);
} else {
@@ -197,7 +185,7 @@ export function getRealTimeDataAsync(bidConfig, onDone, rtdConfig, userConsent,
let reqParams = {};
if (isPlainObject(rtdConfig)) {
- set(rtdConfig, 'params.requestParams.ortb2', config.getConfig('ortb2'));
+ set(rtdConfig, 'params.requestParams.ortb2', bidConfig.ortb2Fragments.global);
reqParams = rtdConfig.params.requestParams;
}
diff --git a/modules/haloIdSystem.js b/modules/haloIdSystem.js
deleted file mode 100644
index 2ce18e1e740..00000000000
--- a/modules/haloIdSystem.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * This module adds HaloID to the User ID module
- * The {@link module:modules/userId} module is required
- * @module modules/haloIdSystem
- * @requires module:modules/userId
- */
-
-import {ajax} from '../src/ajax.js';
-import {getStorageManager} from '../src/storageManager.js';
-import {submodule} from '../src/hook.js';
-import { isFn, isStr, isPlainObject, logError } from '../src/utils.js';
-
-const MODULE_NAME = 'haloId';
-const AU_GVLID = 561;
-
-export const storage = getStorageManager({gvlid: AU_GVLID, moduleName: 'halo'});
-
-/**
- * Param or default.
- * @param {String} param
- * @param {String} defaultVal
- */
-function paramOrDefault(param, defaultVal, arg) {
- if (isFn(param)) {
- return param(arg);
- } else if (isStr(param)) {
- return param;
- }
- return defaultVal;
-}
-
-/** @type {Submodule} */
-export const haloIdSubmodule = {
- /**
- * used to link submodule with config
- * @type {string}
- */
- name: MODULE_NAME,
- /**
- * decode the stored id value for passing to bid requests
- * @function
- * @param {{value:string}} value
- * @returns {{haloId:Object}}
- */
- decode(value) {
- let haloId = storage.getDataFromLocalStorage('auHaloId');
- if (isStr(haloId)) {
- return {haloId: haloId};
- }
- return (value && typeof value['haloId'] === 'string') ? { 'haloId': value['haloId'] } : undefined;
- },
- /**
- * performs action to obtain id and return a value in the callback's response argument
- * @function
- * @param {SubmoduleConfig} [config]
- * @returns {IdResponse|undefined}
- */
- getId(config) {
- if (!isPlainObject(config.params)) {
- config.params = {};
- }
- const url = paramOrDefault(config.params.url,
- `https://id.halo.ad.gt/api/v1/pbhid`,
- config.params.urlArg);
-
- const resp = function (callback) {
- let haloId = storage.getDataFromLocalStorage('auHaloId');
- if (isStr(haloId)) {
- const responseObj = {haloId: haloId};
- callback(responseObj);
- } else {
- const callbacks = {
- success: response => {
- let responseObj;
- if (response) {
- try {
- responseObj = JSON.parse(response);
- } catch (error) {
- logError(error);
- }
- }
- callback(responseObj);
- },
- error: error => {
- logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
- callback();
- }
- };
- ajax(url, callbacks, undefined, {method: 'GET'});
- }
- };
- return {callback: resp};
- }
-};
-
-submodule('userId', haloIdSubmodule);
diff --git a/modules/haloIdSystem.md b/modules/haloIdSystem.md
deleted file mode 100644
index 7c58aea3ec6..00000000000
--- a/modules/haloIdSystem.md
+++ /dev/null
@@ -1,4 +0,0 @@
-## Audigent Halo has been rebranded as Hadron
-## Use the Hadron Id Submodule
-## The Halo modules will be removed from Prebid 7
-## Contact prebid@audigent.com for more info.
diff --git a/modules/haloRtdProvider.js b/modules/haloRtdProvider.js
deleted file mode 100644
index 1810bfb6f63..00000000000
--- a/modules/haloRtdProvider.js
+++ /dev/null
@@ -1,254 +0,0 @@
-/**
- * This module adds the Audigent Halo provider to the real time data module
- * The {@link module:modules/realTimeData} module is required
- * The module will fetch real-time data from Audigent
- * @module modules/haloRtdProvider
- * @requires module:modules/realTimeData
- */
-import {ajax} from '../src/ajax.js';
-import {config} from '../src/config.js';
-import {getGlobal} from '../src/prebidGlobal.js';
-import {getStorageManager} from '../src/storageManager.js';
-import {submodule} from '../src/hook.js';
-import {isFn, isStr, isArray, deepEqual, isPlainObject, logError} from '../src/utils.js';
-
-const MODULE_NAME = 'realTimeData';
-const SUBMODULE_NAME = 'halo';
-const AU_GVLID = 561;
-
-export const HALOID_LOCAL_NAME = 'auHaloId';
-export const RTD_LOCAL_NAME = 'auHaloRtd';
-export const storage = getStorageManager({gvlid: AU_GVLID, moduleName: SUBMODULE_NAME});
-
-/**
- * Deep set an object unless value present.
- * @param {Object} obj
- * @param {String} path
- * @param {Object} val
- */
-function set(obj, path, val) {
- const keys = path.split('.');
- const lastKey = keys.pop();
- const lastObj = keys.reduce((obj, key) => obj[key] = obj[key] || {}, obj);
- lastObj[lastKey] = lastObj[lastKey] || val;
-}
-
-/**
- * Deep object merging with array deduplication.
- * @param {Object} target
- * @param {Object} sources
- */
-function mergeDeep(target, ...sources) {
- if (!sources.length) return target;
- const source = sources.shift();
-
- if (isPlainObject(target) && isPlainObject(source)) {
- for (const key in source) {
- if (isPlainObject(source[key])) {
- if (!target[key]) Object.assign(target, { [key]: {} });
- mergeDeep(target[key], source[key]);
- } else if (isArray(source[key])) {
- if (!target[key]) {
- Object.assign(target, { [key]: source[key] });
- } else if (isArray(target[key])) {
- source[key].forEach(obj => {
- let e = 1;
- for (let i = 0; i < target[key].length; i++) {
- if (deepEqual(target[key][i], obj)) {
- e = 0;
- break;
- }
- }
- if (e) {
- target[key].push(obj);
- }
- });
- }
- } else {
- Object.assign(target, { [key]: source[key] });
- }
- }
- }
-
- return mergeDeep(target, ...sources);
-}
-
-/**
- * Lazy merge objects.
- * @param {Object} target
- * @param {Object} source
- */
-function mergeLazy(target, source) {
- if (!isPlainObject(target)) {
- target = {};
- }
-
- if (!isPlainObject(source)) {
- source = {};
- }
-
- return mergeDeep(target, source);
-}
-
-/**
- * Param or default.
- * @param {String} param
- * @param {String} defaultVal
- */
-function paramOrDefault(param, defaultVal, arg) {
- if (isFn(param)) {
- return param(arg);
- } else if (isStr(param)) {
- return param;
- }
- return defaultVal;
-}
-
-/**
- * Add real-time data & merge segments.
- * @param {Object} bidConfig
- * @param {Object} rtd
- * @param {Object} rtdConfig
- */
-export function addRealTimeData(bidConfig, rtd, rtdConfig) {
- if (rtdConfig.params && rtdConfig.params.handleRtd) {
- rtdConfig.params.handleRtd(bidConfig, rtd, rtdConfig, config);
- } else {
- if (isPlainObject(rtd.ortb2)) {
- let ortb2 = config.getConfig('ortb2') || {};
- config.setConfig({ortb2: mergeLazy(ortb2, rtd.ortb2)});
- }
-
- if (isPlainObject(rtd.ortb2b)) {
- let bidderConfig = config.getBidderConfig();
-
- Object.keys(rtd.ortb2b).forEach(bidder => {
- let rtdOptions = rtd.ortb2b[bidder] || {};
-
- let bidderOptions = {};
- if (isPlainObject(bidderConfig[bidder])) {
- bidderOptions = bidderConfig[bidder];
- }
-
- config.setBidderConfig({
- bidders: [bidder],
- config: mergeLazy(bidderOptions, rtdOptions)
- });
- });
- }
- }
-}
-
-/**
- * Real-time data retrieval from Audigent
- * @param {Object} reqBidsConfigObj
- * @param {function} onDone
- * @param {Object} rtdConfig
- * @param {Object} userConsent
- */
-export function getRealTimeData(bidConfig, onDone, rtdConfig, userConsent) {
- if (rtdConfig && isPlainObject(rtdConfig.params) && rtdConfig.params.segmentCache) {
- let jsonData = storage.getDataFromLocalStorage(RTD_LOCAL_NAME);
-
- if (jsonData) {
- let data = JSON.parse(jsonData);
-
- if (data.rtd) {
- addRealTimeData(bidConfig, data.rtd, rtdConfig);
- onDone();
- return;
- }
- }
- }
-
- const userIds = (getGlobal()).getUserIds();
-
- let haloId = storage.getDataFromLocalStorage(HALOID_LOCAL_NAME);
- if (isStr(haloId)) {
- (getGlobal()).refreshUserIds({submoduleNames: 'haloId'});
- userIds.haloId = haloId;
- getRealTimeDataAsync(bidConfig, onDone, rtdConfig, userConsent, userIds);
- } else {
- var script = document.createElement('script');
- script.type = 'text/javascript';
-
- window.pubHaloCb = (haloId) => {
- userIds.haloId = haloId;
- getRealTimeDataAsync(bidConfig, onDone, rtdConfig, userConsent, userIds);
- }
-
- const haloIdUrl = rtdConfig.params && rtdConfig.params.haloIdUrl;
- script.src = paramOrDefault(haloIdUrl, 'https://id.halo.ad.gt/api/v1/haloid', userIds);
- document.getElementsByTagName('head')[0].appendChild(script);
- }
-}
-
-/**
- * Async rtd retrieval from Audigent
- * @param {function} onDone
- * @param {Object} rtdConfig
- * @param {Object} userConsent
- * @param {Object} userIds
- */
-export function getRealTimeDataAsync(bidConfig, onDone, rtdConfig, userConsent, userIds) {
- let reqParams = {};
-
- if (isPlainObject(rtdConfig)) {
- set(rtdConfig, 'params.requestParams.ortb2', config.getConfig('ortb2'));
- reqParams = rtdConfig.params.requestParams;
- }
-
- if (isPlainObject(window.pubHaloPm)) {
- reqParams.pubHaloPm = window.pubHaloPm;
- }
-
- const url = `https://seg.halo.ad.gt/api/v1/rtd`;
- ajax(url, {
- success: function (response, req) {
- if (req.status === 200) {
- try {
- const data = JSON.parse(response);
- if (data && data.rtd) {
- addRealTimeData(bidConfig, data.rtd, rtdConfig);
- onDone();
- storage.setDataInLocalStorage(RTD_LOCAL_NAME, JSON.stringify(data));
- } else {
- onDone();
- }
- } catch (err) {
- logError('unable to parse audigent segment data');
- onDone();
- }
- } else if (req.status === 204) {
- // unrecognized partner config
- onDone();
- }
- },
- error: function () {
- onDone();
- logError('unable to get audigent segment data');
- }
- },
- JSON.stringify({'userIds': userIds, 'config': reqParams}),
- {contentType: 'application/json'}
- );
-}
-
-/**
- * Module init
- * @param {Object} provider
- * @param {Objkect} userConsent
- * @return {boolean}
- */
-function init(provider, userConsent) {
- return true;
-}
-
-/** @type {RtdSubmodule} */
-export const haloSubmodule = {
- name: SUBMODULE_NAME,
- getBidRequestData: getRealTimeData,
- init: init
-};
-
-submodule(MODULE_NAME, haloSubmodule);
diff --git a/modules/haloRtdProvider.md b/modules/haloRtdProvider.md
deleted file mode 100644
index 6ae5a3f75fa..00000000000
--- a/modules/haloRtdProvider.md
+++ /dev/null
@@ -1,3 +0,0 @@
-## Audigent Halo has been rebranded as Hadron
-## Use the Hadron Rtd Submodule
-## The Halo modules will be removed from Prebid 7
\ No newline at end of file
diff --git a/modules/haxmediaBidAdapter.md b/modules/haxmediaBidAdapter.md
deleted file mode 100644
index f661a9e4e71..00000000000
--- a/modules/haxmediaBidAdapter.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# Overview
-
-```
-Module Name: haxmedia Bidder Adapter
-Module Type: haxmedia Bidder Adapter
-Maintainer: haxmixqk@haxmediapartners.io
-```
-
-# Description
-
-Module that connects to haxmedia demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code:'1',
- mediaTypes:{
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids:[
- {
- bidder: 'haxmedia',
- params: {
- placementId: 0
- }
- }
- ]
- },
- {
- code:'1',
- mediaTypes:{
- video: {
- playerSize: [640, 480],
- context: 'instream'
- }
- },
- bids:[
- {
- bidder: 'haxmedia',
- params: {
- placementId: 0
- }
- }
- ]
- },
- {
- code:'1',
- mediaTypes:{
- native: {
- title: {
- required: true
- },
- icon: {
- required: true,
- size: [64, 64]
- }
- }
- },
- bids:[
- {
- bidder: 'haxmedia',
- params: {
- placementId: 0
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/hpmdnetworkBidAdapter.md b/modules/hpmdnetworkBidAdapter.md
deleted file mode 100644
index b7ac51a9311..00000000000
--- a/modules/hpmdnetworkBidAdapter.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Overview
-
-Module Name: HPMD Network Bidder Adapter
-
-Module Type: Bidder Adapter
-
-Maintainer: a.fominov@hpmdnetwork.ru
-
-# Description
-
-You can use this adapter to get a bid from HPMD Network.
-
-About us : https://www.hpmdnetwork.ru/
-
-
-# Test Parameters
-```javascript
- var adUnits = [
- {
- code: 'test-div',
- bids: [
- {
- bidder: "hpmdnetwork",
- params: {
- placementId: "123"
- }
- }
- ]
- }
- ];
-```
-
diff --git a/modules/huddledmassesBidAdapter.md b/modules/huddledmassesBidAdapter.md
deleted file mode 100644
index c743f4a2fd8..00000000000
--- a/modules/huddledmassesBidAdapter.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Overview
-
-```
-Module Name: HuddledMasses Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: supply@huddledmasses.com
-```
-
-# Description
-
-Module that connects to HuddledMasses' demand sources
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'placementid_0',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'huddledmasses',
- params: {
- placement_id: 0
- }
- }]
- }
- ];
-```
diff --git a/modules/hybridBidAdapter.js b/modules/hybridBidAdapter.js
index 98fecf04d8d..6cedb094444 100644
--- a/modules/hybridBidAdapter.js
+++ b/modules/hybridBidAdapter.js
@@ -204,7 +204,8 @@ export const spec = {
*/
buildRequests(validBidRequests, bidderRequest) {
const payload = {
- url: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ url: bidderRequest.refererInfo.page,
cmp: !!bidderRequest.gdprConsent,
trafficType: TRAFFIC_TYPE_WEB,
bidRequests: buildBidRequests(validBidRequests)
diff --git a/modules/id5IdSystem.js b/modules/id5IdSystem.js
index b57be00d3ac..96ec1fed754 100644
--- a/modules/id5IdSystem.js
+++ b/modules/id5IdSystem.js
@@ -122,7 +122,7 @@ export const id5IdSubmodule = {
'gdpr': hasGdpr,
'nbPage': incrementNb(config.params.partner),
'o': 'pbjs',
- 'rf': referer.referer,
+ 'rf': referer.topmostLocation,
'top': referer.reachedTop ? 1 : 0,
'u': referer.stack[0] || window.location.href,
'v': '$prebid.version$'
diff --git a/modules/idWardRtdProvider.js b/modules/idWardRtdProvider.js
index a130d3cc8d2..9678739672d 100644
--- a/modules/idWardRtdProvider.js
+++ b/modules/idWardRtdProvider.js
@@ -5,7 +5,6 @@
* @module modules/idWardRtdProvider
* @requires module:modules/realTimeData
*/
-import {config} from '../src/config.js';
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import {isPlainObject, mergeDeep, logMessage, logError} from '../src/utils.js';
@@ -15,15 +14,15 @@ const SUBMODULE_NAME = 'idWard';
export const storage = getStorageManager({moduleName: SUBMODULE_NAME});
/**
- * Add real-time data & merge segments.
- * @param {Object} rtd
- */
-function addRealTimeData(rtd) {
+ * Add real-time data & merge segments.
+ * @param ortb2 object to merge into
+ * @param {Object} rtd
+ */
+function addRealTimeData(ortb2, rtd) {
if (isPlainObject(rtd.ortb2)) {
- const ortb2 = config.getConfig('ortb2') || {};
logMessage('idWardRtdProvider: merging original: ', ortb2);
logMessage('idWardRtdProvider: merging in: ', rtd.ortb2);
- config.setConfig({ortb2: mergeDeep(ortb2, rtd.ortb2)});
+ mergeDeep(ortb2, rtd.ortb2);
}
}
@@ -78,7 +77,7 @@ export function getRealTimeData(reqBidsConfigObj, onDone, rtdConfig, userConsent
}
}
};
- addRealTimeData(data.rtd);
+ addRealTimeData(reqBidsConfigObj.ortb2Fragments?.global, data.rtd);
onDone();
}
}
diff --git a/modules/imRtdProvider.js b/modules/imRtdProvider.js
index 6c582df3df3..b33e4407b13 100644
--- a/modules/imRtdProvider.js
+++ b/modules/imRtdProvider.js
@@ -96,9 +96,8 @@ export function setRealTimeData(bidConfig, moduleConfig, data) {
const utils = {deepSetValue, deepAccess, logInfo, logError, mergeDeep};
if (data.im_segments) {
- const ortb2 = config.getConfig('ortb2') || {};
+ const ortb2 = bidConfig.ortb2Fragments?.global || {};
deepSetValue(ortb2, 'user.ext.data.im_segments', data.im_segments);
- config.setConfig({ortb2: ortb2});
if (moduleConfig.params.setGptKeyValues || !moduleConfig.params.hasOwnProperty('setGptKeyValues')) {
window.googletag = window.googletag || {cmd: []};
diff --git a/modules/imonomyBidAdapter.md b/modules/imonomyBidAdapter.md
deleted file mode 100644
index 451eb0994d8..00000000000
--- a/modules/imonomyBidAdapter.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Overview
-
-**Module Name**: Imonomy Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: support@imonomy.com
-
-# Description
-
-Connects to Imonomy demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'banner-ad-div',
- sizes: [[300, 250]],
-
- // Replace this object to test a new Adapter!
- bids: [{
- bidder: 'imonomy',
- params: {
- placementId: 'e69148e0ba6c4c07977dc2daae5e1577',
- hbid: '14567718624',
- floorPrice: 0.5
- }
- }]
- }];
-```
-
-
diff --git a/modules/impactifyBidAdapter.js b/modules/impactifyBidAdapter.js
index b204e81f22c..a4010772db0 100644
--- a/modules/impactifyBidAdapter.js
+++ b/modules/impactifyBidAdapter.js
@@ -65,7 +65,7 @@ const createOpenRtbRequest = (validBidRequests, bidderRequest) => {
dnt: (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0,
language: ((navigator.language || navigator.userLanguage || '').split('-'))[0] || 'en',
};
- request.site = {page: bidderRequest.refererInfo.referer};
+ request.site = {page: bidderRequest.refererInfo.page};
// Handle privacy settings for GDPR/CCPA/COPPA
let gdprApplies = 0;
diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js
index a0453466b87..a7a97f4c839 100644
--- a/modules/improvedigitalBidAdapter.js
+++ b/modules/improvedigitalBidAdapter.js
@@ -1,12 +1,23 @@
import {
- cleanObj, deepAccess, deepClone, deepSetValue, getBidIdParameter, getBidRequest, getDNT,
- getUniqueIdentifierStr, isFn, isPlainObject, logWarn, mergeDeep, parseUrl
+ cleanObj,
+ deepAccess,
+ deepClone,
+ deepSetValue,
+ getBidIdParameter,
+ getBidRequest,
+ getDNT,
+ getUniqueIdentifierStr,
+ isFn,
+ isPlainObject,
+ logWarn,
+ mergeDeep
} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
import {createEidsArray} from './userId/eids.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'improvedigital';
const CREATIVE_TTL = 300;
@@ -217,7 +228,7 @@ export const spec = {
* @return {UserSync[]} The user syncs which should be dropped.
*/
getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent) {
- if (config.getConfig('coppa') === true || !ID_UTIL.hasPurpose1Consent(gdprConsent)) {
+ if (config.getConfig('coppa') === true || !hasPurpose1Consent(gdprConsent)) {
return [];
}
@@ -480,20 +491,20 @@ const ID_REQUEST = {
buildSiteOrApp(request, bidderRequest) {
const app = {};
const configAppSettings = config.getConfig('app') || {};
- const fpdAppSettings = config.getConfig('ortb2.app') || {};
+ const fpdAppSettings = bidderRequest.ortb2?.app || {};
mergeDeep(app, configAppSettings, fpdAppSettings);
if (Object.keys(app).length !== 0) {
request.app = app;
} else {
const site = {};
- const url = config.getConfig('pageUrl') || deepAccess(bidderRequest, 'refererInfo.referer');
+ const url = deepAccess(bidderRequest, 'refererInfo.page');
if (url) {
site.page = url;
- site.domain = parseUrl(url).hostname;
+ site.domain = bidderRequest.refererInfo.domain
}
const configSiteSettings = config.getConfig('site') || {};
- const fpdSiteSettings = config.getConfig('ortb2.site') || {};
+ const fpdSiteSettings = deepAccess(bidderRequest, 'ortb2.site') || {};
mergeDeep(site, configSiteSettings, fpdSiteSettings);
request.site = site;
}
@@ -656,12 +667,3 @@ const ID_RAZR = {
razr.queue.push(payload);
}
};
-
-const ID_UTIL = {
- hasPurpose1Consent(gdprConsent) {
- if (gdprConsent && gdprConsent.gdprApplies && gdprConsent.apiVersion === 2) {
- return (deepAccess(gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- return true;
- }
-};
diff --git a/modules/incrxBidAdapter.js b/modules/incrxBidAdapter.js
index 5926f5a8729..914ef0b904e 100644
--- a/modules/incrxBidAdapter.js
+++ b/modules/incrxBidAdapter.js
@@ -36,7 +36,8 @@ export const spec = {
_vzPlacementId: bidRequest.params.placementId,
sizes: sizes,
_slotBidId: bidRequest.bidId,
- _rqsrc: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ _rqsrc: bidderRequest.refererInfo.page,
};
const payload = {
diff --git a/modules/incrxBidAdapter.md b/modules/incrxBidAdapter.md
deleted file mode 100644
index 7feda2b2b6d..00000000000
--- a/modules/incrxBidAdapter.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Overview
-
-```
-Module Name: IncrementX Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid-team@vertoz.com
-```
-
-# Description
-
-Connects to IncrementX exchange for bids.
-IncrementX Bidder adapter supports Banner ads.
-Use bidder code ```incrementx``` for all IncrementX traffic.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner adUnit
- {
- code: 'banner-div',
- sizes: [[300, 250], [300,600]], // a display size(s)
- bids: [{
- bidder: 'incrementx',
- params: {
- placementId: 'PNX-HB-F796830VCF3C4B'
- }
- }]
- },
-];
-```
-
diff --git a/modules/inmarBidAdapter.js b/modules/inmarBidAdapter.js
index 0e056551b35..42bd64ee816 100755
--- a/modules/inmarBidAdapter.js
+++ b/modules/inmarBidAdapter.js
@@ -1,4 +1,4 @@
-import { logError } from '../src/utils.js';
+import {logError, mergeDeep} from '../src/utils.js';
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
@@ -34,13 +34,14 @@ export const spec = {
bidRequests: validBidRequests,
auctionStart: bidderRequest.auctionStart,
timeout: bidderRequest.timeout,
- refererInfo: bidderRequest.refererInfo,
+ // TODO: please do not send internal data structures over the network
+ refererInfo: bidderRequest.refererInfo.legacy,
start: bidderRequest.start,
gdprConsent: bidderRequest.gdprConsent,
uspConsent: bidderRequest.uspConsent,
currencyCode: config.getConfig('currency.adServerCurrency'),
coppa: config.getConfig('coppa'),
- firstPartyData: config.getLegacyFpd(config.getConfig('ortb2')),
+ firstPartyData: getLegacyFpd(bidderRequest.ortb2),
prebidVersion: '$prebid.version$'
};
@@ -107,4 +108,25 @@ export const spec = {
}
};
+function getLegacyFpd(ortb2) {
+ if (typeof ortb2 !== 'object') return;
+
+ let duplicate = {};
+
+ Object.keys(ortb2).forEach((type) => {
+ let prop = (type === 'site') ? 'context' : type;
+ duplicate[prop] = (prop === 'context' || prop === 'user') ? Object.keys(ortb2[type]).filter(key => key !== 'data').reduce((result, key) => {
+ if (key === 'ext') {
+ mergeDeep(result, ortb2[type][key]);
+ } else {
+ mergeDeep(result, {[key]: ortb2[type][key]});
+ }
+
+ return result;
+ }, {}) : ortb2[type];
+ });
+
+ return duplicate;
+}
+
registerBidder(spec);
diff --git a/modules/innityBidAdapter.js b/modules/innityBidAdapter.js
index 0a2f701ef64..71fe588441c 100644
--- a/modules/innityBidAdapter.js
+++ b/modules/innityBidAdapter.js
@@ -23,7 +23,7 @@ export const spec = {
output: 'js',
pub: bidRequest.params.pub,
zone: bidRequest.params.zone,
- url: bidderRequest && bidderRequest.refererInfo ? encodeURIComponent(bidderRequest.refererInfo.referer) : '',
+ url: bidderRequest && bidderRequest.refererInfo ? encodeURIComponent(bidderRequest.refererInfo.page) : '',
width: arrSize[0],
height: arrSize[1],
vpw: window.screen.width,
diff --git a/modules/inskinBidAdapter.js b/modules/inskinBidAdapter.js
index 6f0023498aa..b76a759a047 100644
--- a/modules/inskinBidAdapter.js
+++ b/modules/inskinBidAdapter.js
@@ -50,7 +50,7 @@ export const spec = {
placements: [],
time: Date.now(),
user: {},
- url: bidderRequest.refererInfo.referer,
+ url: bidderRequest.refererInfo.page,
enableBotFiltering: true,
includePricingData: true,
parallel: true
@@ -83,31 +83,29 @@ export const spec = {
gdprConsentRequired: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true
};
- if (bidderRequest.gdprConsent.apiVersion === 2) {
- const purposes = [
- {id: 1, kw: 'nocookies'},
- {id: 2, kw: 'nocontext'},
- {id: 3, kw: 'nodmp'},
- {id: 4, kw: 'nodata'},
- {id: 7, kw: 'noclicks'},
- {id: 9, kw: 'noresearch'}
- ];
-
- const d = bidderRequest.gdprConsent.vendorData;
-
- if (d) {
- if (d.purposeOneTreatment) {
- data.keywords.push('cst-nodisclosure');
- restrictions.push('nodisclosure');
- }
-
- purposes.map(p => {
- if (!checkConsent(p.id, d)) {
- data.keywords.push('cst-' + p.kw);
- restrictions.push(p.kw);
- }
- });
+ const purposes = [
+ {id: 1, kw: 'nocookies'},
+ {id: 2, kw: 'nocontext'},
+ {id: 3, kw: 'nodmp'},
+ {id: 4, kw: 'nodata'},
+ {id: 7, kw: 'noclicks'},
+ {id: 9, kw: 'noresearch'}
+ ];
+
+ const d = bidderRequest.gdprConsent.vendorData;
+
+ if (d) {
+ if (d.purposeOneTreatment) {
+ data.keywords.push('cst-nodisclosure');
+ restrictions.push('nodisclosure');
}
+
+ purposes.map(p => {
+ if (!checkConsent(p.id, d)) {
+ data.keywords.push('cst-' + p.kw);
+ restrictions.push(p.kw);
+ }
+ });
}
}
diff --git a/modules/insticatorBidAdapter.js b/modules/insticatorBidAdapter.js
index 4d069cc91a6..07ccfb16de1 100644
--- a/modules/insticatorBidAdapter.js
+++ b/modules/insticatorBidAdapter.js
@@ -177,9 +177,10 @@ function buildRequest(validBidRequests, bidderRequest) {
tid: bidderRequest.auctionId,
},
site: {
- domain: location.hostname,
- page: location.href,
- ref: bidderRequest.refererInfo.referer,
+ // TODO: are these the right refererInfo values?
+ domain: bidderRequest.refererInfo.domain,
+ page: bidderRequest.refererInfo.page,
+ ref: bidderRequest.refererInfo.ref,
},
device: buildDevice(),
regs: buildRegs(bidderRequest),
diff --git a/modules/integr8BidAdapter.js b/modules/integr8BidAdapter.js
index d61fe624c59..3ba68ffb6d6 100644
--- a/modules/integr8BidAdapter.js
+++ b/modules/integr8BidAdapter.js
@@ -46,7 +46,7 @@ export const spec = {
bidderRequestId = bidderRequest.bidderRequestId;
if (bidderRequest.refererInfo) {
- url = bidderRequest.refererInfo.referer;
+ url = bidderRequest.refererInfo.page;
}
}
diff --git a/modules/interactiveOffersBidAdapter.js b/modules/interactiveOffersBidAdapter.js
index d8a106623fd..25dcd4f3cd1 100644
--- a/modules/interactiveOffersBidAdapter.js
+++ b/modules/interactiveOffersBidAdapter.js
@@ -1,7 +1,6 @@
-import { logWarn, isNumber } from '../src/utils.js';
+import {isNumber, logWarn} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
-import {config} from '../src/config.js';
const BIDDER_CODE = 'interactiveOffers';
const ENDPOINT = 'https://prebid.ioadx.com/bidRequest/?partnerId=';
@@ -77,13 +76,15 @@ function parseRequestPrebidjsToOpenRTB(prebidRequest) {
payload: {},
partnerId: null
};
+ // TODO: these should probably look at refererInfo
let pageURL = window.location.href;
let domain = window.location.hostname;
let secure = (window.location.protocol == 'https:' ? 1 : 0);
let openRTBRequest = JSON.parse(JSON.stringify(DEFAULT['OpenRTBBidRequest']));
openRTBRequest.id = prebidRequest.auctionId;
openRTBRequest.ext = {
- refererInfo: prebidRequest.refererInfo,
+ // TODO: please do not send internal data structures over the network
+ refererInfo: prebidRequest.refererInfo.legacy,
auctionId: prebidRequest.auctionId
};
@@ -92,11 +93,11 @@ function parseRequestPrebidjsToOpenRTB(prebidRequest) {
openRTBRequest.site.name = domain;
openRTBRequest.site.domain = domain;
openRTBRequest.site.page = pageURL;
- openRTBRequest.site.ref = prebidRequest.refererInfo.referer;
+ openRTBRequest.site.ref = prebidRequest.refererInfo.ref;
openRTBRequest.site.publisher = JSON.parse(JSON.stringify(DEFAULT['OpenRTBBidRequestSitePublisher']));
openRTBRequest.site.publisher.id = 0;
- openRTBRequest.site.publisher.name = config.getConfig('publisherDomain');
+ openRTBRequest.site.publisher.name = prebidRequest.refererInfo.domain;
openRTBRequest.site.publisher.domain = domain;
openRTBRequest.site.publisher.domain = domain;
diff --git a/modules/ipromBidAdapter.js b/modules/ipromBidAdapter.js
index 46582ce95a1..eaf20ad3ad3 100644
--- a/modules/ipromBidAdapter.js
+++ b/modules/ipromBidAdapter.js
@@ -34,7 +34,8 @@ export const spec = {
buildRequests: function (validBidRequests, bidderRequest) {
const payload = {
bids: validBidRequests,
- referer: bidderRequest.refererInfo,
+ // TODO: please do not send internal data structures over the network
+ referer: bidderRequest.refererInfo.legacy,
version: VERSION
};
const payloadString = JSON.stringify(payload);
diff --git a/modules/iqmBidAdapter.js b/modules/iqmBidAdapter.js
index 75854d39fd5..68b027c1bec 100644
--- a/modules/iqmBidAdapter.js
+++ b/modules/iqmBidAdapter.js
@@ -1,4 +1,4 @@
-import { deepAccess, getBidIdParameter, isArray, _each, getWindowTop, parseUrl } from '../src/utils.js';
+import {_each, deepAccess, getBidIdParameter, isArray} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
@@ -102,7 +102,7 @@ export const spec = {
imp.video = _buildVideoORTB(bid);
imp.mediatype = 'video';
}
- const site = getSite(bid);
+ const site = getSite(bidderRequest);
let device = getDevice(bid.params);
finalRequest = {
sizes: bid.sizes,
@@ -116,6 +116,8 @@ export const spec = {
adUnitCode: bid.adUnitCode,
bidderRequestId: bid.bidderRequestId,
uuid: bid.bidId,
+ // TODO: please do not send internal data structures over the network
+ // I am not going to attempt to accommodate this, no way this is usable on their end, it changes way too frequently
bidderRequest
}
const request = {
@@ -227,19 +229,10 @@ function getSite(bidderRequest) {
const {refererInfo} = bidderRequest;
- if (canAccessTopWindow()) {
- const wt = getWindowTop();
- domain = wt.location.hostname;
- page = wt.location.href;
- referrer = wt.document.referrer || '';
- } else if (refererInfo.reachedTop) {
- const url = parseUrl(refererInfo.referer);
- domain = url.hostname;
- page = refererInfo.referer;
- } else if (refererInfo.stack && refererInfo.stack.length && refererInfo.stack[0]) {
- const url = parseUrl(refererInfo.stack[0]);
- domain = url.hostname;
- }
+ // TODO: are these the right refererInfo values?
+ domain = refererInfo.domain;
+ page = refererInfo.page;
+ referrer = refererInfo.ref;
return {
domain,
@@ -249,16 +242,6 @@ function getSite(bidderRequest) {
};
};
-function canAccessTopWindow() {
- try {
- if (getWindowTop().location.href) {
- return true;
- }
- } catch (error) {
- return false;
- }
-}
-
function _buildVideoORTB(bidRequest) {
const videoAdUnit = deepAccess(bidRequest, 'mediaTypes.video');
const videoBidderParams = deepAccess(bidRequest, 'params.video', {});
diff --git a/modules/iqzoneBidAdapter.js b/modules/iqzoneBidAdapter.js
index 6c0a2e5f56d..3bd613e786b 100644
--- a/modules/iqzoneBidAdapter.js
+++ b/modules/iqzoneBidAdapter.js
@@ -125,7 +125,7 @@ export const spec = {
winLocation = window.location;
}
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.page;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
diff --git a/modules/ironsourceBidAdapter.md b/modules/ironsourceBidAdapter.md
deleted file mode 100644
index 86756b08809..00000000000
--- a/modules/ironsourceBidAdapter.md
+++ /dev/null
@@ -1,51 +0,0 @@
-#Overview
-
-Module Name: IronSource Bidder Adapter
-
-Module Type: Bidder Adapter
-
-Maintainer: prebid-digital-brands@ironsrc.com
-
-
-# Description
-
-Module that connects to IronSource's demand sources.
-
-The IronSource adapter requires setup and approval from the IronSource. Please reach out to prebid-digital-brands@ironsrc.com to create an IronSource account.
-
-The adapter supports Video(instream). For the integration, IronSource returns content as vastXML and requires the publisher to define the cache url in config passed to Prebid for it to be valid in the auction.
-
-# Bid Parameters
-## Video
-
-| Name | Scope | Type | Description | Example
-| ---- | ----- | ---- | ----------- | -------
-| `isOrg` | required | String | IronSource publisher Id provided by your IronSource representative | "56f91cd4d3e3660002000033"
-| `floorPrice` | optional | Number | Minimum price in USD. Misuse of this parameter can impact revenue | 2.00
-| `ifa` | optional | String | The ID for advertisers (also referred to as "IDFA") | "XXX-XXX"
-| `testMode` | optional | Boolean | This activates the test mode | false
-
-# Test Parameters
-```javascript
-var adUnits = [
- {
- code: 'dfp-video-div',
- sizes: [[640, 480]],
- mediaTypes: {
- video: {
- playerSize: [[640, 480]],
- context: 'instream'
- }
- },
- bids: [{
- bidder: 'ironsource',
- params: {
- isOrg: '56f91cd4d3e3660002000033', // Required
- floorPrice: 2.00, // Optional
- ifa: 'XXX-XXX', // Optional
- testMode: false // Optional
- }
- }]
- }
- ];
-```
diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js
index 119cde07c54..216b0371e93 100644
--- a/modules/ixBidAdapter.js
+++ b/modules/ixBidAdapter.js
@@ -76,7 +76,7 @@ const SOURCE_RTI_MAPPING = {
'id5-sync.com': '', // ID5 Universal ID, configured as id5Id
'crwdcntrl.net': '', // Lotame Panorama ID, lotamePanoramaId
'epsilon.com': '', // Publisher Link, publinkId
- 'audigent.com': '', // Halo ID from Audigent, haloId
+ 'audigent.com': '', // Hadron ID from Audigent, hadronId
'pubcid.org': '', // SharedID, pubcid
'trustpid.com': '' // Trustpid
};
@@ -89,7 +89,6 @@ const PROVIDERS = [
'connectid',
'tapadId',
'quantcastId',
- 'flocId',
'pubProvidedId'
];
const REQUIRED_VIDEO_PARAMS = ['mimes', 'minduration', 'maxduration']; // note: protocol/protocols is also reqd
@@ -452,11 +451,10 @@ function getBidRequest(id, impressions, validBidRequests) {
* From the userIdAsEids array, filter for the ones our adserver can use, and modify them
* for our purposes, e.g. add rtiPartner
* @param {array} allEids userIdAsEids passed in by prebid
- * @param {object} flocId flocId passed in by prebid
* @return {object} contains toSend (eids to send to the adserver) and seenSources (used to filter
* identity info from IX Library)
*/
-function getEidInfo(allEids, flocData) {
+function getEidInfo(allEids) {
let toSend = [];
let seenSources = {};
if (isArray(allEids)) {
@@ -474,16 +472,6 @@ function getEidInfo(allEids, flocData) {
}
}
- const isValidFlocId = flocData && flocData.id && flocData.version;
- if (isValidFlocId) {
- const flocEid = {
- 'source': 'chrome.com',
- 'uids': [{ 'id': flocData.id, 'ext': { 'rtiPartner': 'flocId', 'ver': flocData.version } }]
- };
- toSend.push(flocEid);
- seenSources['chrome.com'] = true;
- }
-
return { toSend, seenSources };
}
@@ -501,9 +489,9 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
// Always use secure HTTPS protocol.
let baseUrl = SECURE_BID_URL;
// Get ids from Prebid User ID Modules
- let eidInfo = getEidInfo(deepAccess(validBidRequests, '0.userIdAsEids'), deepAccess(validBidRequests, '0.userId.flocId'));
+ let eidInfo = getEidInfo(deepAccess(validBidRequests, '0.userIdAsEids'));
let userEids = eidInfo.toSend;
- const pageUrl = getPageUrl() || deepAccess(bidderRequest, 'refererInfo.referer');
+ const pageUrl = deepAccess(bidderRequest, 'refererInfo.page');
// RTI ids will be included in the bid request if the function getIdentityInfo() is loaded
// and if the data for the partner exist
@@ -737,7 +725,7 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
currentRequestSize += currentImpressionSize;
- const fpd = config.getConfig('ortb2') || {};
+ const fpd = bidderRequest.ortb2 || {};
if (!isEmpty(fpd) && !isFpdAdded) {
r.ext.ixdiag.fpd = true;
@@ -948,20 +936,6 @@ function createBannerImps(validBidRequest, missingBannerSizes, bannerImps) {
}
}
-/**
- * Returns the `pageUrl` set by publisher on the page if it is an valid url
- */
-function getPageUrl() {
- const pageUrl = config.getConfig('pageUrl');
- try {
- const url = new URL(pageUrl);
- return url.href;
- } catch (_) {
- logWarn(`IX Bid Adapter: invalid pageUrl config property value set: ${pageUrl}`);
- return undefined;
- }
-}
-
/**
* Determines IX configuration type based on IX params
* @param {object} valid IX configured param
diff --git a/modules/jcmBidAdapter.md b/modules/jcmBidAdapter.md
deleted file mode 100644
index 53a2356df2f..00000000000
--- a/modules/jcmBidAdapter.md
+++ /dev/null
@@ -1,40 +0,0 @@
-#Overview
-
-```
-Module Name: JCM Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: george@jcartermarketing.com
-```
-
-# Description
-
-Module that connects to J Carter Marketing demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div1',
- sizes: [[300, 250]], // display 300x250
- bids: [
- {
- bidder: 'jcm',
- params: {
- siteId: '3608'
- }
- }
- ]
- },{
- code: 'test-div2',
- sizes: [[728, 90]], // display 728x90
- bids: [
- {
- bidder: 'jcm',
- params: {
- siteId: '3608'
- }
- }
- ]
- }
- ];
-
diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js
index fb55add910f..2de2de6b481 100644
--- a/modules/jixieBidAdapter.js
+++ b/modules/jixieBidAdapter.js
@@ -1,11 +1,11 @@
-import { logWarn, parseUrl, deepAccess, isArray, getDNT } from '../src/utils.js';
-import { config } from '../src/config.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { getStorageManager } from '../src/storageManager.js';
-import { BANNER, VIDEO } from '../src/mediaTypes.js';
-import { ajax } from '../src/ajax.js';
-import { getRefererInfo } from '../src/refererDetection.js';
-import { Renderer } from '../src/Renderer.js';
+import {deepAccess, getDNT, isArray, logWarn} from '../src/utils.js';
+import {config} from '../src/config.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {getStorageManager} from '../src/storageManager.js';
+import {BANNER, VIDEO} from '../src/mediaTypes.js';
+import {ajax} from '../src/ajax.js';
+import {getRefererInfo} from '../src/refererDetection.js';
+import {Renderer} from '../src/Renderer.js';
import {createEidsArray} from './userId/eids.js';
const BIDDER_CODE = 'jixie';
@@ -116,10 +116,12 @@ function getMiscDims_() {
mkeywords: ''
}
try {
+ // TODO: this should pick refererInfo from bidderRequest
let refererInfo_ = getRefererInfo();
- let url_ = ((refererInfo_ && refererInfo_.referer) ? refererInfo_.referer : window.location.href);
+ // TODO: does the fallback make sense here?
+ let url_ = refererInfo_?.page || window.location.href
ret.pageurl = url_;
- ret.domain = parseUrl(url_).host;
+ ret.domain = refererInfo_?.domain || window.location.host
ret.device = getDevice_();
let keywords = document.getElementsByTagName('meta')['keywords'];
if (keywords && keywords.content) {
diff --git a/modules/justpremiumBidAdapter.js b/modules/justpremiumBidAdapter.js
index e2ba92d51d9..7f154614e4d 100644
--- a/modules/justpremiumBidAdapter.js
+++ b/modules/justpremiumBidAdapter.js
@@ -25,7 +25,8 @@ export const spec = {
}).filter((value, index, self) => {
return self.indexOf(value) === index
}),
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: bidderRequest.refererInfo.page,
sw: dim.screenWidth,
sh: dim.screenHeight,
ww: dim.innerWidth,
diff --git a/modules/jwplayerRtdProvider.js b/modules/jwplayerRtdProvider.js
index 6cccd660854..342531ba26e 100644
--- a/modules/jwplayerRtdProvider.js
+++ b/modules/jwplayerRtdProvider.js
@@ -12,7 +12,7 @@
import {submodule} from '../src/hook.js';
import {config} from '../src/config.js';
import {ajaxBuilder} from '../src/ajax.js';
-import {logError} from '../src/utils.js';
+import {deepAccess, logError} from '../src/utils.js';
import {find} from '../src/polyfill.js';
import {getGlobal} from '../src/prebidGlobal.js';
@@ -130,7 +130,7 @@ function onRequestCompleted(mediaID, success) {
function enrichBidRequest(bidReqConfig, onDone) {
activeRequestCount = 0;
const adUnits = bidReqConfig.adUnits || getGlobal().adUnits;
- enrichAdUnits(adUnits);
+ enrichAdUnits(adUnits, bidReqConfig.ortb2Fragments);
if (activeRequestCount <= 0) {
onDone();
} else {
@@ -142,10 +142,10 @@ function enrichBidRequest(bidReqConfig, onDone) {
* get targeting data and write to bids
* @function
* @param {adUnit[]} adUnits
- * @param {function} onDone
+ * @param ortb2Fragments
*/
-export function enrichAdUnits(adUnits) {
- const fpdFallback = config.getConfig('ortb2.site.ext.data.jwTargeting');
+export function enrichAdUnits(adUnits, ortb2Fragments = {}) {
+ const fpdFallback = deepAccess(ortb2Fragments.global, 'site.ext.data.jwTargeting');
adUnits.forEach(adUnit => {
const jwTargeting = extractPublisherParams(adUnit, fpdFallback);
if (!jwTargeting || !Object.keys(jwTargeting).length) {
@@ -162,11 +162,7 @@ export function enrichAdUnits(adUnits) {
const contentData = getContentData(mediaId, contentSegments);
const targeting = formatTargetingResponse(vat);
enrichBids(adUnit.bids, targeting, contentId, contentData);
- let ortb2 = config.getConfig('ortb2');
- ortb2 = getOrtbSiteContent(ortb2, contentId, contentData);
- if (ortb2) {
- config.setConfig({ ortb2 });
- }
+ addOrtbSiteContent(ortb2Fragments.global, contentId, contentData);
};
loadVat(jwTargeting, onVatResponse);
});
@@ -309,12 +305,12 @@ export function getContentData(mediaId, segments) {
return contentData;
}
-export function getOrtbSiteContent(ortb2, contentId, contentData) {
+export function addOrtbSiteContent(ortb2, contentId, contentData) {
if (!contentId && !contentData) {
return;
}
- if (!ortb2) {
+ if (ortb2 == null) {
ortb2 = {};
}
@@ -345,10 +341,6 @@ function enrichBids(bids, targeting, contentId, contentData) {
bids.forEach(bid => {
addTargetingToBid(bid, targeting);
- const ortb2 = getOrtbSiteContent(bid.ortb2, contentId, contentData);
- if (ortb2) {
- bid.ortb2 = ortb2;
- }
});
}
diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js
index 80b3d83167e..866f0e5a4bc 100644
--- a/modules/kargoBidAdapter.js
+++ b/modules/kargoBidAdapter.js
@@ -241,6 +241,7 @@ export const spec = {
_getAllMetadata(tdid, usp, gdpr) {
return {
userIDs: spec._getUserIds(tdid, usp, gdpr),
+ // TODO: this should probably look at refererInfo
pageURL: window.location.href,
rawCRB: spec._readCookie('krg_crb'),
rawCRBLocalStorage: spec._getLocalStorageSafely('krg_crb')
diff --git a/modules/koblerBidAdapter.js b/modules/koblerBidAdapter.js
index 5fc28c47ac5..1dc22d0099a 100644
--- a/modules/koblerBidAdapter.js
+++ b/modules/koblerBidAdapter.js
@@ -102,21 +102,23 @@ export const onTimeout = function (timeoutDataArray) {
}
};
-function getPageUrlFromRefererInfo() {
- const refererInfo = getRefererInfo();
- return (refererInfo && refererInfo.referer)
- ? refererInfo.referer
- : window.location.href;
-}
-
function getPageUrlFromRequest(validBidRequest, bidderRequest) {
// pageUrl is considered only when testing to ensure that non-test requests always contain the correct URL
if (isTest(validBidRequest) && config.getConfig('pageUrl')) {
+ // TODO: it's not clear what the intent is here - but all adapters should always respect pageUrl.
+ // With prebid 7, using `refererInfo.page` will do that automatically.
return config.getConfig('pageUrl');
}
- return (bidderRequest.refererInfo && bidderRequest.refererInfo.referer)
- ? bidderRequest.refererInfo.referer
+ return (bidderRequest.refererInfo && bidderRequest.refererInfo.page)
+ ? bidderRequest.refererInfo.page
+ : window.location.href;
+}
+
+function getPageUrlFromRefererInfo() {
+ const refererInfo = getRefererInfo();
+ return (refererInfo && refererInfo.page)
+ ? refererInfo.page
: window.location.href;
}
diff --git a/modules/komoonaBidAdapter.md b/modules/komoonaBidAdapter.md
deleted file mode 100644
index 6f88c19dfa6..00000000000
--- a/modules/komoonaBidAdapter.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Overview
-
-**Module Name**: Komoona Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: support@komoona.com
-
-# Description
-
-Connects to Komoona demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'banner-ad-div',
- sizes: [[300, 250]],
-
- // Replace this object to test a new Adapter!
- bids: [{
- bidder: 'komoona',
- params: {
- placementId: 'e69148e0ba6c4c07977dc2daae5e1577',
- hbid: '1f5b2c10e66e419580bd943b9af692ab',
- floorPrice: 0.5
- }
- }]
- }];
-```
-
-
diff --git a/modules/krushmediaBidAdapter.js b/modules/krushmediaBidAdapter.js
index da68bddcb7b..6dce40524a7 100644
--- a/modules/krushmediaBidAdapter.js
+++ b/modules/krushmediaBidAdapter.js
@@ -51,8 +51,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js
index 46360572576..57cbe6acd07 100644
--- a/modules/kubientBidAdapter.js
+++ b/modules/kubientBidAdapter.js
@@ -67,8 +67,9 @@ export const spec = {
data.coppa = 1
}
- if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- data.referer = bidderRequest.refererInfo.referer
+ if (bidderRequest?.refererInfo?.page) {
+ // TODO: is 'page' the right value here?
+ data.referer = bidderRequest.refererInfo.page
}
if (bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) {
@@ -151,15 +152,7 @@ function encodeQueryData(data) {
function kubientGetConsentGiven(gdprConsent) {
let consentGiven = 0;
if (typeof gdprConsent !== 'undefined') {
- let apiVersion = deepAccess(gdprConsent, `apiVersion`);
- switch (apiVersion) {
- case 1:
- consentGiven = deepAccess(gdprConsent, `vendorData.vendorConsents.${VENDOR_ID}`) ? 1 : 0;
- break;
- case 2:
- consentGiven = deepAccess(gdprConsent, `vendorData.vendor.consents.${VENDOR_ID}`) ? 1 : 0;
- break;
- }
+ consentGiven = deepAccess(gdprConsent, `vendorData.vendor.consents.${VENDOR_ID}`) ? 1 : 0;
}
return consentGiven;
}
diff --git a/modules/kummaBidAdapter.md b/modules/kummaBidAdapter.md
deleted file mode 100644
index 639e0c97d08..00000000000
--- a/modules/kummaBidAdapter.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# Overview
-
-**Module Name**: Kumma Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: yehonatan@kumma.com
-
-# Description
-
-Connects to Kumma demand source to fetch bids.
-Banner, Native, Video formats are supported.
-Please use ```kumma``` as the bidder code.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'dfp-native-div',
- mediaType: 'native',
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 75
- },
- image: {
- required: true
- },
- body: {
- len: 200
- },
- icon: {
- required: false
- }
- }
- },
- bids: [{
- bidder: 'kumma',
- params: {
- pubId: '29521',
- siteId: '26047',
- placementId: '123',
- bidFloor: '0.001', // optional
- ifa: 'XXX-XXX', // optional
- latitude: '40.712775', // optional
- longitude: '-74.005973', // optional
- }
- }]
- },
- {
- code: 'dfp-banner-div',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250]
- ],
- }
- },
- bids: [{
- bidder: 'kumma',
- params: {
- pubId: '29521',
- siteId: '26049',
- placementId: '123',
- }
- }]
- },
- {
- code: 'dfp-video-div',
- sizes: [640, 480],
- mediaTypes: {
- video: {
- context: "instream"
- }
- },
- bids: [{
- bidder: 'kumma',
- params: {
- pubId: '29521',
- siteId: '26049',
- placementId: '123',
- video: {
- skipppable: true,
- }
- }
- }]
- }
- ];
-```
diff --git a/modules/lemmaBidAdapter.md b/modules/lemmaBidAdapter.md
deleted file mode 100644
index 29e72e028b9..00000000000
--- a/modules/lemmaBidAdapter.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Overview
-
-```
-Module Name: Lemma Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: lemmadev@lemmatechnologies.com
-```
-
-# Description
-
-Connects to Lemma exchange for bids.
-Lemma bid adapter supports Video, Banner formats.
-
-# Sample Banner Ad Unit: For Publishers
-```
-var adUnits = [{
- code: 'div-lemma-ad-1',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300, 600]], // required
- }
- },
- // Replace this object to test a new Adapter!
- bids: [{
- bidder: 'lemma',
- params: {
- pubId: 1, // required
- adunitId: '3768', // required
- latitude: 37.3230,
- longitude: -122.0322,
- device_type: 2,
- banner: {
- w: 300,
- h: 250
- }
- }
- }]
-}];
-```
-
-# Sample Video Ad Unit: For Publishers
-```
-var adUnits = [{
- mediaType: 'video',
- mediaTypes: {
- video: {
- playerSize: [640, 480], // required
- context: 'instream'
- }
- },
- // Replace this object to test a new Adapter!
- bids: [{
- bidder: 'lemma',
- params: {
- pubId: 1, // required
- adunitId: '3769', // required
- latitude: 37.3230,
- longitude: -122.0322,
- device_type: 4,
- video: {
- mimes: ['video/mp4','video/x-flv'], // required
- }
- }
- }]
-}];
-```
diff --git a/modules/lifestreetBidAdapter.md b/modules/lifestreetBidAdapter.md
deleted file mode 100644
index a874792d84c..00000000000
--- a/modules/lifestreetBidAdapter.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# Overview
-
-```
-Module Name: Lifestreet Bid Adapter
-Module Type: Lifestreet Adapter
-Maintainer: hb.tech@lifestreet.com
-```
-
-# Description
-
-Module that connects to Lifestreet's demand sources
-
-Values, listed in `ALL_BANNER_SIZES` and `ALL_VIDEO_SIZES` are all the values which our server supports.
-For `ad_size`, please use one of that values in following format: `ad_size: WIDTHxHEIGHT`
-
-# Test Parameters
-```javascript
- const ALL_BANNER_SIZES = [
- [120, 600], [160, 600], [300, 250], [300, 600], [320, 480],
- [320, 50], [468, 60], [510, 510], [600, 300],
- [720, 300], [728, 90], [760, 740], [768, 1024]
- ];
-
- const ALL_VIDEO_SIZES = [
- [640, 480], [650, 520], [970, 580]
- ]
-```
-
-# Test Parameters (Banner)
-```
- const adUnits = [
- {
- code: 'test-ad',
- mediaTypes: {
- banner: {
- sizes: [[160, 600]],
- }
- },
- bids: [
- {
- bidder: 'lifestreet',
- params: {
- slot: 'slot166704',
- adkey: '78c',
- ad_size: '160x600'
- }
- }
- ]
- },
- ];
-```
-
-# Test Parameters (Video)
-```
- const adUnits = [
- {
- code: 'test-video-ad',
- mediaTypes: {
- video: {
- playerSize: [[640, 480]],
- context: 'instream'
- }
- },
- bids: [
- {
- bidder: 'lifestreet',
- params: {
- slot: 'slot1227631',
- adkey: 'a98',
- ad_size: '640x480'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/livewrappedBidAdapter.js b/modules/livewrappedBidAdapter.js
index 8afeaf80652..104ff667fcb 100644
--- a/modules/livewrappedBidAdapter.js
+++ b/modules/livewrappedBidAdapter.js
@@ -59,7 +59,7 @@ export const spec = {
const bundle = find(bidRequests, hasBundleParam);
const tid = find(bidRequests, hasTidParam);
const schain = bidRequests[0].schain;
- let ortb2 = config.getConfig('ortb2');
+ let ortb2 = bidderRequest.ortb2;
const eids = handleEids(bidRequests);
bidUrl = bidUrl ? bidUrl.params.bidUrl : URL;
url = url ? url.params.url : (getAppDomain() || getTopWindowLocation(bidderRequest));
@@ -276,8 +276,7 @@ function handleEids(bidRequests) {
}
function getTopWindowLocation(bidderRequest) {
- let url = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
- return config.getConfig('pageUrl') || url;
+ return bidderRequest?.refererInfo?.page;
}
function getAppBundle() {
diff --git a/modules/lkqdBidAdapter.js b/modules/lkqdBidAdapter.js
index e58c643f4f0..6d2766ff2f1 100644
--- a/modules/lkqdBidAdapter.js
+++ b/modules/lkqdBidAdapter.js
@@ -37,7 +37,8 @@ export const spec = {
const UTC_OFFSET = new Date().getTimezoneOffset();
const UA = navigator.userAgent;
const USP = BIDDER_REQUEST.uspConsent || null;
- const REFERER = BIDDER_REQUEST.refererInfo ? new URL(BIDDER_REQUEST.refererInfo.referer).hostname : window.location.hostname;
+ // TODO: does the fallback make sense here?
+ const REFERER = BIDDER_REQUEST?.refererInfo?.domain || window.location.host
const BIDDER_GDPR = BIDDER_REQUEST.gdprConsent && BIDDER_REQUEST.gdprConsent.gdprApplies ? 1 : null;
const BIDDER_GDPRS = BIDDER_REQUEST.gdprConsent && BIDDER_REQUEST.gdprConsent.consentString ? BIDDER_REQUEST.gdprConsent.consentString : null;
diff --git a/modules/lockerdomeBidAdapter.js b/modules/lockerdomeBidAdapter.js
index 66accb4e02a..5c38753c1e2 100644
--- a/modules/lockerdomeBidAdapter.js
+++ b/modules/lockerdomeBidAdapter.js
@@ -21,12 +21,11 @@ export const spec = {
};
});
- const bidderRequestCanonicalUrl = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.canonicalUrl) || '';
- const bidderRequestReferer = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) || '';
const payload = {
bidRequests: adUnitBidRequests,
- url: encodeURIComponent(bidderRequestCanonicalUrl),
- referrer: encodeURIComponent(bidderRequestReferer)
+ // TODO: are these the right refererInfo values?
+ url: encodeURIComponent(bidderRequest?.refererInfo?.canonicalUrl || ''),
+ referrer: encodeURIComponent(bidderRequest?.refererInfo?.topmostLocation || '')
};
if (schain) {
payload.schain = schain;
diff --git a/modules/logicadBidAdapter.js b/modules/logicadBidAdapter.js
index 2c919f9c157..4f996ba3f09 100644
--- a/modules/logicadBidAdapter.js
+++ b/modules/logicadBidAdapter.js
@@ -60,7 +60,8 @@ function newBidRequest(bid, bidderRequest) {
mediaTypes: bid.mediaTypes
}],
prebidJsVersion: '$prebid.version$',
- referrer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referrer: bidderRequest.refererInfo.page,
auctionStartTime: bidderRequest.auctionStart,
eids: bid.userIdAsEids,
};
diff --git a/modules/loglyliftBidAdapter.js b/modules/loglyliftBidAdapter.js
index dd5f0af1cdf..a05434e8ee5 100644
--- a/modules/loglyliftBidAdapter.js
+++ b/modules/loglyliftBidAdapter.js
@@ -69,8 +69,8 @@ function newBidRequest(bid, bidderRequest) {
params: bid.params,
prebidJsVersion: '$prebid.version$',
url: window.location.href,
- domain: config.getConfig('publisherDomain'),
- referer: bidderRequest.refererInfo.referer,
+ domain: bidderRequest.refererInfo.domain,
+ referer: bidderRequest.refererInfo.page,
auctionStartTime: bidderRequest.auctionStart,
currency: currency,
timeout: config.getConfig('bidderTimeout')
diff --git a/modules/loopmeBidAdapter.md b/modules/loopmeBidAdapter.md
deleted file mode 100644
index 1b195a118f2..00000000000
--- a/modules/loopmeBidAdapter.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# Overview
-
-```
-Module Name: LoopMe Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: support@loopme.com
-```
-
-# Description
-
-Connect to LoopMe's exchange for bids.
-
-# Test Parameters (Banner)
-```
-var adUnits = [{
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [{
- bidder: 'loopme',
- params: {
- ak: 'cc885e3acc'
- }
- }]
-}];
-```
-
-# Test Parameters (Video)
-```
-var adUnits = [{
- code: 'video1',
- mediaTypes: {
- video: {
- playerSize: [640, 480],
- context: 'outstream'
- }
- },
- bids: [{
- bidder: 'loopme',
- params: {
- ak: '223051e07f'
- }
- }]
-}];
-```
diff --git a/modules/lunamediaBidAdapter.md b/modules/lunamediaBidAdapter.md
deleted file mode 100755
index ff5cc86c462..00000000000
--- a/modules/lunamediaBidAdapter.md
+++ /dev/null
@@ -1,69 +0,0 @@
-# Overview
-
-```
-Module Name: LunaMedia Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: lokesh@advangelists.com
-```
-
-# Description
-
-Connects to LunaMedia exchange for bids.
-
-LunaMedia bid adapter supports Banner and Video ads currently.
-
-For more informatio
-
-# Sample Display Ad Unit: For Publishers
-```javascript
-
-var displayAdUnit = [
-{
- code: 'display',
- mediaTypes: {
- banner: {
- sizes: [[300, 250],[320, 50]]
- }
- }
- bids: [{
- bidder: 'lunamedia',
- params: {
- pubid: '121ab139faf7ac67428a23f1d0a9a71b',
- placement: 1234,
- size: "320x50"
- }
- }]
-}];
-```
-
-# Sample Video Ad Unit: For Publishers
-```javascript
-
-var videoAdUnit = {
- code: 'video',
- sizes: [320,480],
- mediaTypes: {
- video: {
- playerSize : [[320, 480]],
- context: 'instream'
- }
- },
- bids: [
- {
- bidder: 'lunamedia',
- params: {
- pubid: '121ab139faf7ac67428a23f1d0a9a71b',
- placement: 1234,
- size: "320x480",
- video: {
- id: 123,
- skip: 1,
- mimes : ['video/mp4', 'application/javascript'],
- playbackmethod : [2,6],
- maxduration: 30
- }
- }
- }
- ]
- };
-```
\ No newline at end of file
diff --git a/modules/lunamediahbBidAdapter.js b/modules/lunamediahbBidAdapter.js
index ebd88d34940..286e87668fa 100644
--- a/modules/lunamediahbBidAdapter.js
+++ b/modules/lunamediahbBidAdapter.js
@@ -35,8 +35,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/luponmediaBidAdapter.js b/modules/luponmediaBidAdapter.js
index 897dc3c8825..31e2120d364 100755
--- a/modules/luponmediaBidAdapter.js
+++ b/modules/luponmediaBidAdapter.js
@@ -431,6 +431,10 @@ function newOrtbBidRequest(bidRequest, bidderRequest, currentImps) {
deepSetValue(data, 'source.ext.schain', bidRequest.schain);
}
+ // TODO: getConfig('fpd.context') should not have worked even with legacy FPD support - 'fpd' gets translated
+ // into 'ortb2' by `setConfig`
+ // Unclear what the intent was here - maybe `const {context: siteData, user: userData} = getLegacyFpd(config.getConfig('ortb2'))` ?
+ // (with PB7 `config.getConfig('ortb2')` should be replaced by `bidderRequest.ortb2`)
const siteData = Object.assign({}, bidRequest.params.inventory, config.getConfig('fpd.context'));
const userData = Object.assign({}, bidRequest.params.visitor, config.getConfig('fpd.user'));
@@ -453,6 +457,8 @@ function newOrtbBidRequest(bidRequest, bidderRequest, currentImps) {
deepSetValue(data, 'ext.prebid.bidderconfig.0', bidderData);
}
+ // TODO: bidRequest.fpd is not the right place for pbadslot - who's filling that in, if anyone?
+ // is this meant to be bidRequest.ortb2Imp.ext.data.pbadslot?
const pbAdSlot = deepAccess(bidRequest, 'fpd.context.pbAdSlot');
if (typeof pbAdSlot === 'string' && pbAdSlot) {
deepSetValue(data.imp[0].ext, 'context.data.adslot', pbAdSlot);
@@ -494,11 +500,12 @@ function _getDigiTrustQueryParams(bidRequest = {}, endpointName) {
}
function _getPageUrl(bidRequest, bidderRequest) {
- let pageUrl = config.getConfig('pageUrl');
+ // TODO: do the fallbacks make sense here?
+ let pageUrl = bidderRequest.refererInfo.page;
if (bidRequest.params.referrer) {
pageUrl = bidRequest.params.referrer;
} else if (!pageUrl) {
- pageUrl = bidderRequest.refererInfo.referer;
+ pageUrl = bidderRequest.refererInfo.topmostLocation;
}
return bidRequest.params.secure ? pageUrl.replace(/^http:/i, 'https:') : pageUrl;
}
diff --git a/modules/malltvBidAdapter.js b/modules/malltvBidAdapter.js
index 53f745d4004..6466aa4feed 100644
--- a/modules/malltvBidAdapter.js
+++ b/modules/malltvBidAdapter.js
@@ -47,7 +47,8 @@ export const spec = {
if (!propertyId) { propertyId = bidRequest.params.propertyId; }
if (!pageViewGuid && bidRequest.params) { pageViewGuid = bidRequest.params.pageViewGuid || ''; }
if (!bidderRequestId) { bidderRequestId = bidRequest.bidderRequestId; }
- if (!url && bidderRequest) { url = bidderRequest.refererInfo.referer; }
+ // TODO: is 'page' the right value here?
+ if (!url && bidderRequest) { url = bidderRequest.refererInfo.page; }
if (!contents.length && bidRequest.params.contents && bidRequest.params.contents.length) { contents = bidRequest.params.contents; }
if (Object.keys(data).length === 0 && bidRequest.params.data && Object.keys(bidRequest.params.data).length !== 0) { data = bidRequest.params.data; }
if (bidderRequest && bidRequest.gdprConsent) { gdrpApplies = bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? bidderRequest.gdprConsent.gdprApplies : true; }
diff --git a/modules/marsmediaBidAdapter.js b/modules/marsmediaBidAdapter.js
index 92374b748c7..82a25af60d1 100644
--- a/modules/marsmediaBidAdapter.js
+++ b/modules/marsmediaBidAdapter.js
@@ -31,6 +31,7 @@ function MarsmediaAdapter() {
var isSecure = 0;
if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.stack.length) {
// clever trick to get the protocol
+ // TODO: this should probably use parseUrl
var el = document.createElement('a');
el.href = bidderRequest.refererInfo.stack[0];
isSecure = (el.protocol == 'https:') ? 1 : 0;
@@ -68,12 +69,15 @@ function MarsmediaAdapter() {
}
if (bidderRequest && bidderRequest.refererInfo) {
var ri = bidderRequest.refererInfo;
- site.ref = ri.referer;
+ // TODO: is 'ref' the right value here?
+ site.ref = ri.ref;
if (ri.stack.length) {
site.page = ri.stack[ri.stack.length - 1];
// clever trick to get the domain
+ // TODO: does this logic make sense? why should domain be set to the lowermost frame's?
+ // TODO: this should probably use parseUrl
var el = document.createElement('a');
el.href = ri.stack[0];
site.domain = el.hostname;
diff --git a/modules/mathildeadsBidAdapter.js b/modules/mathildeadsBidAdapter.js
index 3f5d94f0df2..f80e6e1f749 100644
--- a/modules/mathildeadsBidAdapter.js
+++ b/modules/mathildeadsBidAdapter.js
@@ -125,7 +125,7 @@ export const spec = {
winLocation = window.location;
}
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const refferUrl = bidderRequest?.refererInfo?.page;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
@@ -133,6 +133,7 @@ export const spec = {
logMessage(e);
}
+ // TODO: does the fallback make sense here?
let location = refferLocation || winLocation;
const language = (navigator && navigator.language) ? navigator.language.split('-')[0] : '';
const host = location.host;
diff --git a/modules/meazyBidAdapter.md b/modules/meazyBidAdapter.md
deleted file mode 100644
index 354673bf590..00000000000
--- a/modules/meazyBidAdapter.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Overview
-
-Module Name: Meazy Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: dima@meazy.co
-
-# Description
-
-Module that connects to Meazy demand sources
-
-# Test Parameters
-```
-var adUnits = [{
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [{
- bidder: "meazy",
- params: {
- pid: '6910b7344ae566a1'
- }
- }]
-}];
-```
\ No newline at end of file
diff --git a/modules/mediaforceBidAdapter.js b/modules/mediaforceBidAdapter.js
index c686a2e378d..8f15af72235 100644
--- a/modules/mediaforceBidAdapter.js
+++ b/modules/mediaforceBidAdapter.js
@@ -113,7 +113,8 @@ export const spec = {
return;
}
- const referer = bidderRequest && bidderRequest.refererInfo ? encodeURIComponent(bidderRequest.refererInfo.referer) : '';
+ // TODO: is 'ref' the right value here?
+ const referer = bidderRequest && bidderRequest.refererInfo ? encodeURIComponent(bidderRequest.refererInfo.ref) : '';
const auctionId = bidderRequest && bidderRequest.auctionId;
const timeout = bidderRequest && bidderRequest.timeout;
const dnt = getDNT() ? 1 : 0;
@@ -156,6 +157,7 @@ export const spec = {
request = {
id: Math.round(Math.random() * 1e16).toString(16),
site: {
+ // TODO: this should probably look at refererInfo
page: window.location.href,
ref: referer,
id: bid.params.publisher_id,
diff --git a/modules/mediafuseBidAdapter.js b/modules/mediafuseBidAdapter.js
index b77c965802e..4cd6b60e8a2 100644
--- a/modules/mediafuseBidAdapter.js
+++ b/modules/mediafuseBidAdapter.js
@@ -8,6 +8,7 @@ import {find, includes} from '../src/polyfill.js';
import { OUTSTREAM, INSTREAM } from '../src/video.js';
import { getStorageManager } from '../src/storageManager.js';
import { bidderSettings } from '../src/bidderSettings.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'mediafuse';
const URL = 'https://ib.adnxs.com/ut/v3/prebid';
@@ -228,7 +229,8 @@ export const spec = {
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: this collects everything it finds, except for canonicalUrl
+ rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
@@ -249,7 +251,6 @@ export const spec = {
if (bidRequests[0].userId) {
let eids = [];
- addUserId(eids, deepAccess(bidRequests[0], `userId.flocId.id`), 'chrome.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.criteoId`), 'criteo.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.netId`), 'netid.de', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.idl_env`), 'liveramp.com', null);
@@ -479,16 +480,6 @@ function getViewabilityScriptUrlFromPayload(viewJsPayload) {
return jsTrackerSrc;
}
-function hasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
function formatRequest(payload, bidderRequest) {
let request = [];
let options = {
@@ -497,7 +488,7 @@ function formatRequest(payload, bidderRequest) {
let endpointUrl = URL;
- if (!hasPurpose1Consent(bidderRequest)) {
+ if (!hasPurpose1Consent(bidderRequest?.gdprConsent)) {
endpointUrl = URL_SIMPLE;
}
diff --git a/modules/mediagoBidAdapter.md b/modules/mediagoBidAdapter.md
deleted file mode 100644
index 87c38f662a3..00000000000
--- a/modules/mediagoBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-```
-Module Name: MediaGo Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: fangsimin@baidu.com
-```
-
-# Description
-
-Module that connects to MediaGo's demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [
- {
- bidder: "mediago",
- params: {
- token: '' // required, send email to ext_mediago_am@baidu.com to get the corresponding token
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/mediakeysBidAdapter.js b/modules/mediakeysBidAdapter.js
index 5eb32a3f6e4..6a4092cef4b 100644
--- a/modules/mediakeysBidAdapter.js
+++ b/modules/mediakeysBidAdapter.js
@@ -5,7 +5,6 @@ import {
deepClone,
deepSetValue,
getDNT,
- getWindowTop,
inIframe,
isArray,
isEmpty,
@@ -16,7 +15,6 @@ import {
logError,
logWarn,
mergeDeep,
- parseUrl,
triggerPixel
} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
@@ -85,19 +83,6 @@ const ORTB_VIDEO_PARAMS = {
api: value => Array.isArray(value) && value.every(v => [1, 2, 3, 4, 5, 6].indexOf(v) !== -1),
};
-/**
- * Detects the capability to reach window.top.
- *
- * @returns {boolean}
- */
-function canAccessTopWindow() {
- try {
- return !!getWindowTop().location.href;
- } catch (error) {
- return false;
- }
-}
-
/**
* Returns the OpenRtb deviceType id detected from User Agent
* Voluntary limited to phone, tablet, desktop.
@@ -650,21 +635,18 @@ export const spec = {
// Assign payload.site from refererinfo
if (bidderRequest.refererInfo) {
+ // TODO: reachedTop is probably not the right check here - it may be false when page is available or vice-versa
if (bidderRequest.refererInfo.reachedTop) {
- const sitePage = bidderRequest.refererInfo.referer;
- deepSetValue(payload, 'site.page', sitePage);
- deepSetValue(payload, 'site.domain', parseUrl(sitePage, {
- noDecodeWholeURL: true
- }).hostname);
-
- if (canAccessTopWindow()) {
- deepSetValue(payload, 'site.ref', getWindowTop().document.referrer);
+ deepSetValue(payload, 'site.page', bidderRequest.refererInfo.page);
+ deepSetValue(payload, 'site.domain', bidderRequest.refererInfo.domain)
+ if (bidderRequest.refererInfo.ref) {
+ deepSetValue(payload, 'site.ref', bidderRequest.refererInfo.ref);
}
}
}
// Handle First Party Data (need publisher fpd setup)
- const fpd = config.getConfig('ortb2') || {};
+ const fpd = bidderRequest.ortb2 || {};
if (fpd.site) {
mergeDeep(payload, { site: fpd.site });
}
diff --git a/modules/medianetAnalyticsAdapter.js b/modules/medianetAnalyticsAdapter.js
index 09ebbc9bc31..05c18a47f94 100644
--- a/modules/medianetAnalyticsAdapter.js
+++ b/modules/medianetAnalyticsAdapter.js
@@ -182,16 +182,16 @@ class Configure {
class PageDetail {
constructor () {
- const canonicalUrl = this._getUrlFromSelector('link[rel="canonical"]', 'href');
const ogUrl = this._getUrlFromSelector('meta[property="og:url"]', 'content');
const twitterUrl = this._getUrlFromSelector('meta[name="twitter:url"]', 'content');
const refererInfo = getRefererInfo();
- this.domain = URL.parseUrl(refererInfo.referer).hostname;
- this.page = refererInfo.referer;
+ // TODO: are these the right refererInfo values?
+ this.domain = refererInfo.domain;
+ this.page = refererInfo.page;
this.is_top = refererInfo.reachedTop;
- this.referrer = this._getTopWindowReferrer();
- this.canonical_url = canonicalUrl;
+ this.referrer = refererInfo.ref || window.document.referrer;
+ this.canonical_url = refererInfo.canonicalUrl;
this.og_url = ogUrl;
this.twitter_url = twitterUrl;
this.screen = this._getWindowSize();
diff --git a/modules/medianetBidAdapter.js b/modules/medianetBidAdapter.js
index eb3f8b7416a..1ca10b75e0e 100644
--- a/modules/medianetBidAdapter.js
+++ b/modules/medianetBidAdapter.js
@@ -1,9 +1,21 @@
-import { parseUrl, getWindowTop, isArray, getGptSlotInfoForAdUnitCode, isStr, deepAccess, isEmpty, logError, triggerPixel, buildUrl, isEmptyStr, logInfo } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
-import { getRefererInfo } from '../src/refererDetection.js';
-import { Renderer } from '../src/Renderer.js';
+import {
+ buildUrl,
+ deepAccess,
+ getGptSlotInfoForAdUnitCode,
+ getWindowTop,
+ isArray,
+ isEmpty,
+ isEmptyStr,
+ isStr,
+ logError,
+ logInfo,
+ triggerPixel
+} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {config} from '../src/config.js';
+import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
+import {getRefererInfo} from '../src/refererDetection.js';
+import {Renderer} from '../src/Renderer.js';
const BIDDER_CODE = 'medianet';
const BID_URL = 'https://prebid.media.net/rtb/prebid';
@@ -19,6 +31,8 @@ const EVENTS = {
};
const EVENT_PIXEL_URL = 'qsearch-a.akamaihd.net/log';
const OUTSTREAM = 'outstream';
+
+// TODO: this should be picked from bidderRequest
let refererInfo = getRefererInfo();
let mnData = {};
@@ -27,8 +41,8 @@ window.mnet = window.mnet || {};
window.mnet.queue = window.mnet.queue || [];
mnData.urlData = {
- domain: parseUrl(refererInfo.referer, {noDecodeWholeURL: true}).hostname,
- page: refererInfo.referer,
+ domain: refererInfo.domain,
+ page: refererInfo.page,
isTop: refererInfo.reachedTop
};
diff --git a/modules/mediasniperBidAdapter.js b/modules/mediasniperBidAdapter.js
index 3e57503f7fb..417642b7a6f 100644
--- a/modules/mediasniperBidAdapter.js
+++ b/modules/mediasniperBidAdapter.js
@@ -2,23 +2,21 @@ import {
deepAccess,
deepClone,
deepSetValue,
- getWindowTop,
+ getBidIdParameter,
inIframe,
isArray,
isEmpty,
isFn,
isNumber,
isStr,
- logWarn,
logError,
logMessage,
- parseUrl,
- getBidIdParameter,
+ logWarn,
triggerPixel,
} from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { BANNER } from '../src/mediaTypes.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {BANNER} from '../src/mediaTypes.js';
const BIDDER_CODE = 'mediasniper';
const DEFAULT_BID_TTL = 360;
@@ -76,19 +74,18 @@ export const spec = {
// Assign payload.site from refererinfo
if (bidderRequest.refererInfo) {
+ // TODO: reachedTop is probably not the right check - it may be false when page is available or vice-versa
if (bidderRequest.refererInfo.reachedTop) {
- const sitePage = bidderRequest.refererInfo.referer;
+ const sitePage = bidderRequest.refererInfo.page;
deepSetValue(payload, 'site.page', sitePage);
deepSetValue(
payload,
'site.domain',
- parseUrl(sitePage, {
- noDecodeWholeURL: true,
- }).hostname
+ bidderRequest.refererInfo.domain
);
- if (canAccessTopWindow()) {
- deepSetValue(payload, 'site.ref', getWindowTop().document.referrer);
+ if (bidderRequest.refererInfo?.ref) {
+ deepSetValue(payload, 'site.ref', bidderRequest.refererInfo.ref);
}
}
}
@@ -165,19 +162,6 @@ export const spec = {
};
registerBidder(spec);
-/**
- * Detects the capability to reach window.top.
- *
- * @returns {boolean}
- */
-function canAccessTopWindow() {
- try {
- return !!getWindowTop().location.href;
- } catch (error) {
- return false;
- }
-}
-
/**
* Returns an openRTB 2.5 object.
* This one will be populated at each step of the buildRequest process.
diff --git a/modules/mediasquareBidAdapter.js b/modules/mediasquareBidAdapter.js
index 427a16f1341..1be58501828 100644
--- a/modules/mediasquareBidAdapter.js
+++ b/modules/mediasquareBidAdapter.js
@@ -55,7 +55,8 @@ export const spec = {
});
const payload = {
codes: codes,
- referer: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: is 'page' the right value here?
+ referer: encodeURIComponent(bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation),
pbjs: '$prebid.version$'
};
if (bidderRequest) { // modules informations (gdpr, ccpa, schain, userId)
diff --git a/modules/mgidBidAdapter.js b/modules/mgidBidAdapter.js
index 51b713c8958..7565b713e88 100644
--- a/modules/mgidBidAdapter.js
+++ b/modules/mgidBidAdapter.js
@@ -122,7 +122,8 @@ export const spec = {
return;
}
const info = pageInfo();
- const page = info.location || deepAccess(bidderRequest, 'refererInfo.referer') || deepAccess(bidderRequest, 'refererInfo.canonicalUrl');
+ // TODO: the fallback seems to never be used here, and probably in the wrong order
+ const page = info.location || deepAccess(bidderRequest, 'refererInfo.page')
const hostname = parseUrl(page).hostname;
let domain = extractDomainFromHost(hostname) || hostname;
const accountId = setOnAny(validBidRequests, 'params.accountId');
diff --git a/modules/microadBidAdapter.js b/modules/microadBidAdapter.js
index 982bd61840a..77710584f41 100644
--- a/modules/microadBidAdapter.js
+++ b/modules/microadBidAdapter.js
@@ -51,8 +51,9 @@ export const spec = {
const bidParams = bid.params;
const params = {
spot: bidParams.spot,
- url: bidderRequest.refererInfo.canonicalUrl || window.location.href,
- referrer: bidderRequest.refererInfo.referer,
+ // TODO: are these the right refererInfo values - does the fallback make sense here?
+ url: bidderRequest.refererInfo.page || window.location.href,
+ referrer: bidderRequest.refererInfo.ref,
bid_id: bid.bidId,
transaction_id: bid.transactionId,
media_types: convertMediaTypes(bid),
diff --git a/modules/minutemediaBidAdapter.js b/modules/minutemediaBidAdapter.js
index 604a5dd7ea8..beb6618631d 100644
--- a/modules/minutemediaBidAdapter.js
+++ b/modules/minutemediaBidAdapter.js
@@ -390,7 +390,7 @@ function generateGeneralParams(generalObject, bidderRequest) {
generalParams.userIds = JSON.stringify(userIdsParam);
}
- const ortb2Metadata = config.getConfig('ortb2') || {};
+ const ortb2Metadata = bidderRequest.ortb2 || {};
if (ortb2Metadata.site) {
generalParams.site_metadata = JSON.stringify(ortb2Metadata.site);
}
@@ -423,8 +423,8 @@ function generateGeneralParams(generalObject, bidderRequest) {
}
if (bidderRequest && bidderRequest.refererInfo) {
- generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.referer');
- generalParams.page_url = config.getConfig('pageUrl') || deepAccess(window, 'location.href');
+ generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.ref');
+ generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || window.location.href
}
return generalParams
diff --git a/modules/missenaBidAdapter.js b/modules/missenaBidAdapter.js
index 41bae4d6568..4f629784a17 100644
--- a/modules/missenaBidAdapter.js
+++ b/modules/missenaBidAdapter.js
@@ -35,7 +35,8 @@ export const spec = {
};
if (bidderRequest && bidderRequest.refererInfo) {
- payload.referer = bidderRequest.refererInfo.referer;
+ // TODO: is 'topmostLocation' the right value here?
+ payload.referer = bidderRequest.refererInfo.topmostLocation;
payload.referer_canonical = bidderRequest.refererInfo.canonicalUrl;
}
diff --git a/modules/mobfoxBidAdapter.md b/modules/mobfoxBidAdapter.md
deleted file mode 100644
index 31b60606d2f..00000000000
--- a/modules/mobfoxBidAdapter.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Overview
-
-```
-Module Name: Mobfox Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: solutions-team@matomy.com
-```
-
-# Description
-
-Module that connects to Mobfox's demand sources
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'div-gpt-ad-1460505748561-0',
- sizes: [[320, 480], [300, 250], [300,600]],
-
- // Replace this object to test a new Adapter!
- bids: [{
- bidder: 'mobfox',
- params: {
- s: "267d72ac3f77a3f447b32cf7ebf20673", // required - The hash of your inventory to identify which app is making the request,
- imp_instl: 1 // optional - set to 1 if using interstitial otherwise delete or set to 0
- }
- }]
-
- }];
-```
diff --git a/modules/mobsmartBidAdapter.md b/modules/mobsmartBidAdapter.md
deleted file mode 100644
index 1240d6db494..00000000000
--- a/modules/mobsmartBidAdapter.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Overview
-
-```
-Module Name: Mobsmart Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: adx@kpis.jp
-```
-
-# Description
-
-Module that connects to Mobsmart demand sources to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]], // a display size
- }
- },
- bids: [
- {
- bidder: "mobsmart",
- params: {
- floorPrice: 100,
- currency: 'JPY'
- }
- }
- ]
- },{
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[320, 50]], // a mobile size
- }
- },
- bids: [
- {
- bidder: "mobsmart",
- params: {
- floorPrice: 90,
- currency: 'JPY'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/my6senseBidAdapter.js b/modules/my6senseBidAdapter.js
index b4fc1049304..163e3c20e4b 100644
--- a/modules/my6senseBidAdapter.js
+++ b/modules/my6senseBidAdapter.js
@@ -11,6 +11,7 @@ function isBidRequestValid(bid) {
}
function getUrl(url) {
+ // TODO: this should probably look at refererInfo
if (!url) {
url = window.location.href;// "clean" url of current web page
}
diff --git a/modules/mytargetBidAdapter.js b/modules/mytargetBidAdapter.js
index f55f2e6b802..b9ce8b133d1 100644
--- a/modules/mytargetBidAdapter.js
+++ b/modules/mytargetBidAdapter.js
@@ -51,7 +51,7 @@ export const spec = {
let referrer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referrer = bidderRequest.refererInfo.referer;
+ referrer = bidderRequest.refererInfo.page;
}
const payload = {
diff --git a/modules/nafdigitalBidAdapter.md b/modules/nafdigitalBidAdapter.md
deleted file mode 100644
index b17b1f13e1e..00000000000
--- a/modules/nafdigitalBidAdapter.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# Overview
-
-```
-Module Name: NAF Digital Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: vyatsun@gmail.com
-```
-
-# Description
-
-NAF Digital adapter integration to the Prebid library.
-
-# Test Parameters
-
-```
-var adUnits = [
- {
- code: 'test-leaderboard',
- sizes: [[728, 90]],
- bids: [{
- bidder: 'nafdigital',
- params: {
- publisherId: 2141020,
- bidFloor: 0.01
- }
- }]
- }, {
- code: 'test-banner',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'nafdigital',
- params: {
- publisherId: 2141020
- }
- }]
- }
-]
-```
diff --git a/modules/nanointeractiveBidAdapter.md b/modules/nanointeractiveBidAdapter.md
deleted file mode 100644
index c1790ff6337..00000000000
--- a/modules/nanointeractiveBidAdapter.md
+++ /dev/null
@@ -1,152 +0,0 @@
-# Overview
-
-```
-Module Name: Nano Interactive Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: rade@nanointeractive.com
-```
-
-# Description
-
-Connects to Nano Interactive search retargeting Ad Server for bids.
-
-
-
-
-### Requirements:
-To be able to get identification key (`pid`), please contact us at
-`https://www.nanointeractive.com/publishers`
-
-
-#### Send All Bids Ad Server Keys:
-(truncated to 20 chars due to [DFP limit](https://support.google.com/dfp_premium/answer/1628457?hl=en#Key-values))
-
-`hb_adid_nanointeract`
-`hb_bidder_nanointera`
-`hb_pb_nanointeractiv`
-`hb_format_nanointera`
-`hb_size_nanointeract`
-`hb_source_nanointera`
-
-#### Default Deal ID Keys:
-`hb_deal_nanointeract`
-
-### bid params
-
-{: .table .table-bordered .table-striped }
-| Name | Scope | Description | Example |
-| :------------- | :------- | :----------------------------------------------- | :--------------------------- |
-| `pid` | required | Identification key, provided by Nano Interactive | `'5afaa0280ae8996eb578de53'` |
-| `category` | optional | Contextual taxonomy | `'automotive'` |
-| `categoryName` | optional | Contextual taxonomy (from URL query param) | `'cat_name'` |
-| `nq` | optional | User search query | `'automobile search query'` |
-| `name` | optional | User search query (from URL query param) | `'search_param'` |
-| `subId` | optional | Channel - used to separate traffic sources | `'123'` |
-
-#### Configuration
-The `category` and `categoryName` are mutually exclusive. If you pass both, `categoryName` takes precedence.
-
-The `nq` and `name` are mutually exclusive. If you pass both, `name` takes precedence.
-
-#### Example with only required field `pid`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53'
- }
- }]
- }];
-
-#### Example with `category`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53',
- category: 'automotive',
- subId: '123'
- }
- }]
- }];
-
-#### Example with `categoryName`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53',
- // Category "automotive" is in the URL like:
- // https://www....?cat_name=automotive&...
- categoryName: 'cat_name',
- subId: '123'
- }
- }]
- }];
-
-#### Example with `nq`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53',
- // User searched "automobile search query" (extracted from search text field)
- nq: 'automobile search query',
- subId: '123'
- }
- }]
- }];
-
-#### Example with `name`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53',
- // User searched "automobile search query" and it is in the URL like:
- // https://www....?search_param=automobile%20search%20query&...
- name: 'search_param',
- subId: '123'
- }
- }]
- }];
-
-#### Example with `category` and `nq`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53',
- category: 'automotive',
- nq: 'automobile search query',
- subId: '123'
- }
- }]
- }];
-
-#### Example with `categoryName` and `name`
- var adUnits = [{
- code: 'nano-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'nanointeractive',
- params: {
- pid: '5afaa0280ae8996eb578de53',
- categoryName: 'cat_name',
- name: 'search_param',
- subId: '123'
- }
- }]
- }];
\ No newline at end of file
diff --git a/modules/nasmediaAdmixerBidAdapter.md b/modules/nasmediaAdmixerBidAdapter.md
deleted file mode 100644
index 096acf27f61..00000000000
--- a/modules/nasmediaAdmixerBidAdapter.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Overview
-
-```
-Module Name: NasmediaAdmixer Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@nasmedia.co.kr
-```
-``
-# Description
-
-Module that connects to NasmediaAdmixer demand sources.
-Banner formats are supported.
-The NasmediaAdmixer adapter doesn't support multiple sizes per ad-unit and will use the first one if multiple sizes are defined.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'banner-ad-div',
- mediaTypes: {
- banner: { // banner size
- sizes: [[300, 250]]
- }
- },
- bids: [
- {
- bidder: 'nasmediaAdmixer',
- params: {
- media_key: '19038695', //required
- adunit_id: '24190632', //required
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/nativoBidAdapter.js b/modules/nativoBidAdapter.js
index e07a124665f..ff6ae0887b4 100644
--- a/modules/nativoBidAdapter.js
+++ b/modules/nativoBidAdapter.js
@@ -138,7 +138,7 @@ export const spec = {
pageUrl = deepAccess(
request,
'params.url',
- bidderRequest.refererInfo.referer
+ bidderRequest.refererInfo.page
)
placementId = deepAccess(request, 'params.placementId')
diff --git a/modules/newborntownWebBidAdapter.md b/modules/newborntownWebBidAdapter.md
deleted file mode 100644
index f607369ffb6..00000000000
--- a/modules/newborntownWebBidAdapter.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Overview
-
-```
-Module Name: NewborntownWeb Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: zhuyushuang@newborntown.com
-```
-
-# Description
-
-Integration for website
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: '/19968336/header-bid-tag-1',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]]
- }
- },
- bids: [
- {
- bidder: "newborntownWeb",
- params: {
- 'publisher_id': '1238122',
- 'slot_id': '123123',
- 'bidfloor': 0.2
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/nextrollBidAdapter.js b/modules/nextrollBidAdapter.js
index 4e82bc1cbda..533c47e1ea6 100644
--- a/modules/nextrollBidAdapter.js
+++ b/modules/nextrollBidAdapter.js
@@ -39,7 +39,8 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
- let topLocation = parseUrl(deepAccess(bidderRequest, 'refererInfo.referer'));
+ // TODO: is 'page' the right value here?
+ let topLocation = parseUrl(deepAccess(bidderRequest, 'refererInfo.page'));
return validBidRequests.map((bidRequest) => {
return {
@@ -65,7 +66,6 @@ export const spec = {
}
},
- user: _getUser(validBidRequests),
site: _getSite(bidRequest, topLocation),
seller: _getSeller(bidRequest),
device: _getDevice(bidRequest),
@@ -186,22 +186,6 @@ function _getNativeAssets(mediaTypeNative) {
.filter(asset => asset !== undefined);
}
-function _getUser(requests) {
- const id = deepAccess(requests, '0.userId.nextrollId');
- if (id === undefined) {
- return;
- }
-
- return {
- ext: {
- eid: [{
- 'source': 'nextroll',
- id
- }]
- }
- };
-}
-
function _getFloor(bidRequest) {
if (!isFn(bidRequest.getFloor)) {
return (bidRequest.params.bidfloor) ? bidRequest.params.bidfloor : null;
diff --git a/modules/nextrollIdSystem.js b/modules/nextrollIdSystem.js
deleted file mode 100644
index 5a59e216394..00000000000
--- a/modules/nextrollIdSystem.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * This module adds Nextroll ID to the User ID module
- * The {@link module:modules/userId} module is required
- * @module modules/nextrollIdSystem
- * @requires module:modules/userId
- */
-
-import { deepAccess } from '../src/utils.js';
-import { submodule } from '../src/hook.js';
-import { getStorageManager } from '../src/storageManager.js';
-
-const NEXTROLL_ID_LS_KEY = 'dca0.com';
-const KEY_PREFIX = 'AdID:'
-
-export const storage = getStorageManager();
-
-/** @type {Submodule} */
-export const nextrollIdSubmodule = {
- /**
- * used to link submodule with config
- * @type {string}
- */
- name: 'nextrollId',
-
- /**
- * decode the stored id value for passing to bid requests
- * @function
- * @return {{nextrollId: string} | undefined}
- */
- decode(value) {
- return value;
- },
-
- /**
- * performs action to obtain id and return a value.
- * @function
- * @param {SubmoduleConfig} [config]
- * @returns {{id: {nextrollId: string} | undefined}}
- */
- getId(config) {
- const key = KEY_PREFIX + deepAccess(config, 'params.partnerId', 'undefined');
- const dataString = storage.getDataFromLocalStorage(NEXTROLL_ID_LS_KEY) || '{}';
- const data = JSON.parse(dataString);
- const idValue = deepAccess(data, `${key}.value`);
-
- return { id: idValue ? {nextrollId: idValue} : undefined };
- }
-};
-
-submodule('userId', nextrollIdSubmodule);
diff --git a/modules/nexx360BidAdapter.js b/modules/nexx360BidAdapter.js
index 814a2f55299..ed0c0c66a7a 100644
--- a/modules/nexx360BidAdapter.js
+++ b/modules/nexx360BidAdapter.js
@@ -59,7 +59,8 @@ export const spec = {
});
const payload = {
adUnits,
- href: encodeURIComponent(bidderRequest.refererInfo.referer)
+ // TODO: does the fallback make sense here?
+ href: encodeURIComponent(bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation)
};
if (bidderRequest) { // modules informations (gdpr, ccpa, schain, userId)
if (bidderRequest.gdprConsent) {
diff --git a/modules/nobidBidAdapter.js b/modules/nobidBidAdapter.js
index f788093f833..cfe18301b32 100644
--- a/modules/nobidBidAdapter.js
+++ b/modules/nobidBidAdapter.js
@@ -3,6 +3,7 @@ import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { getStorageManager } from '../src/storageManager.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const GVLID = 816;
const BIDDER_CODE = 'nobid';
@@ -25,15 +26,6 @@ function nobidSetCookie(cname, cvalue, hours) {
function nobidGetCookie(cname) {
return storage.getCookie(cname);
}
-function nobidHasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
function nobidBuildRequests(bids, bidderRequest) {
var serializeState = function(divIds, siteId, adunits) {
var filterAdUnitsByIds = function(divIds, adUnits) {
@@ -88,9 +80,10 @@ function nobidBuildRequests(bids, bidderRequest) {
}
var topLocation = function(bidderRequest) {
var ret = '';
- if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- ret = bidderRequest.refererInfo.referer;
+ if (bidderRequest?.refererInfo?.page) {
+ ret = bidderRequest.refererInfo.page;
} else {
+ // TODO: does this fallback make sense here?
ret = (window.context && window.context.location && window.context.location.href) ? window.context.location.href : document.location.href;
}
return encodeURIComponent(ret.replace(/\%/g, ''));
@@ -152,7 +145,7 @@ function nobidBuildRequests(bids, bidderRequest) {
if (cop) state['coppa'] = cop;
const eids = getEIDs(deepAccess(bids, '0.userIdAsEids'));
if (eids && eids.length > 0) state['eids'] = eids;
- if (config && config.getConfig('ortb2')) state['ortb2'] = config.getConfig('ortb2');
+ if (bidderRequest && bidderRequest.ortb2) state['ortb2'] = bidderRequest.ortb2;
return state;
}
function newAdunit(adunitObject, adunits) {
@@ -386,7 +379,7 @@ export const spec = {
const endpoint = buildEndpoint();
let options = {};
- if (!nobidHasPurpose1Consent(bidderRequest)) {
+ if (!hasPurpose1Consent(bidderRequest?.gdprConsent)) {
options = { withCredentials: false };
}
diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js
deleted file mode 100644
index aeb19e7c32c..00000000000
--- a/modules/oneVideoBidAdapter.js
+++ /dev/null
@@ -1,408 +0,0 @@
-import { logError, logWarn, parseSizesInput, generateUUID, isFn, logMessage, isPlainObject, isStr, isNumber, isArray } from '../src/utils.js';
-import {registerBidder} from '../src/adapters/bidderFactory.js';
-
-const BIDDER_CODE = 'oneVideo';
-export const spec = {
- code: 'oneVideo',
- VERSION: '3.1.2',
- ENDPOINT: 'https://ads.adaptv.advertising.com/rtb/openrtb?ext_id=',
- E2ETESTENDPOINT: 'https://ads-wc.v.ssp.yahoo.com/rtb/openrtb?ext_id=',
- SYNC_ENDPOINT1: 'https://pixel.advertising.com/ups/57304/sync?gdpr=&gdpr_consent=&_origin=0&redir=true',
- SYNC_ENDPOINT2: 'https://match.adsrvr.org/track/cmf/generic?ttd_pid=adaptv&ttd_tpi=1',
- supportedMediaTypes: ['video', 'banner'],
- gvlid: 25,
- /**
- * 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) {
- // Bidder code validation
- if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') {
- return false;
- }
-
- // E2E test skip validations
- if (bid.params && bid.params.video && bid.params.video.e2etest) {
- return true;
- }
- // MediaTypes Video / Banner validation
- if (typeof bid.mediaTypes.video === 'undefined' && typeof bid.mediaTypes.banner === 'undefined') {
- logError('Failed validation: adUnit mediaTypes.video OR mediaTypes.banner not declared');
- return false;
- };
-
- if (bid.mediaTypes.video) {
- // Player size validation
- if (typeof bid.mediaTypes.video.playerSize === 'undefined') {
- if (bid.params.video && (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined')) {
- logError('Failed validation: Player size not declared in either mediaTypes.playerSize OR bid.params.video.plauerWidth & bid.params.video.playerHeight.');
- return false;
- };
- };
- // Mimes validation
- if (typeof bid.mediaTypes.video.mimes === 'undefined') {
- if (!bid.params.video || typeof bid.params.video.mimes === 'undefined') {
- logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared');
- return false;
- };
- };
- // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support
- if (bid.mediaTypes.video.context === 'outstream' && bid.params.video && bid.params.video.display === 1) {
- logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)');
- return false;
- };
- };
-
- // Publisher Id (Exchange) validation
- if (typeof bid.params.pubId === 'undefined') {
- logError('Failed validation: Adapter cannot send requests without bid.params.pubId');
- return false;
- }
-
- return true;
- },
- /**
- * Make a server request from the list of BidRequests.
- *
- * @param {validBidRequests[]} - an array of bids
- * @param bidderRequest
- * @return ServerRequest Info describing the request to the server.
- */
- buildRequests: function (bids, bidRequest) {
- let consentData = bidRequest ? bidRequest.gdprConsent : null;
-
- return bids.map(bid => {
- let url = spec.ENDPOINT
- let pubId = bid.params.pubId;
- if (bid.params.video.e2etest) {
- url = spec.E2ETESTENDPOINT;
- pubId = 'HBExchange';
- }
- return {
- method: 'POST',
- /** removing adding local protocal since we
- * can get cookie data only if we call with https. */
- url: url + pubId,
- data: getRequestData(bid, consentData, bidRequest),
- bidRequest: bid
- }
- })
- },
- /**
- * 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(response, {bidRequest}) {
- let bid;
- let size;
- let bidResponse;
- try {
- response = response.body;
- bid = response.seatbid[0].bid[0];
- } catch (e) {
- response = null;
- }
- if (!response || !bid || (!bid.adm && !bid.nurl) || !bid.price) {
- logWarn(`No valid bids from ${spec.code} bidder`);
- return [];
- }
- size = getSize(bidRequest.sizes);
- bidResponse = {
- requestId: bidRequest.bidId,
- bidderCode: spec.code,
- cpm: bid.price,
- creativeId: bid.crid,
- width: size.width,
- height: size.height,
- currency: response.cur,
- ttl: (bidRequest.params.video.ttl > 0 && bidRequest.params.video.ttl <= 3600) ? bidRequest.params.video.ttl : 300,
- netRevenue: true,
- adUnitCode: bidRequest.adUnitCode,
- meta: {
- advertiserDomains: bid.adomain
- }
- };
-
- bidResponse.mediaType = (bidRequest.mediaTypes.banner) ? 'banner' : 'video'
-
- if (bid.nurl) {
- bidResponse.vastUrl = bid.nurl;
- } else if (bid.adm && bidRequest.params.video.display === 1) {
- bidResponse.ad = bid.adm
- } else if (bid.adm) {
- bidResponse.vastXml = bid.adm;
- }
- if (bidRequest.mediaTypes.video) {
- bidResponse.renderer = (bidRequest.mediaTypes.video.context === 'outstream') ? newRenderer(bidRequest, bidResponse) : undefined;
- }
-
- return bidResponse;
- },
- /**
- * Register the user sync pixels which should be dropped after the auction.
- *
- * @param {SyncOptions} syncOptions Which user syncs are allowed?
- * @param {ServerResponse[]} serverResponses List of server's responses.
- * @return {UserSync[]} The user syncs which should be dropped.
- */
- getUserSyncs: function(syncOptions, responses, consentData = {}) {
- let {
- gdprApplies,
- consentString = ''
- } = consentData;
-
- if (syncOptions.pixelEnabled) {
- return [{
- type: 'image',
- url: spec.SYNC_ENDPOINT1
- },
- {
- type: 'image',
- url: `https://sync-tm.everesttech.net/upi/pid/m7y5t93k?gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&redir=https%3A%2F%2Fpixel.advertising.com%2Fups%2F55986%2Fsync%3Fuid%3D%24%7BUSER_ID%7D%26_origin%3D0` + encodeURI(`&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}`)
- },
- {
- type: 'image',
- url: spec.SYNC_ENDPOINT2
- }];
- }
- }
-};
-
-function getSize(sizes) {
- let parsedSizes = parseSizesInput(sizes);
- let [ width, height ] = parsedSizes.length ? parsedSizes[0].split('x') : [];
- return {
- width: parseInt(width, 10) || undefined,
- height: parseInt(height, 10) || undefined
- };
-}
-
-function isConsentRequired(consentData) {
- return !!(consentData && consentData.gdprApplies);
-}
-
-function getRequestData(bid, consentData, bidRequest) {
- let loc = bidRequest.refererInfo.referer;
- let page = (bid.params.site && bid.params.site.page) ? (bid.params.site.page) : (loc.href);
- let ref = (bid.params.site && bid.params.site.referrer) ? bid.params.site.referrer : bidRequest.refererInfo.referer;
- let getFloorRequestObject = {
- currency: bid.params.cur || 'USD',
- mediaType: 'video',
- size: '*'
- };
- let bidData = {
- id: generateUUID(),
- at: 2,
- imp: [{
- id: '1',
- secure: isSecure(),
- ext: {
- hb: 1,
- prebidver: '$prebid.version$',
- adapterver: spec.VERSION,
- }
- }],
- site: {
- page: page,
- ref: ref
- },
- device: {
- ua: navigator.userAgent
- },
- tmax: 200
- };
-
- if (bid.params.video.display == undefined || bid.params.video.display != 1) {
- bidData.imp[0].video = {
- linearity: 1
- };
- if (bid.params.video.playerWidth && bid.params.video.playerHeight) {
- bidData.imp[0].video.w = bid.params.video.playerWidth;
- bidData.imp[0].video.h = bid.params.video.playerHeight;
- } else {
- const playerSize = getSize(bid.mediaTypes.video.playerSize);
- bidData.imp[0].video.w = playerSize.width;
- bidData.imp[0].video.h = playerSize.height;
- };
- if (bid.params.video.mimes) {
- bidData.imp[0].video.mimes = bid.params.video.mimes;
- } else {
- bidData.imp[0].video.mimes = bid.mediaTypes.video.mimes;
- };
- if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) {
- bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.mediaTypes.video.maxbitrate;
- }
- if (bid.mediaTypes.video.maxduration || bid.params.video.maxduration) {
- bidData.imp[0].video.maxduration = bid.params.video.maxduration || bid.mediaTypes.video.maxduration;
- }
- if (bid.mediaTypes.video.minduration || bid.params.video.minduration) {
- bidData.imp[0].video.minduration = bid.params.video.minduration || bid.mediaTypes.video.minduration;
- }
- if (bid.mediaTypes.video.api || bid.params.video.api) {
- bidData.imp[0].video.api = bid.params.video.api || bid.mediaTypes.video.api;
- }
- if (bid.mediaTypes.video.delivery || bid.params.video.delivery) {
- bidData.imp[0].video.delivery = bid.params.video.delivery || bid.mediaTypes.video.delivery;
- }
- if (bid.mediaTypes.video.position || bid.params.video.position) {
- bidData.imp[0].video.pos = bid.params.video.position || bid.mediaTypes.video.position;
- }
- if (bid.mediaTypes.video.playbackmethod || bid.params.video.playbackmethod) {
- bidData.imp[0].video.playbackmethod = bid.params.video.playbackmethod || bid.mediaTypes.video.playbackmethod;
- }
- if (bid.mediaTypes.video.placement || bid.params.video.placement) {
- bidData.imp[0].video.placement = bid.params.video.placement || bid.mediaTypes.video.placement;
- }
- if (bid.params.video.rewarded) {
- bidData.imp[0].ext.rewarded = bid.params.video.rewarded
- }
- if (bid.mediaTypes.video.linearity || bid.params.video.linearity) {
- bidData.imp[0].video.linearity = bid.params.video.linearity || bid.mediaTypes.video.linearity || 1;
- }
- if (bid.mediaTypes.video.protocols || bid.params.video.protocols) {
- bidData.imp[0].video.protocols = bid.params.video.protocols || bid.mediaTypes.video.protocols || [2, 5];
- }
- } else if (bid.params.video.display == 1) {
- getFloorRequestObject.mediaType = 'banner';
- bidData.imp[0].banner = {
- mimes: bid.params.video.mimes,
- w: bid.params.video.playerWidth,
- h: bid.params.video.playerHeight,
- pos: bid.params.video.position,
- };
- if (bid.params.video.placement) {
- bidData.imp[0].banner.placement = bid.params.video.placement
- }
- if (bid.params.video.maxduration) {
- bidData.imp[0].banner.ext = bidData.imp[0].banner.ext || {}
- bidData.imp[0].banner.ext.maxduration = bid.params.video.maxduration
- }
- if (bid.params.video.minduration) {
- bidData.imp[0].banner.ext = bidData.imp[0].banner.ext || {}
- bidData.imp[0].banner.ext.minduration = bid.params.video.minduration
- }
- }
-
- if (isFn(bid.getFloor)) {
- let floorData = bid.getFloor(getFloorRequestObject);
- bidData.imp[0].bidfloor = floorData.floor;
- bidData.cur = floorData.currency;
- } else {
- bidData.imp[0].bidfloor = bid.params.bidfloor;
- };
-
- if (bid.params.video.inventoryid) {
- bidData.imp[0].ext.inventoryid = bid.params.video.inventoryid
- }
- if (bid.params.video.sid) {
- bidData.source = {
- ext: {
- schain: {
- complete: 1,
- nodes: [{
- sid: bid.params.video.sid,
- rid: bidData.id,
- }]
- }
- }
- }
- if (bid.params.video.hp == 1) {
- bidData.source.ext.schain.nodes[0].hp = bid.params.video.hp;
- }
- } else if (bid.schain) {
- bidData.source = {
- ext: {
- schain: bid.schain
- }
- }
- bidData.source.ext.schain.nodes[0].rid = bidData.id;
- }
- if (bid.params.site && bid.params.site.id) {
- bidData.site.id = bid.params.site.id
- }
- if (isConsentRequired(consentData) || (bidRequest && bidRequest.uspConsent)) {
- bidData.regs = {
- ext: {}
- };
- if (isConsentRequired(consentData)) {
- bidData.regs.ext.gdpr = 1
- }
-
- if (consentData && consentData.consentString) {
- bidData.user = {
- ext: {
- consent: consentData.consentString
- }
- };
- }
- // ccpa support
- if (bidRequest && bidRequest.uspConsent) {
- bidData.regs.ext.us_privacy = bidRequest.uspConsent
- }
- }
- if (bid.params.video.e2etest) {
- logMessage('E2E test mode enabled: \n The following parameters are being overridden by e2etest mode:\n* bidfloor:null\n* width:300\n* height:250\n* mimes: video/mp4, application/javascript\n* api:2\n* site.page/ref: verizonmedia.com\n* tmax:1000');
- bidData.imp[0].bidfloor = null;
- bidData.imp[0].video.w = 300;
- bidData.imp[0].video.h = 250;
- bidData.imp[0].video.mimes = ['video/mp4', 'application/javascript'];
- bidData.imp[0].video.api = [2];
- bidData.site.page = 'https://verizonmedia.com';
- bidData.site.ref = 'https://verizonmedia.com';
- bidData.tmax = 1000;
- }
- if (bid.params.video.custom && isPlainObject(bid.params.video.custom)) {
- bidData.imp[0].ext.custom = {};
- for (const key in bid.params.video.custom) {
- if (isStr(bid.params.video.custom[key]) || isNumber(bid.params.video.custom[key])) {
- bidData.imp[0].ext.custom[key] = bid.params.video.custom[key];
- }
- }
- }
- if (bid.params.video.content && isPlainObject(bid.params.video.content)) {
- bidData.site.content = {};
- const contentStringKeys = ['id', 'title', 'series', 'season', 'genre', 'contentrating', 'language'];
- const contentNumberkeys = ['episode', 'prodq', 'context', 'livestream', 'len'];
- const contentArrayKeys = ['cat'];
- const contentObjectKeys = ['ext'];
- for (const contentKey in bid.params.video.content) {
- if (
- (contentStringKeys.indexOf(contentKey) > -1 && isStr(bid.params.video.content[contentKey])) ||
- (contentNumberkeys.indexOf(contentKey) > -1 && isNumber(bid.params.video.content[contentKey])) ||
- (contentObjectKeys.indexOf(contentKey) > -1 && isPlainObject(bid.params.video.content[contentKey])) ||
- (contentArrayKeys.indexOf(contentKey) > -1 && isArray(bid.params.video.content[contentKey]) &&
- bid.params.video.content[contentKey].every(catStr => isStr(catStr)))) {
- bidData.site.content[contentKey] = bid.params.video.content[contentKey];
- } else {
- logMessage('oneVideo bid adapter validation error: ', contentKey, ' is either not supported is OpenRTB V2.5 or value is undefined');
- }
- }
- }
- return bidData;
-}
-
-function isSecure() {
- return document.location.protocol === 'https:';
-}
-/**
- * Create oneVideo renderer
- * @returns {*}
- */
-function newRenderer(bidRequest, bid) {
- if (!bidRequest.renderer) {
- bidRequest.renderer = {};
- bidRequest.renderer.url = 'https://cdn.vidible.tv/prod/hb-outstream-renderer/renderer.js';
- bidRequest.renderer.render = function(bid) {
- setTimeout(function() {
- // eslint-disable-next-line no-undef
- o2PlayerRender(bid);
- }, 700)
- };
- }
-}
-
-registerBidder(spec);
diff --git a/modules/oneVideoBidAdapter.md b/modules/oneVideoBidAdapter.md
deleted file mode 100644
index 149a4b20e2f..00000000000
--- a/modules/oneVideoBidAdapter.md
+++ /dev/null
@@ -1,442 +0,0 @@
-# Overview
-
-**Module Name**: One Video Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: deepthi.neeladri.sravana@verizonmedia.com
- adam.browning@verizonmedia.com
-
-# Description
-Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to fetch bids.
-# Prebid.js V5.0 Support
-The oneVideo adapter now reads `mediaTypes.video` for mandatory parameters such as `playerSize` & `mimes`.
-Note: You can use the `bid.params.video` object to specify explicit overrides for whatever is declared in `mediaTypes.video`.
-Important: You must pass `bid.params.video = {}` as bare minimum for the adapter to work.
-# Integration Examples:
-
-## Instream Video adUnit using mediaTypes.video
-*Note:* By default, the adapter will read the mandatory parameters from mediaTypes.video.
-*Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player.
-```
- var adUnits = [
- {
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [480, 640],
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2,5],
- api: [2],
- position: 1,
- delivery: [2],
- minduration: 10,
- maxduration: 30,
- placement: 1,
- playbackmethod: [1,5],
- protocols: [2,5],
- api: [2],
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- sid: YOUR_VSSP_ORG_ID,
- hp: 1,
- rewarded: 1,
- inventoryid: 123,
- ttl: 300,
- custom: {
- key1: "value1",
- key2: 123345
- }
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchange'
- }
- }
- ]
- }
- ]
-```
-## Instream Video adUnit using params.video overrides
-*Note:* If the mandatory parameters are not specified in mediaTypes.video the adapter will read check to see if overrides are set in params.video. Decalring values using params.video will always override the settings in mediaTypes.video.
-*Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player.
-```
- var adUnits = [
- {
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'instream',
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2,5],
- api: [2],
- position: 1,
- delivery: [2],
- minduration: 10,
- maxduration: 30,
- placement: 1,
- playbackmethod: [1,5],
- protocols: [2,5],
- api: [2],
- sid: YOUR_VSSP_ORG_ID,
- hp: 1,
- rewarded: 1,
- inventoryid: 123,
- ttl: 300,
- custom: {
- key1: "value1",
- key2: 123345
- }
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchange'
- }
- }
- ]
- }
- ]
-```
-## Outstream Video adUnit example & parameters
-*Note:* The Video SSP ad server will load it's own Outstream Renderer (player) as a fallback if no player is defined on the publisher page. The Outstream player will inject into the div id that has an identical adUnit code.
-```
- var adUnits = [
- {
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [480, 640],
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2,5],
- api: [2],
- position: 1,
- delivery: [2],
- minduration: 10,
- maxduration: 30,
- placement: 1,
- playbackmethod: [1,5],
- protocols: [2,5],
- api: [2],
-
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- sid: YOUR_VSSP_ORG_ID,
- hp: 1,
- rewarded: 1,
- ttl: 250
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchange'
- }
- }
- ]
- }
- ]
-```
-
-## S2S / Video: Dynamic Ad Placement (DAP) adUnit example & parameters
-*Note:* The Video SSP ad server will respond with HTML embed tag to be injected into an iFrame you create.
-```
- var adUnits = [
- {
- code: 'video1',
- mediaTypes: {
- video: {
- context: "instream",
- playerSize: [480, 640],
- mimes: ['video/mp4', 'application/javascript'],
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- ttl: 250
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchangeDAP'
- }
- }
- ]
- }
-]
-```
-## Prebid.js / Banner: Dynamic Ad Placement (DAP) adUnit example & parameters
-*Note:* The Video SSP ad server will respond with HTML embed tag to be injected into an iFrame created by Google Ad Manager (GAM).
-```
- var adUnits = [
- {
- code: 'banner-1',
- mediaTypes: {
- banner: {
- sizes: [300, 250]
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- playerWidth: 300,
- playerHeight: 250,
- mimes: ['video/mp4', 'application/javascript'],
- display: 1
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchangeDAP'
- }
- }
- ]
- }
-]
-```
-
-# End 2 End Testing Mode
-By passing bid.params.video.e2etest = true you will be able to receive a test creative when connecting via VPN location U.S West Coast. This will allow you to trubleshoot how your player/ad-server parses and uses the VAST XML response.
-This automatically sets default values for the outbound bid-request to respond from our test exchange.
-No need to override the site/ref urls or change your pubId
-```
-var adUnits = [
- {
- code: 'video-1',
- mediaTypes: {
- video: {
- context: "instream",
- playerSize: [480, 640]
- mimes: ['video/mp4', 'application/javascript'],
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- e2etest: true
- }
- }
- }
- ]
- }
-]
-```
-
-# Supply Chain Object Support
-The oneVideoBidAdapter supports 2 methods for passing/creating an schain object.
-1. By passing your Video SSP Org ID in the bid.video.params.sid - The adapter will create a new schain object and our ad-server will fill in the data for you.
-2. Using the Prebid Supply Chain Object Module - The adapter will capture the schain object
-*Note:* You cannot pass both schain object and bid.video.params.sid together. Option 1 will always be the default.
-
-## Create new schain using bid.video.params.sid
-sid = your Video SSP Organization ID.
-This is for direct publishers only.
-```
-var adUnits = [
- {
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [480, 640],
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2,5],
- api: [2],
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- sid: 123456
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchange'
- }
- }
- ]
- }
- ]
-```
-
-## Pass global schain using pbjs.setConfig(SCHAIN_OBJECT)
-For both Authorized resellers and direct publishers.
-```
-pbjs.setConfig({
- "schain": {
- "validation": "strict",
- "config": {
- "ver": "1.0",
- "complete": 1,
- "nodes": [{
- "asi": "some-platform.com",
- "sid": "111111",
- "hp": 1
- }]
- }
- }
-});
-
-var adUnits = [
- {
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [480, 640],
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2,5],
- api: [2],
- }
- },
- bids: [
- {
- bidder: 'oneVideo',
- params: {
- video: {
- ttl: 250
- },
- bidfloor: 0.5,
- site: {
- id: 1,
- page: 'https://verizonmedia.com',
- referrer: 'https://verizonmedia.com'
- },
- pubId: 'HBExchange'
- }
- }
- ]
- }
- ]
-```
-# Content Object Support
-The oneVideoBidAdapter supports passing of OpenRTB V2.5 Content Object.
-
-```
-const adUnits = [{
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [640, 480],
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [1, 2],
- }
- },
- bids: [{
- bidder: 'oneVideo',
- params: {
- video: {
- ttl: 300,
- content: {
- id: "1234",
- title: "Title",
- series: "Series",
- season: "Season",
- episode: 1
- cat: [
- "IAB1",
- "IAB1-1",
- "IAB1-2",
- "IAB2",
- "IAB2-1"
- ],
- genre: "Genre",
- contentrating: "C-Rating",
- language: "EN",
- prodq: 1,
- context: 1,
- livestream: 0,
- len: 360,
- ext: {
- network: "ext-network",
- channel: "ext-channel"
- }
- }
- },
- bidfloor: 0.5,
- pubId: 'HBExchange'
- }
- }
- }]
- }]
-```
-
-
-# TTL Support
-The oneVideoBidAdapter supports passing of "Time To Live" (ttl) that indicates to prebid chache for how long to keep the chaced winning bid alive.
-Value is Number in seconds
-You can enter any number between 1 - 3600 (seconds)
-```
-const adUnits = [{
- code: 'video1',
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [640, 480],
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [1, 2],
- }
- },
- bids: [{
- bidder: 'oneVideo',
- params: {
- video: {
- ttl: 300
- },
- bidfloor: 0.5,
- pubId: 'HBExchange'
- }
- }]
- }]
-```
-
diff --git a/modules/oneplanetonlyBidAdapter.md b/modules/oneplanetonlyBidAdapter.md
deleted file mode 100644
index 973adb33efd..00000000000
--- a/modules/oneplanetonlyBidAdapter.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Overview
-
-```
-Module Name: OnePlanetOnly Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: vitaly@oneplanetonly.com
-```
-
-# Description
-
-Module that connects to OnePlanetOnly's demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'desktop-banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300, 600]],
- }
- },
- bids: [
- {
- bidder: 'oneplanetonly',
- params: {
- siteId: '5',
- adUnitId: '5-4587544'
- }
- }
- ]
- },{
- code: 'mobile-banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[320, 50], [320, 100]],
- }
- },
- bids: [
- {
- bidder: "oneplanetonly",
- params: {
- siteId: '5',
- adUnitId: '5-81037880'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/onomagicBidAdapter.js b/modules/onomagicBidAdapter.js
index 25b0f1a5934..d99455f3f73 100644
--- a/modules/onomagicBidAdapter.js
+++ b/modules/onomagicBidAdapter.js
@@ -1,7 +1,19 @@
-import { getBidIdParameter, _each, isArray, getWindowTop, getUniqueIdentifierStr, parseUrl, logError, logWarn, createTrackPixelHtml, getWindowSelf, isFn, isPlainObject } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { BANNER } from '../src/mediaTypes.js';
-import { config } from '../src/config.js';
+import {
+ _each,
+ createTrackPixelHtml,
+ getBidIdParameter,
+ getUniqueIdentifierStr,
+ getWindowSelf,
+ getWindowTop,
+ isArray,
+ isFn,
+ isPlainObject,
+ logError,
+ logWarn
+} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {BANNER} from '../src/mediaTypes.js';
+import {config} from '../src/config.js';
const BIDDER_CODE = 'onomagic';
const URL = 'https://bidder.onomagic.com/hb';
@@ -19,7 +31,7 @@ function buildRequests(bidReqs, bidderRequest) {
try {
let referrer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referrer = bidderRequest.refererInfo.referer;
+ referrer = bidderRequest.refererInfo.page;
}
const onomagicImps = [];
const publisherId = getBidIdParameter('publisherId', bidReqs[0].params);
@@ -56,7 +68,8 @@ function buildRequests(bidReqs, bidderRequest) {
id: getUniqueIdentifierStr(),
imp: onomagicImps,
site: {
- domain: parseUrl(referrer).host,
+ // TODO: does the fallback make sense here?
+ domain: bidderRequest?.refererInfo?.domain || window.location.host,
page: referrer,
publisher: {
id: publisherId
diff --git a/modules/openwebBidAdapter.js b/modules/openwebBidAdapter.js
index f515eb14011..f07b37e16e1 100644
--- a/modules/openwebBidAdapter.js
+++ b/modules/openwebBidAdapter.js
@@ -126,7 +126,8 @@ function parseRTBResponse(serverResponse, adapterRequest) {
function bidToTag(bidRequests, adapterRequest) {
// start publisher env
const tag = {
- Domain: deepAccess(adapterRequest, 'refererInfo.referer')
+ // TODO: is 'page' the right value here?
+ Domain: deepAccess(adapterRequest, 'refererInfo.page')
};
if (config.getConfig('coppa') === true) {
tag.Coppa = 1;
diff --git a/modules/openxBidAdapter.js b/modules/openxBidAdapter.js
index 85dcfbb3b47..7bea38a2de3 100644
--- a/modules/openxBidAdapter.js
+++ b/modules/openxBidAdapter.js
@@ -28,7 +28,7 @@ export const USER_ID_CODE_TO_QUERY_ARG = {
britepoolid: 'britepoolid', // BritePool ID
criteoId: 'criteoid', // CriteoID
fabrickId: 'nuestarid', // Fabrick ID by Nuestar
- haloId: 'audigentid', // Halo ID from Audigent
+ hadronId: 'audigentid', // Hadron ID from Audigent
id5id: 'id5id', // ID5 ID
idl_env: 'lre', // LiveRamp IdentityLink
IDP: 'zeotapid', // zeotapIdPlus ID+
@@ -44,7 +44,6 @@ export const USER_ID_CODE_TO_QUERY_ARG = {
tapadId: 'tapadid', // Tapad Id
tdid: 'ttduuid', // The Trade Desk Unified ID
uid2: 'uid2', // Unified ID 2.0
- flocId: 'floc', // Chrome FLoC,
admixerId: 'admixerid', // AdMixer ID
deepintentId: 'deepintentid', // DeepIntent ID
dmdId: 'dmdid', // DMD Marketing Corp ID
@@ -259,7 +258,7 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
let defaultParams;
defaultParams = {
- ju: config.getConfig('pageUrl') || bidderRequest.refererInfo.referer,
+ ju: bidderRequest.refererInfo.page,
ch: document.charSet || document.characterSet,
res: `${screen.width}x${screen.height}x${screen.colorDepth}`,
ifr: isInIframe,
@@ -271,12 +270,12 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
nocache: new Date().getTime()
};
- const userDataSegments = buildFpdQueryParams('ortb2.user.data');
+ const userDataSegments = buildFpdQueryParams('user.data', bidderRequest.ortb2);
if (userDataSegments.length > 0) {
defaultParams.sm = userDataSegments;
}
- const siteContentDataSegments = buildFpdQueryParams('ortb2.site.content.data');
+ const siteContentDataSegments = buildFpdQueryParams('site.content.data', bidderRequest.ortb2);
if (siteContentDataSegments.length > 0) {
defaultParams.scsm = siteContentDataSegments;
}
@@ -319,8 +318,8 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
return defaultParams;
}
-function buildFpdQueryParams(fpdPath) {
- const firstPartyData = config.getConfig(fpdPath);
+function buildFpdQueryParams(fpdPath, ortb2) {
+ const firstPartyData = deepAccess(ortb2, fpdPath);
if (!Array.isArray(firstPartyData) || !firstPartyData.length) {
return '';
}
@@ -350,9 +349,6 @@ function appendUserIdsToQueryParams(queryParams, userIds) {
case 'merkleId':
queryParams[key] = userIdObjectOrValue.id;
break;
- case 'flocId':
- queryParams[key] = userIdObjectOrValue.id;
- break;
case 'uid2':
queryParams[key] = userIdObjectOrValue.id;
break;
diff --git a/modules/operaadsBidAdapter.js b/modules/operaadsBidAdapter.js
index 61ea8cdcb76..27ca2dc0ed8 100644
--- a/modules/operaadsBidAdapter.js
+++ b/modules/operaadsBidAdapter.js
@@ -1,9 +1,21 @@
-import { logWarn, isArray, isStr, triggerPixel, deepAccess, deepSetValue, isPlainObject, generateUUID, parseUrl, isFn, getDNT, logError } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { BANNER, VIDEO, NATIVE } from '../src/mediaTypes.js';
-import { Renderer } from '../src/Renderer.js';
-import { OUTSTREAM } from '../src/video.js';
+import {
+ deepAccess,
+ deepSetValue,
+ generateUUID,
+ getDNT,
+ isArray,
+ isFn,
+ isPlainObject,
+ isStr,
+ logError,
+ logWarn,
+ triggerPixel
+} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {config} from '../src/config.js';
+import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
+import {Renderer} from '../src/Renderer.js';
+import {OUTSTREAM} from '../src/video.js';
const BIDDER_CODE = 'operaads';
@@ -209,8 +221,6 @@ export const spec = {
* @returns {Request}
*/
function buildOpenRtbBidRequest(bidRequest, bidderRequest) {
- const pageReferrer = deepAccess(bidderRequest, 'refererInfo.referer');
-
// build OpenRTB request body
const payload = {
id: bidderRequest.auctionId,
@@ -220,9 +230,10 @@ function buildOpenRtbBidRequest(bidRequest, bidderRequest) {
device: getDevice(),
site: {
id: String(deepAccess(bidRequest, 'params.publisherId')),
- domain: getDomain(pageReferrer),
- page: pageReferrer,
- ref: window.self === window.top ? document.referrer : '',
+ // TODO: does the fallback make sense here?
+ domain: bidderRequest?.refererInfo?.domain || window.location.host,
+ page: bidderRequest?.refererInfo?.page,
+ ref: bidderRequest?.refererInfo?.ref || '',
},
at: 1,
bcat: getBcat(bidRequest),
@@ -680,23 +691,6 @@ function getUserId(bidRequest) {
return generateUUID();
}
-/**
- * Get publisher domain
- *
- * @param {String} referer
- * @returns {String} domain
- */
-function getDomain(referer) {
- let domain;
-
- if (!(domain = config.getConfig('publisherDomain'))) {
- const u = parseUrl(referer);
- domain = u.hostname;
- }
-
- return domain.replace(/^https?:\/\/([\w\-\.]+)(?::\d+)?/, '$1');
-}
-
/**
* Get bid floor price
*
diff --git a/modules/optimaticBidAdapter.md b/modules/optimaticBidAdapter.md
deleted file mode 100644
index edaa3da90f6..00000000000
--- a/modules/optimaticBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-```
-Module Name: Optimatic Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@optimatic.com
-```
-
-# Description
-
-Optimatic Bid Adapter Module connects to Optimatic Demand Sources for Video Ads
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[640,480]], // a video size
- bids: [
- {
- bidder: "optimatic",
- params: {
- placement: "2chy7Gc2eSQL",
- bidfloor: 2.5
- }
- }
- ]
- },
- ];
-```
diff --git a/modules/optoutBidAdapter.js b/modules/optoutBidAdapter.js
index d218a65bf90..f7b5934665c 100644
--- a/modules/optoutBidAdapter.js
+++ b/modules/optoutBidAdapter.js
@@ -1,6 +1,7 @@
import { deepAccess } from '../src/utils.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'optout';
@@ -19,16 +20,6 @@ function getCurrency() {
return cur;
}
-function hasPurpose1Consent(bidderRequest) {
- let result = false;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
export const spec = {
code: BIDDER_CODE,
@@ -36,7 +27,7 @@ export const spec = {
return !!bid.params.publisher && !!bid.params.adslot;
},
- buildRequests: function(validBidRequests) {
+ buildRequests: function(validBidRequests, bidderRequest) {
return validBidRequests.map(bidRequest => {
let endPoint = 'https://adscience-nocookie.nl/prebid/display';
let consentString = '';
@@ -44,7 +35,7 @@ export const spec = {
if (bidRequest.gdprConsent) {
gdpr = (typeof bidRequest.gdprConsent.gdprApplies === 'boolean') ? Number(bidRequest.gdprConsent.gdprApplies) : 0;
consentString = bidRequest.gdprConsent.consentString;
- if (!gdpr || hasPurpose1Consent(bidRequest)) {
+ if (!gdpr || hasPurpose1Consent(bidRequest.gdprConsent)) {
endPoint = 'https://prebid.adscience.nl/prebid/display';
}
}
@@ -57,7 +48,7 @@ export const spec = {
adSlot: bidRequest.params.adslot,
cur: getCurrency(),
url: getDomain(bidRequest),
- ortb2: config.getConfig('ortb2'),
+ ortb2: bidderRequest.ortb2,
consent: consentString,
gdpr: gdpr
@@ -73,7 +64,7 @@ export const spec = {
getUserSyncs: function (syncOptions, responses, gdprConsent) {
if (gdprConsent) {
let gdpr = (typeof gdprConsent.gdprApplies === 'boolean') ? Number(gdprConsent.gdprApplies) : 0;
- if (syncOptions.iframeEnabled && (!gdprConsent.gdprApplies || hasPurpose1Consent({gdprConsent}))) {
+ if (syncOptions.iframeEnabled && (!gdprConsent.gdprApplies || hasPurpose1Consent(gdprConsent))) {
return [{
type: 'iframe',
url: 'https://umframe.adscience.nl/matching/iframe?gdpr=' + gdpr + '&gdpr_consent=' + gdprConsent.consentString
diff --git a/modules/orbidderBidAdapter.js b/modules/orbidderBidAdapter.js
index 38af3a8d1d6..bda0a0587f4 100644
--- a/modules/orbidderBidAdapter.js
+++ b/modules/orbidderBidAdapter.js
@@ -82,7 +82,7 @@ export const spec = {
return validBidRequests.map((bidRequest) => {
let referer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referer = bidderRequest.refererInfo.referer || '';
+ referer = bidderRequest.refererInfo.page || '';
}
bidRequest.params.bidfloor = getBidFloor(bidRequest);
diff --git a/modules/orbitsoftBidAdapter.md b/modules/orbitsoftBidAdapter.md
deleted file mode 100644
index a18f075b6b1..00000000000
--- a/modules/orbitsoftBidAdapter.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Overview
-
-```
-Module Name: Orbitsoft Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: support@orbitsoft.com
-```
-
-# Description
-
-Module that connects to Orbitsoft's demand sources. The “sizes” option is not supported, and the size of the ad depends on the placement settings. You can use an optional “style” parameter to set the appearance only for text ad. Specify the “requestUrl” param to your Orbitsoft ad server header bidding endpoint.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'orbitsoft-div',
- bids: [
- {
- bidder: "orbitsoft",
- params: {
- placementId: '132',
- requestUrl: 'https://orbitsoft.com/php/ads/hb.php',
- style: {
- title: {
- family: 'Tahoma',
- size: 'medium',
- weight: 'normal',
- style: 'normal',
- color: '0053F9'
- },
- description: {
- family: 'Tahoma',
- size: 'medium',
- weight: 'normal',
- style: 'normal',
- color: '0053F9'
- },
- url: {
- family: 'Tahoma',
- size: 'medium',
- weight: 'normal',
- style: 'normal',
- color: '0053F9'
- },
- colors: {
- background: 'ffffff',
- border: 'E0E0E0',
- link: '5B99FE'
- }
- },
- customParams: {
- macro_name: "macro_value"
- }
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/otmBidAdapter.js b/modules/otmBidAdapter.js
index e81bdfa9e6a..1230694fc65 100644
--- a/modules/otmBidAdapter.js
+++ b/modules/otmBidAdapter.js
@@ -45,13 +45,11 @@ export const spec = {
const bidRequests = [];
const tz = new Date().getTimezoneOffset()
- const referrer = bidderRequest && bidderRequest.refererInfo ? bidderRequest.refererInfo.referer : '';
+ // TODO: are these the right referer values?
+ const referrer = bidderRequest?.refererInfo?.page || '';
+ const topOrigin = bidderRequest?.refererInfo?.domain || '';
_each(validBidRequests, (bid) => {
- let topOrigin = ''
- try {
- if (isStr(referrer)) topOrigin = new URL(referrer).host
- } catch (e) { /* do nothing */ }
const domain = isStr(bid.params.domain) ? bid.params.domain : topOrigin
const cur = getValue(bid.params, 'currency') || DEFAULT_CURRENCY
const bidid = getBidIdParameter('bidId', bid)
diff --git a/modules/outbrainBidAdapter.js b/modules/outbrainBidAdapter.js
index e903f053c7e..a640fa776c9 100644
--- a/modules/outbrainBidAdapter.js
+++ b/modules/outbrainBidAdapter.js
@@ -53,7 +53,7 @@ export const spec = {
);
},
buildRequests: (validBidRequests, bidderRequest) => {
- const page = bidderRequest.refererInfo.referer;
+ const page = bidderRequest.refererInfo.page;
const ua = navigator.userAgent;
const test = setOnAny(validBidRequests, 'params.test');
const publisher = setOnAny(validBidRequests, 'params.publisher');
diff --git a/modules/outconAdapter.md b/modules/outconAdapter.md
deleted file mode 100644
index 88ed45396bc..00000000000
--- a/modules/outconAdapter.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Overview
-
-```
-Module Name: outconAdapter
-Module Type: Bidder Adapter
-Maintainer: mfolmer@dokkogroup.com.ar
-```
-
-# Description
-
-Module that connects to Outcon demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- bidder: 'outcon',
- params: {
- internalId: '12345678',
- publisher: '5d5d66f2306ea4114a37c7c2',
- bidId: '123456789',
- env: 'test'
- }
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/ozoneBidAdapter.js b/modules/ozoneBidAdapter.js
index 3b5147907eb..69fb3e840a1 100644
--- a/modules/ozoneBidAdapter.js
+++ b/modules/ozoneBidAdapter.js
@@ -191,7 +191,7 @@ export const spec = {
let ozoneRequest = {}; // we only want to set specific properties on this, not validBidRequests[0].params
delete ozoneRequest.test; // don't allow test to be set in the config - ONLY use $_GET['pbjs_debug']
- let fpd = config.getConfig('ortb2');
+ let fpd = bidderRequest.ortb2;
if (fpd && deepAccess(fpd, 'user')) {
logInfo('added FPD user object');
ozoneRequest.user = fpd.user;
diff --git a/modules/padsquadBidAdapter.js b/modules/padsquadBidAdapter.js
index 72449cf28be..d5fe37ef34b 100644
--- a/modules/padsquadBidAdapter.js
+++ b/modules/padsquadBidAdapter.js
@@ -43,9 +43,9 @@ export const spec = {
id: bidderRequest.auctionId,
imp: impressions,
site: {
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidderRequest.refererInfo ? bidderRequest.refererInfo.referer || null : null
+ domain: bidderRequest?.refererInfo?.domain,
+ page: bidderRequest?.refererInfo?.page,
+ ref: bidderRequest?.refererInfo?.ref,
},
ext: {
exchange: {
diff --git a/modules/papyrusBidAdapter.md b/modules/papyrusBidAdapter.md
deleted file mode 100644
index 98a42e542ec..00000000000
--- a/modules/papyrusBidAdapter.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Overview
-
-```
-Module Name: Papyrus Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: alexander.holodov@papyrus.global
-```
-
-# Description
-
-Connect to Papyrus system for bids.
-
-Papyrus bid adapter supports Banner.
-
-Please contact to info@papyrus.global for
-further details
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [
- [320, 50]
- ]
- }
- },
- bids: [
- {
- bidder: 'papyrus',
- params: {
- address: '0xd7e2a771c5dcd5df7f789477356aecdaeee6c985',
- placementId: 'b57e55fd18614b0591893e9fff41fbea'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/parrableIdSystem.js b/modules/parrableIdSystem.js
index 04f36d0cb63..4a777097914 100644
--- a/modules/parrableIdSystem.js
+++ b/modules/parrableIdSystem.js
@@ -244,7 +244,7 @@ function fetchId(configParams, gdprConsentData) {
const data = {
eid,
trackers,
- url: refererInfo.referer,
+ url: refererInfo.page,
prebidVersion: '$prebid.version$',
isIframe: inIframe(),
tpcSupport
diff --git a/modules/peak226BidAdapter.md b/modules/peak226BidAdapter.md
deleted file mode 100644
index bae15d6c99f..00000000000
--- a/modules/peak226BidAdapter.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Overview
-
-```
-Module Name: Peak226 Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: support@edge226.com
-```
-
-# Description
-
-Module that connects to Peak226's demand sources
-
-# Test Parameters
-
-```
- var adUnits = [
- {
- code: "test-div",
- sizes: [[300, 250]],
- mediaType: "banner",
- bids: [
- {
- bidder: "peak226",
- params: {
- uid: 76131369
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/performaxBidAdapter.md b/modules/performaxBidAdapter.md
deleted file mode 100644
index 4cf2984a79d..00000000000
--- a/modules/performaxBidAdapter.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Overview
-
-```
-Module Name: Performax Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: development@performax.cz
-```
-
-# Description
-
-Connects to Performax exchange for bids.
-
-Performax bid adapter supports Banner.
-
-
-# Sample Banner Ad Unit: For Publishers
-
-```javascript
- var adUnits = [
- {
- code: 'performax-div',
- sizes: [[300, 300]],
- bids: [
- {
- bidder: "performax",
- params: {
- slotId: 28 // required
- }
- }
- ]
- }
- ];
-```
-
-Where:
-* slotId - id of slot in PX system
diff --git a/modules/permutiveRtdProvider.js b/modules/permutiveRtdProvider.js
index c4674132416..79c709f9bcc 100644
--- a/modules/permutiveRtdProvider.js
+++ b/modules/permutiveRtdProvider.js
@@ -9,7 +9,6 @@ import {getGlobal} from '../src/prebidGlobal.js';
import {submodule} from '../src/hook.js';
import {getStorageManager} from '../src/storageManager.js';
import {deepAccess, deepSetValue, isFn, logError, mergeDeep} from '../src/utils.js';
-import {config} from '../src/config.js';
import {includes} from '../src/polyfill.js';
const MODULE_NAME = 'permutive'
@@ -62,11 +61,10 @@ function getModuleConfig (customModuleConfig) {
/**
* Sets ortb2 config for ac bidders
- * @param {Object} auctionDetails
+ * @param {Object} bidderOrtb2
* @param {Object} customModuleConfig - Publisher config for module
*/
-export function setBidderRtb (auctionDetails, customModuleConfig) {
- const bidderConfig = config.getBidderConfig()
+export function setBidderRtb (bidderOrtb2, customModuleConfig) {
const moduleConfig = getModuleConfig(customModuleConfig)
const acBidders = deepAccess(moduleConfig, 'params.acBidders')
const maxSegs = deepAccess(moduleConfig, 'params.maxSegs')
@@ -74,13 +72,9 @@ export function setBidderRtb (auctionDetails, customModuleConfig) {
const segmentData = getSegments(maxSegs)
acBidders.forEach(function (bidder) {
- const currConfig = bidderConfig[bidder] || {}
+ const currConfig = { ortb2: bidderOrtb2[bidder] || {} }
const nextConfig = updateOrtbConfig(currConfig, segmentData.ac, transformationConfigs) // ORTB2 uses the `ac` segment IDs
-
- config.setBidderConfig({
- bidders: [bidder],
- config: nextConfig
- })
+ bidderOrtb2[bidder] = nextConfig.ortb2;
})
}
@@ -306,12 +300,10 @@ export const permutiveSubmodule = {
makeSafe(function () {
// Legacy route with custom parameters
initSegments(reqBidsConfigObj, callback, customModuleConfig)
- })
- },
- onAuctionInitEvent: function (auctionDetails, customModuleConfig) {
+ });
makeSafe(function () {
// Route for bidders supporting ORTB2
- setBidderRtb(auctionDetails, customModuleConfig)
+ setBidderRtb(reqBidsConfigObj.ortb2Fragments?.bidder, customModuleConfig)
})
},
init: init
diff --git a/modules/pixfutureBidAdapter.js b/modules/pixfutureBidAdapter.js
index 29552ec796d..bffd5badded 100644
--- a/modules/pixfutureBidAdapter.js
+++ b/modules/pixfutureBidAdapter.js
@@ -14,6 +14,7 @@ import {
transformBidderParamKeywords
} from '../src/utils.js';
import {auctionManager} from '../src/auctionManager.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const SOURCE = 'pbjs';
const storageManager = getStorageManager({bidderCode: 'pixfuture'});
@@ -42,7 +43,7 @@ export const spec = {
return validBidRequests.map((bidRequest) => {
let referer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- referer = bidderRequest.refererInfo.referer || '';
+ referer = bidderRequest.refererInfo.page || '';
}
const userObjBid = find(validBidRequests, hasUserInfo);
@@ -90,7 +91,8 @@ export const spec = {
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: this collects everything it finds, except for canonicalUrl
+ rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
@@ -101,7 +103,6 @@ export const spec = {
if (validBidRequests[0].userId) {
let eids = [];
- addUserId(eids, deepAccess(validBidRequests[0], `userId.flocId.id`), 'chrome.com', null);
addUserId(eids, deepAccess(validBidRequests[0], `userId.criteoId`), 'criteo.com', null);
addUserId(eids, deepAccess(validBidRequests[0], `userId.unifiedId`), 'thetradedesk.com', null);
addUserId(eids, deepAccess(validBidRequests[0], `userId.id5Id`), 'id5.io', null);
@@ -164,7 +165,7 @@ export const spec = {
getUserSyncs: function (syncOptions, bid, gdprConsent) {
var pixid = '';
if (typeof bid[0] === 'undefined' || bid[0] === null) { pixid = '0'; } else { pixid = bid[0].body.pix_id; }
- if (syncOptions.iframeEnabled && hasPurpose1Consent({gdprConsent})) {
+ if (syncOptions.iframeEnabled && hasPurpose1Consent(gdprConsent)) {
return [{
type: 'iframe',
url: 'https://gosrv.pixfuture.com/cookiesync?adsync=' + gdprConsent.consentString + '&pixid=' + pixid + '&gdprconcent=' + gdprConsent.gdprApplies
@@ -197,16 +198,6 @@ function newBid(serverBid, rtbBid, placementId, uuid) {
return bid;
}
-function hasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
// Functions related optional parameters
function bidToTag(bid) {
const tag = {};
@@ -229,6 +220,13 @@ function bidToTag(bid) {
}
if (bid.params.position) {
tag.position = {'above': 1, 'below': 2}[bid.params.position] || 0;
+ } else {
+ let mediaTypePos = deepAccess(bid, `mediaTypes.banner.pos`) || deepAccess(bid, `mediaTypes.video.pos`);
+ // only support unknown, atf, and btf values for position at this time
+ if (mediaTypePos === 0 || mediaTypePos === 1 || mediaTypePos === 3) {
+ // ortb spec treats btf === 3, but our system interprets btf === 2; so converting the ortb value here for consistency
+ tag.position = (mediaTypePos === 3) ? 2 : mediaTypePos;
+ }
}
if (bid.params.trafficSourceCode) {
tag.traffic_source_code = bid.params.trafficSourceCode;
diff --git a/modules/piximediaBidAdapter.md b/modules/piximediaBidAdapter.md
deleted file mode 100644
index fae014cbdff..00000000000
--- a/modules/piximediaBidAdapter.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Overview
-
-**Module Name**: Piximedia Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: contact@piximedia.fr
-
-# Description
-
-Piximedia Bidder Adapter for Prebid.js.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'mpu',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'piximedia',
- params: {
- siteId: 'PIXIMEDIA',
- placementId: 'PREBID'
- }
- }]
- }];
-
-```
diff --git a/modules/platformioBidAdapter.md b/modules/platformioBidAdapter.md
deleted file mode 100644
index 863e023f0d7..00000000000
--- a/modules/platformioBidAdapter.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# Overview
-
-**Module Name**: Platform.io Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: siarhei.kasukhin@platform.io
-
-# Description
-
-Connects to Platform.io demand source to fetch bids.
-Banner, Native, Video formats are supported.
-Please use ```platformio``` as the bidder code.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'dfp-native-div',
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 75
- },
- image: {
- required: true
- },
- body: {
- len: 200
- },
- icon: {
- required: false
- }
- }
- },
- bids: [{
- bidder: 'platformio',
- params: {
- pubId: '29521',
- siteId: '26048',
- placementId: '123',
- bidFloor: '0.001', // optional
- ifa: 'XXX-XXX', // optional
- latitude: '40.712775', // optional
- longitude: '-74.005973', // optional
- }
- }]
- },
- {
- code: 'dfp-banner-div',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250],[300,600]
- ],
- }
- },
- bids: [{
- bidder: 'platformio',
- params: {
- pubId: '29521',
- siteId: '26049',
- placementId: '123',
- }
- }]
- },
- {
- code: 'dfp-video-div',
- mediaTypes: {
- video: {
- playerSize: [[640, 480]],
- context: "instream"
- }
- },
- bids: [{
- bidder: 'platformio',
- params: {
- pubId: '29521',
- siteId: '26049',
- placementId: '123',
- video: {
- skipppable: true,
- }
- }
- }]
- }
- ];
-```
diff --git a/modules/playwireBidAdapter.md b/modules/playwireBidAdapter.md
deleted file mode 100644
index dddb57c9bc1..00000000000
--- a/modules/playwireBidAdapter.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# Overview
-
-Module Name: Playwire Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: grid-tech@themediagrid.com
-
-# Description
-
-Module that connects to Grid demand source to fetch bids.
-The adapter is GDPR compliant and supports banner and video (instream and outstream).
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "playwire",
- params: {
- uid: '1',
- bidFloor: 0.5
- }
- }
- ]
- },{
- code: 'test-div',
- sizes: [[728, 90]],
- bids: [
- {
- bidder: "playwire",
- params: {
- uid: 2,
- keywords: {
- brandsafety: ['disaster'],
- topic: ['stress', 'fear']
- }
- }
- }
- ]
- },
- {
- code: 'test-div',
- sizes: [[728, 90]],
- mediaTypes: { video: {
- context: 'instream',
- playerSize: [728, 90],
- mimes: ['video/mp4']
- },
- bids: [
- {
- bidder: "playwire",
- params: {
- uid: 11
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/polluxBidAdapter.md b/modules/polluxBidAdapter.md
deleted file mode 100644
index 79bf84e79b9..00000000000
--- a/modules/polluxBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-**Module Name**: Pollux Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: tech@polluxnetwork.com
-
-# Description
-
-Module that connects to Pollux Network LLC demand source to fetch bids.
-All bids will present CPM in EUR (Euro).
-
-# Test Parameters
-```
- var adUnits = [{
- code: '34f724kh32',
- sizes: [[300, 250]], // a single size
- bids: [{
- bidder: 'pollux',
- params: {
- zone: '1806' // a single zone
- }
- }]
- },{
- code: '34f789r783',
- sizes: [[300, 250], [728, 90]], // multiple sizes
- bids: [{
- bidder: 'pollux',
- params: {
- zone: '1806,276' // multiple zones, max 5
- }
- }]
- }];
-```
diff --git a/modules/polymorphBidAdapter.md b/modules/polymorphBidAdapter.md
deleted file mode 100644
index e778b312e56..00000000000
--- a/modules/polymorphBidAdapter.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Overview
-
-```
-Module Name: Polymorph Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: kuldeep@getpolymorph.com
-```
-
-# Description
-
-Connects to Polymorph Demand Cloud (s2s header-bidding)
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div-1',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "polymorph",
- params: {
- placementId: 'ping'
- }
- }
- ]
- },{
- code: 'test-div-2',
- sizes: [[300, 250], [300,600]]
- bids: [
- {
- bidder: "polymorph",
- params: {
- placementId: 'ping',
- // In case multiple ad sizes are supported, it's recommended to specify default height and width for native ad (in case native ad is chose as a winner). In case of banner or outstream ad any one of the above sizes can be chosen depending on the highest bid.
- defaultWidth: 300,
- defaultHeight: 600
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/prebidServerBidAdapter/index.js b/modules/prebidServerBidAdapter/index.js
index 0ffb16d23a4..ecf13ae5659 100644
--- a/modules/prebidServerBidAdapter/index.js
+++ b/modules/prebidServerBidAdapter/index.js
@@ -39,6 +39,7 @@ import { S2S_VENDORS } from './config.js';
import { ajax } from '../../src/ajax.js';
import {hook} from '../../src/hook.js';
import {getGlobal} from '../../src/prebidGlobal.js';
+import {hasPurpose1Consent} from '../../src/utils/gpdr.js';
const getConfig = config.getConfig;
@@ -389,18 +390,13 @@ function _appendSiteAppDevice(request, pageUrl, accountId) {
}
}
-function addBidderFirstPartyDataToRequest(request) {
- const bidderConfig = config.getBidderConfig();
- const fpdConfigs = Object.keys(bidderConfig).reduce((acc, bidder) => {
- const currBidderConfig = bidderConfig[bidder];
- if (currBidderConfig.ortb2) {
- const ortb2 = mergeDeep({}, currBidderConfig.ortb2);
-
- acc.push({
- bidders: [ bidder ],
- config: { ortb2 }
- });
- }
+function addBidderFirstPartyDataToRequest(request, bidderFpd) {
+ const fpdConfigs = Object.entries(bidderFpd).reduce((acc, [bidder, bidderOrtb2]) => {
+ const ortb2 = mergeDeep({}, bidderOrtb2);
+ acc.push({
+ bidders: [ bidder ],
+ config: { ortb2 }
+ });
return acc;
}, []);
@@ -716,7 +712,10 @@ Object.assign(ORTB2.prototype, {
if (adapter && adapter.getSpec().transformBidParams) {
bid.params = adapter.getSpec().transformBidParams(bid.params, true, adUnit, bidRequests);
}
- acc[bid.bidder] = (s2sConfig.adapterOptions && s2sConfig.adapterOptions[bid.bidder]) ? Object.assign({}, bid.params, s2sConfig.adapterOptions[bid.bidder]) : bid.params;
+ deepSetValue(acc,
+ `prebid.bidder.${bid.bidder}`,
+ (s2sConfig.adapterOptions && s2sConfig.adapterOptions[bid.bidder]) ? Object.assign({}, bid.params, s2sConfig.adapterOptions[bid.bidder]) : bid.params
+ );
return acc;
}, {...deepAccess(adUnit, 'ortb2Imp.ext')});
@@ -753,12 +752,6 @@ Object.assign(ORTB2.prototype, {
mergeDeep(imp, mediaTypes);
- // if storedAuctionResponse has been set, pass SRID
- const storedAuctionResponseBid = find(firstBidRequest.bids, bid => (bid.adUnitCode === adUnit.code && bid.storedAuctionResponse));
- if (storedAuctionResponseBid) {
- deepSetValue(imp, 'ext.prebid.storedauctionresponse.id', storedAuctionResponseBid.storedAuctionResponse.toString());
- }
-
const floor = (() => {
// we have to pick a floor for the imp - here we attempt to find the minimum floor
// across all bids for this adUnit
@@ -879,7 +872,7 @@ Object.assign(ORTB2.prototype, {
request.cur = [adServerCur[0]];
}
- _appendSiteAppDevice(request, bidRequests[0].refererInfo.referer, s2sConfig.accountId);
+ _appendSiteAppDevice(request, bidRequests[0].refererInfo.page, s2sConfig.accountId);
// pass schain object if it is present
const schain = deepAccess(bidRequests, '0.bids.0.schain');
@@ -948,10 +941,10 @@ Object.assign(ORTB2.prototype, {
deepSetValue(request, 'regs.coppa', 1);
}
- const commonFpd = getConfig('ortb2') || {};
+ const commonFpd = s2sBidRequest.ortb2Fragments?.global || {};
mergeDeep(request, commonFpd);
- addBidderFirstPartyDataToRequest(request);
+ addBidderFirstPartyDataToRequest(request, s2sBidRequest.ortb2Fragments?.bidder || {});
request.imp.forEach((imp) => this.impRequested[imp.id] = imp);
return request;
@@ -1159,16 +1152,6 @@ function bidWonHandler(bid) {
}
}
-function hasPurpose1Consent(gdprConsent) {
- let result = true;
- if (gdprConsent) {
- if (gdprConsent.gdprApplies && gdprConsent.apiVersion === 2) {
- result = !!(deepAccess(gdprConsent, 'vendorData.purpose.consents.1') === true);
- }
- }
- return result;
-}
-
function getMatchingConsentUrl(urlProp, gdprConsent) {
return hasPurpose1Consent(gdprConsent) ? urlProp.p1Consent : urlProp.noP1Consent;
}
diff --git a/modules/priceFloors.js b/modules/priceFloors.js
index e548de768b4..f397e92055e 100644
--- a/modules/priceFloors.js
+++ b/modules/priceFloors.js
@@ -75,11 +75,15 @@ function roundUp(number, precision) {
return Math.ceil((parseFloat(number) * Math.pow(10, precision)).toFixed(1)) / Math.pow(10, precision);
}
-let referrerHostname;
-function getHostNameFromReferer(referer) {
- referrerHostname = parseUrl(referer, {noDecodeWholeURL: true}).hostname;
- return referrerHostname;
-}
+const getHostname = (() => {
+ let domain;
+ return function() {
+ if (domain == null) {
+ domain = parseUrl(getRefererInfo().topmostLocation, {noDecodeWholeUrl: true}).hostname;
+ }
+ return domain;
+ }
+})();
// First look into bidRequest!
function getGptSlotFromAdUnit(transactionId, {index = auctionManager.index} = {}) {
@@ -99,7 +103,7 @@ export let fieldMatchingFunctions = {
'size': (bidRequest, bidResponse) => parseGPTSingleSizeArray(bidResponse.size) || '*',
'mediaType': (bidRequest, bidResponse) => bidResponse.mediaType || 'banner',
'gptSlot': (bidRequest, bidResponse) => getGptSlotFromAdUnit((bidRequest || bidResponse).transactionId) || getGptSlotInfoForAdUnitCode(getAdUnitCode(bidRequest, bidResponse)).gptSlot,
- 'domain': (bidRequest, bidResponse) => referrerHostname || getHostNameFromReferer(getRefererInfo().referer),
+ 'domain': getHostname,
'adUnitCode': (bidRequest, bidResponse) => getAdUnitCode(bidRequest, bidResponse)
}
diff --git a/modules/proxistoreBidAdapter.js b/modules/proxistoreBidAdapter.js
index 42a98bcdb09..04d363be7fb 100644
--- a/modules/proxistoreBidAdapter.js
+++ b/modules/proxistoreBidAdapter.js
@@ -54,10 +54,8 @@ function _createServerRequest(bidRequests, bidderRequest) {
if (gdprConsent.vendorData) {
var vendorData = gdprConsent.vendorData;
- var apiVersion = gdprConsent.apiVersion;
if (
- apiVersion === 2 &&
vendorData.vendor &&
vendorData.vendor.consents &&
typeof vendorData.vendor.consents[PROXISTORE_VENDOR_ID.toString(10)] !==
@@ -65,14 +63,6 @@ function _createServerRequest(bidRequests, bidderRequest) {
) {
payload.gdpr.consentGiven =
!!vendorData.vendor.consents[PROXISTORE_VENDOR_ID.toString(10)];
- } else if (
- apiVersion === 1 &&
- vendorData.vendorConsents &&
- typeof vendorData.vendorConsents[PROXISTORE_VENDOR_ID.toString(10)] !==
- 'undefined'
- ) {
- payload.gdpr.consentGiven =
- !!vendorData.vendorConsents[PROXISTORE_VENDOR_ID.toString(10)];
}
}
}
diff --git a/modules/pubgeniusBidAdapter.js b/modules/pubgeniusBidAdapter.js
index 28c4fdefd42..5e7ce6fc9fb 100644
--- a/modules/pubgeniusBidAdapter.js
+++ b/modules/pubgeniusBidAdapter.js
@@ -228,20 +228,15 @@ function buildSite(bidderRequest) {
let site = null;
const { refererInfo } = bidderRequest;
- const pageUrl = config.getConfig('pageUrl') || refererInfo.canonicalUrl || refererInfo.referer;
+ const pageUrl = refererInfo.page;
if (pageUrl) {
site = site || {};
site.page = pageUrl;
}
- if (refererInfo.reachedTop) {
- try {
- const pageRef = window.top.document.referrer;
- if (pageRef) {
- site = site || {};
- site.ref = pageRef;
- }
- } catch (e) {}
+ if (refererInfo.ref) {
+ site = site || {};
+ site.ref = refererInfo.ref;
}
return site;
diff --git a/modules/pubmaticAnalyticsAdapter.js b/modules/pubmaticAnalyticsAdapter.js
index 16e54fbdcc8..6a73838ff1d 100755
--- a/modules/pubmaticAnalyticsAdapter.js
+++ b/modules/pubmaticAnalyticsAdapter.js
@@ -358,7 +358,7 @@ function auctionInitHandler(args) {
'bidderDonePendingCount', () => args.bidderRequests.length,
]);
cacheEntry.adUnitCodes = {};
- cacheEntry.referer = args.bidderRequests[0].refererInfo.referer;
+ cacheEntry.referer = args.bidderRequests[0].refererInfo.topmostLocation;
cache.auctions[args.auctionId] = cacheEntry;
}
diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js
index b18e1b73604..e34d58ddd2e 100644
--- a/modules/pubmaticBidAdapter.js
+++ b/modules/pubmaticBidAdapter.js
@@ -111,10 +111,6 @@ const dealChannelValues = {
6: 'PMPG'
};
-const FLOC_FORMAT = {
- 'EID': 1,
- 'SEGMENT': 2
-}
// BB stands for Blue BillyWig
const BB_RENDERER = {
bootstrapPlayer: function(bid) {
@@ -273,8 +269,9 @@ function _parseAdSlot(bid) {
function _initConf(refererInfo) {
return {
- pageURL: (refererInfo && refererInfo.referer) ? refererInfo.referer : window.location.href,
- refURL: window.document.referrer
+ // TODO: do the fallbacks make sense here?
+ pageURL: refererInfo?.page || window.location.href,
+ refURL: refererInfo?.ref || window.document.referrer
};
}
@@ -799,67 +796,8 @@ function _addFloorFromFloorModule(impObj, bid) {
logInfo(LOG_WARN_PREFIX, 'new impObj.bidfloor value:', impObj.bidfloor);
}
-function _getFlocId(validBidRequests, flocFormat) {
- var flocIdObject = null;
- var flocId = deepAccess(validBidRequests, '0.userId.flocId');
- if (flocId && flocId.id) {
- switch (flocFormat) {
- case FLOC_FORMAT.SEGMENT:
- flocIdObject = {
- id: 'FLOC',
- name: 'FLOC',
- ext: {
- ver: flocId.version
- },
- segment: [{
- id: flocId.id,
- name: 'chrome.com',
- value: flocId.id.toString()
- }]
- }
- break;
- case FLOC_FORMAT.EID:
- default:
- flocIdObject = {
- source: 'chrome.com',
- uids: [
- {
- atype: 1,
- id: flocId.id,
- ext: {
- ver: flocId.version
- }
- },
- ]
- }
- break;
- }
- }
- return flocIdObject;
-}
-
-function _handleFlocId(payload, validBidRequests) {
- var flocObject = _getFlocId(validBidRequests, FLOC_FORMAT.SEGMENT);
- if (flocObject) {
- if (!payload.user) {
- payload.user = {};
- }
- if (!payload.user.data) {
- payload.user.data = [];
- }
- payload.user.data.push(flocObject);
- }
-}
-
function _handleEids(payload, validBidRequests) {
let bidUserIdAsEids = deepAccess(validBidRequests, '0.userIdAsEids');
- let flocObject = _getFlocId(validBidRequests, FLOC_FORMAT.EID);
- if (flocObject) {
- if (!bidUserIdAsEids) {
- bidUserIdAsEids = [];
- }
- bidUserIdAsEids.push(flocObject);
- }
if (isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
deepSetValue(payload, 'user.eids', bidUserIdAsEids);
}
@@ -1202,9 +1140,8 @@ export const spec = {
_handleEids(payload, validBidRequests);
- _handleFlocId(payload, validBidRequests);
// First Party Data
- const commonFpd = config.getConfig('ortb2') || {};
+ const commonFpd = (bidderRequest && bidderRequest.ortb2) || {};
if (commonFpd.site) {
mergeDeep(payload, {site: commonFpd.site});
}
diff --git a/modules/pubwiseAnalyticsAdapter.js b/modules/pubwiseAnalyticsAdapter.js
index 006d6da7eb7..a3061eb1c99 100644
--- a/modules/pubwiseAnalyticsAdapter.js
+++ b/modules/pubwiseAnalyticsAdapter.js
@@ -224,7 +224,8 @@ function filterAuctionInit(data) {
modified.refererInfo = {};
// handle clean referrer, we only need one
if (typeof modified.bidderRequests !== 'undefined' && typeof modified.bidderRequests[0] !== 'undefined' && typeof modified.bidderRequests[0].refererInfo !== 'undefined') {
- modified.refererInfo = modified.bidderRequests[0].refererInfo;
+ // TODO: please do not send internal data structures over the network
+ modified.refererInfo = modified.bidderRequests[0].refererInfo.legacy;
}
if (typeof modified.adUnitCodes !== 'undefined') {
diff --git a/modules/pubwiseBidAdapter.js b/modules/pubwiseBidAdapter.js
index a1b9ffb56a0..1a3adf12bd8 100644
--- a/modules/pubwiseBidAdapter.js
+++ b/modules/pubwiseBidAdapter.js
@@ -528,8 +528,9 @@ function _cleanSlotName(slotName) {
function _initConf(refererInfo) {
return {
- pageURL: (refererInfo && refererInfo.referer) ? refererInfo.referer : window.location.href,
- refURL: window.document.referrer
+ // TODO: do the fallbacks make sense here?
+ pageURL: refererInfo?.page || window.location.href,
+ refURL: refererInfo?.ref || window.document.referrer
};
}
diff --git a/modules/pulsepointBidAdapter.js b/modules/pulsepointBidAdapter.js
index c0280e944ae..0bff10bc6be 100644
--- a/modules/pulsepointBidAdapter.js
+++ b/modules/pulsepointBidAdapter.js
@@ -1,7 +1,7 @@
/* eslint dot-notation:0, quote-props:0 */
-import { convertTypes, deepAccess, isArray, logError, isFn } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { Renderer } from '../src/Renderer.js';
+import {convertTypes, deepAccess, isArray, isFn, logError} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {Renderer} from '../src/Renderer.js';
const NATIVE_DEFAULTS = {
TITLE_LEN: 100,
@@ -45,7 +45,7 @@ export const spec = {
site: site(bidRequests, bidderRequest),
app: app(bidRequests),
device: device(),
- bcat: bidRequests[0].params.bcat,
+ bcat: deepAccess(bidderRequest.ortb2Imp, 'bcat') || bidRequests[0].params.bcat,
badv: bidRequests[0].params.badv,
user: user(bidRequests[0], bidderRequest),
regs: regs(bidderRequest),
@@ -330,8 +330,9 @@ function site(bidRequests, bidderRequest) {
publisher: {
id: pubId.toString(),
},
- ref: referrer(),
- page: bidderRequest && bidderRequest.refererInfo ? bidderRequest.refererInfo.referer : '',
+ // TODO: does the fallback make sense here?
+ ref: bidderRequest?.refererInfo?.ref || window.document.referrer,
+ page: bidderRequest?.refererInfo?.page || ''
}
}
return null;
@@ -356,17 +357,6 @@ function app(bidderRequest) {
return null;
}
-/**
- * Attempts to capture the referrer url.
- */
-function referrer() {
- try {
- return window.top.document.referrer;
- } catch (e) {
- return document.referrer;
- }
-}
-
/**
* Produces an OpenRTB Device object.
*/
diff --git a/modules/pxyzBidAdapter.js b/modules/pxyzBidAdapter.js
index e144eb84a01..b40e0c79d6b 100644
--- a/modules/pxyzBidAdapter.js
+++ b/modules/pxyzBidAdapter.js
@@ -32,7 +32,7 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidRequests, bidderRequest) {
- const referer = bidderRequest.refererInfo.referer;
+ const referer = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
const parts = referer.split('/');
let protocol, hostname;
diff --git a/modules/quantcastBidAdapter.js b/modules/quantcastBidAdapter.js
index 449c7d12d6f..19a559edfda 100644
--- a/modules/quantcastBidAdapter.js
+++ b/modules/quantcastBidAdapter.js
@@ -4,6 +4,7 @@ import {config} from '../src/config.js';
import {getStorageManager} from '../src/storageManager.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {find} from '../src/polyfill.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'quantcast';
const DEFAULT_BID_FLOOR = 0.0000000001;
@@ -74,21 +75,7 @@ function makeBannerImp(bid) {
};
}
-function getDomain(url) {
- if (!url) {
- return url;
- }
- return url.replace('http://', '').replace('https://', '').replace('www.', '').split(/[/?#]/)[0];
-}
-
-function checkTCFv1(vendorData) {
- let vendorConsent = vendorData.vendorConsents && vendorData.vendorConsents[QUANTCAST_VENDOR_ID];
- let purposeConsent = vendorData.purposeConsents && vendorData.purposeConsents[PURPOSE_DATA_COLLECT];
-
- return !!(vendorConsent && purposeConsent);
-}
-
-function checkTCFv2(tcData) {
+function checkTCF(tcData) {
let restrictions = tcData.publisher ? tcData.publisher.restrictions : {};
let qcRestriction = restrictions && restrictions[PURPOSE_DATA_COLLECT]
? restrictions[PURPOSE_DATA_COLLECT][QUANTCAST_VENDOR_ID]
@@ -144,19 +131,15 @@ export const spec = {
const bids = bidRequests || [];
const gdprConsent = deepAccess(bidderRequest, 'gdprConsent') || {};
const uspConsent = deepAccess(bidderRequest, 'uspConsent');
- const referrer = deepAccess(bidderRequest, 'refererInfo.referer');
- const page = deepAccess(bidderRequest, 'refererInfo.canonicalUrl') || config.getConfig('pageUrl') || deepAccess(window, 'location.href');
- const domain = getDomain(page);
+ const referrer = deepAccess(bidderRequest, 'refererInfo.ref');
+ const page = deepAccess(bidderRequest, 'refererInfo.page') || deepAccess(window, 'location.href');
+ const domain = parseDomain(page, {noLeadingWww: true});
// Check for GDPR consent for purpose 1, and drop request if consent has not been given
// Remaining consent checks are performed server-side.
if (gdprConsent.gdprApplies) {
if (gdprConsent.vendorData) {
- if (gdprConsent.apiVersion === 1 && !checkTCFv1(gdprConsent.vendorData)) {
- logInfo(`${BIDDER_CODE}: No purpose 1 consent for TCF v1`);
- return;
- }
- if (gdprConsent.apiVersion === 2 && !checkTCFv2(gdprConsent.vendorData)) {
+ if (!checkTCF(gdprConsent.vendorData)) {
logInfo(`${BIDDER_CODE}: No purpose 1 consent for TCF v2`);
return;
}
diff --git a/modules/quantcastIdSystem.js b/modules/quantcastIdSystem.js
index 7d82be884da..b803096cd31 100644
--- a/modules/quantcastIdSystem.js
+++ b/modules/quantcastIdSystem.js
@@ -74,13 +74,7 @@ export function hasGDPRConsent(gdprConsent) {
if (!gdprConsent.vendorData) {
return false;
}
- if (gdprConsent.apiVersion === 1) {
- // We are not supporting TCF v1
- return false;
- }
- if (gdprConsent.apiVersion === 2) {
- return checkTCFv2(gdprConsent.vendorData);
- }
+ return checkTCFv2(gdprConsent.vendorData);
}
return true;
}
diff --git a/modules/qwarryBidAdapter.js b/modules/qwarryBidAdapter.js
index c9a86f73910..4b3e8fa8a19 100644
--- a/modules/qwarryBidAdapter.js
+++ b/modules/qwarryBidAdapter.js
@@ -28,7 +28,7 @@ export const spec = {
let payload = {
requestId: bidderRequest.bidderRequestId,
bids,
- referer: bidderRequest.refererInfo.referer,
+ referer: bidderRequest.refererInfo.page,
schain: validBidRequests[0].schain
}
diff --git a/modules/radsBidAdapter.js b/modules/radsBidAdapter.js
index fee5daa3fb4..938fd566159 100644
--- a/modules/radsBidAdapter.js
+++ b/modules/radsBidAdapter.js
@@ -23,7 +23,7 @@ export const spec = {
const placementId = params.placement;
const rnd = Math.floor(Math.random() * 99999999999);
- const referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
+ const referrer = encodeURIComponent(bidderRequest.refererInfo.page);
const bidId = bidRequest.bidId;
const isDev = params.devMode || false;
@@ -184,7 +184,7 @@ function prepareExtraParams(params, payload, bidderRequest, bidRequest) {
}
if (params.bcat !== undefined) {
- payload.bcat = params.bcat;
+ payload.bcat = deepAccess(bidderRequest.ortb2Imp, 'bcat') || params.bcat;
}
if (params.dvt !== undefined) {
payload.dvt = params.dvt;
diff --git a/modules/rakutenBidAdapter/index.js b/modules/rakutenBidAdapter/index.js
index e567509b3c1..27c04029231 100644
--- a/modules/rakutenBidAdapter/index.js
+++ b/modules/rakutenBidAdapter/index.js
@@ -22,8 +22,9 @@ export const spec = {
l: navigator.browserLanguage ||
navigator.language,
d: document.domain,
+ // TODO: what are 'tp' and 'pp'?
tp: bidderRequest.refererInfo.stack[0] || window.location.href,
- pp: bidderRequest.refererInfo.referer,
+ pp: bidderRequest.refererInfo.topmostLocation,
gdpr: ((_a = bidderRequest.gdprConsent) === null || _a === void 0 ? void 0 : _a.gdprApplies) ? 1 : 0,
...((_b = bidderRequest.gdprConsent) === null || _b === void 0 ? void 0 : _b.consentString) && {
cd: bidderRequest.gdprConsent.consentString
diff --git a/modules/rdnBidAdapter.md b/modules/rdnBidAdapter.md
deleted file mode 100644
index 9082c95c520..00000000000
--- a/modules/rdnBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-```
-Module Name: RDN Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: engineer@lob-inc.com
-```
-
-# Description
-
-Connect to RDN for bids.
-
-RDN bid adapter supports Banner currently.
-
-# Test Parameters
-
-```
- var adUnits = [
- {
- code: 'test-ad-div',
- sizes: [[300, 250]],
- mediaTypes: {banner: {}},
- bids: [
- {
- bidder: 'rdn',
- params: {
- adSpotId: '10000'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/readpeakBidAdapter.js b/modules/readpeakBidAdapter.js
index 099e1fb6332..bc03881bed1 100644
--- a/modules/readpeakBidAdapter.js
+++ b/modules/readpeakBidAdapter.js
@@ -1,7 +1,7 @@
-import { logError, replaceAuctionPrice, parseUrl } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { NATIVE, BANNER } from '../src/mediaTypes.js';
+import {logError, replaceAuctionPrice} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {config} from '../src/config.js';
+import {BANNER, NATIVE} from '../src/mediaTypes.js';
export const ENDPOINT = 'https://app.readpeak.com/header/prebid';
@@ -238,12 +238,6 @@ function bannerImpression(slot) {
}
function site(bidRequests, bidderRequest) {
- const url =
- config.getConfig('pageUrl') ||
- (bidderRequest &&
- bidderRequest.refererInfo &&
- bidderRequest.refererInfo.referer);
-
const pubId =
bidRequests && bidRequests.length > 0
? bidRequests[0].params.publisherId
@@ -255,12 +249,11 @@ function site(bidRequests, bidderRequest) {
return {
publisher: {
id: pubId.toString(),
- domain: config.getConfig('publisherDomain')
+ domain: bidderRequest?.refererInfo?.domain,
},
id: siteId ? siteId.toString() : pubId.toString(),
- page: url,
- domain:
- (url && parseUrl(url).hostname) || config.getConfig('publisherDomain')
+ page: bidderRequest?.refererInfo?.page,
+ domain: bidderRequest?.refererInfo?.domain
};
}
return undefined;
diff --git a/modules/reklamstoreBidAdapter.md b/modules/reklamstoreBidAdapter.md
deleted file mode 100644
index 8615341f5cc..00000000000
--- a/modules/reklamstoreBidAdapter.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Overview
-
-Module Name: ReklamStore Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: it@reklamstore.com
-
-# Description
-
-Module that connects to ReklamStore's demand sources.
-
-ReklamStore supports display.
-
-
-# Test Parameters
-# display
-```
-
- var adUnits = [
- {
- code: 'banner-ad-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: 'reklamstore',
- params: {
- regionId:532211
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/relaidoBidAdapter.js b/modules/relaidoBidAdapter.js
index 8312dacbdbb..0b2cdaa711e 100644
--- a/modules/relaidoBidAdapter.js
+++ b/modules/relaidoBidAdapter.js
@@ -101,7 +101,8 @@ function buildRequests(validBidRequests, bidderRequest) {
uuid: getUuid(),
pv: '$prebid.version$',
imuid: imuid,
- ref: bidderRequest.refererInfo.referer
+ // TODO: is 'page' the right value here?
+ ref: bidderRequest.refererInfo.page
})
return {
diff --git a/modules/reloadBidAdapter.md b/modules/reloadBidAdapter.md
deleted file mode 100644
index 42fe11b40b3..00000000000
--- a/modules/reloadBidAdapter.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# Overview
-
-Module Name: Reload Bid Adapter
-
-Module Type: Bidder Adapter
-
-Maintainer: prebid@reload.net
-
-# Description
-
-Prebid module for connecting to Reload
-
-# Parameters
-## Banner
-
-| Name | Scope | Description | Example |
-| :------------ | :------- | :---------------------------------------------- | :--------------------------------- |
-| `plcmID` | required | Placement ID (provided by Reload) | "4234897234" |
-| `partID` | required | Partition ID (provided by Reload) | "part_01" |
-| `opdomID` | required | Internal parameter (provided by Reload) | 0 |
-| `bsrvID` | required | Internal parameter (provided by Reload) | 12 |
-| `type` | optional | Internal parameter (provided by Reload) | "pcm" |
-
-# Example ad units
-# Test Parameters
-```
-var adUnits = [
- // Banner adUnit
- {
- code: 'banner-div',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250]
- ],
- }
- },
- bids: [{
- bidder: 'reload',
- params: {
- plcmID: 'prebid_check',
- partID: 'part_4',
- opdomID: '0',
- bsrvID: 0,
- type: 'pcm'
- }
- }]
- }];
\ No newline at end of file
diff --git a/modules/resetdigitalBidAdapter.js b/modules/resetdigitalBidAdapter.js
index 255ee32629c..3aa06c8a756 100644
--- a/modules/resetdigitalBidAdapter.js
+++ b/modules/resetdigitalBidAdapter.js
@@ -24,9 +24,11 @@ export const spec = {
site: {
domain: getOrigin(),
iframe: !bidderRequest.refererInfo.reachedTop,
+ // TODO: the last element in refererInfo.stack is window.location.href, that's unlikely to have been the intent here
url: stack && stack.length > 0 ? [stack.length - 1] : null,
https: (window.location.protocol === 'https:'),
- referrer: bidderRequest.refererInfo.referer
+ // TODO: is 'page' the right value here?
+ referrer: bidderRequest.refererInfo.page
},
imps: [],
user_ids: validBidRequests[0].userId,
diff --git a/modules/resultsmediaBidAdapter.md b/modules/resultsmediaBidAdapter.md
deleted file mode 100644
index 0b65264c8e4..00000000000
--- a/modules/resultsmediaBidAdapter.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Overview
-
-```
-Module Name: ResultsMedia (resultsmedia.com) Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@resultsmedia.COM
-```
-
-# Description
-
-Prebid adapter for ResultsMedia RTB. Requires approval and account setup.
-
-# Test Parameters
-
-## Web
-```
- var adUnits = [{
- code: 'banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 200] // banner sizes
- ],
- }
- },
- bids: [{
- bidder: 'resultsmedia',
- params: {
- zoneId: 9999
- }
- }]
- }, {
- code: 'video-ad-player',
- mediaTypes: {
- video: {
- context: 'instream', // or 'outstream'
- playerSize: [640, 480] // video player size
- }
- },
- bids: [{
- bidder: 'resultsmedia',
- params: {
- zoneId: 9999
- }
- }]
- }];
-```
\ No newline at end of file
diff --git a/modules/revcontentBidAdapter.js b/modules/revcontentBidAdapter.js
index 0888e5ad1b4..3787c23b8ea 100644
--- a/modules/revcontentBidAdapter.js
+++ b/modules/revcontentBidAdapter.js
@@ -4,6 +4,7 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE } from '../src/mediaTypes.js';
import { triggerPixel, isFn, deepAccess, getAdUnitSizes, parseGPTSingleSizeArrayToRtbSize, _map } from '../src/utils.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'revcontent';
const NATIVE_PARAMS = {
@@ -44,11 +45,11 @@ export const spec = {
let serverRequests = [];
var refererInfo;
if (bidderRequest && bidderRequest.refererInfo) {
- refererInfo = bidderRequest.refererInfo.referer;
+ refererInfo = bidderRequest.refererInfo.page;
}
if (typeof domain === 'undefined') {
- domain = extractHostname(refererInfo);
+ domain = parseDomain(refererInfo, {noPort: true});
}
var endpoint = 'https://' + host + '/rtb?apiKey=' + apiKey + '&userId=' + userId;
@@ -196,23 +197,6 @@ function getTemplate(size, customTemplate) {
return '';
}
-function extractHostname(url) {
- if (typeof url == 'undefined' || url == null) {
- return '';
- }
- var hostname;
- if (url.indexOf('//') > -1) {
- hostname = url.split('/')[2];
- } else {
- hostname = url.split('/')[0];
- }
-
- hostname = hostname.split(':')[0];
- hostname = hostname.split('?')[0];
-
- return hostname;
-}
-
function buildImp(bid, id) {
let bidfloor;
if (isFn(bid.getFloor)) {
diff --git a/modules/rexrtbBidAdapter.md b/modules/rexrtbBidAdapter.md
deleted file mode 100644
index 1cb937b0a3d..00000000000
--- a/modules/rexrtbBidAdapter.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Overview
-
-Module Name: REXRTB Bidder Adapter
-
-Module Type: Bidder Adapter
-
-Maintainer: tech@rexrtb.com
-
-
-# Description
-
-Module that connects to REXRTB's demand source
-
-# Test Parameters
-```javascript
- var adUnits = [
- {
- code: 'test-ad',
- sizes: [[728, 98]],
- bids: [
- {
- bidder: 'rexrtb',
- params: {
- id: 89,
- token: '658f11a5efbbce2f9be3f1f146fcbc22',
- source: 'prebidtest'
- }
- }
- ]
- },
- ];
-```
\ No newline at end of file
diff --git a/modules/rhythmoneBidAdapter.js b/modules/rhythmoneBidAdapter.js
index 9e378f2d2ed..94b3645f57b 100644
--- a/modules/rhythmoneBidAdapter.js
+++ b/modules/rhythmoneBidAdapter.js
@@ -62,25 +62,11 @@ function RhythmOneBidAdapter() {
}
function frameSite(bidderRequest) {
- var site = {
- domain: '',
- page: '',
- ref: ''
- }
- if (bidderRequest && bidderRequest.refererInfo) {
- var ri = bidderRequest.refererInfo;
- site.ref = ri.referer;
-
- if (ri.stack.length) {
- site.page = ri.stack[ri.stack.length - 1];
-
- // clever trick to get the domain
- var el = document.createElement('a');
- el.href = ri.stack[0];
- site.domain = el.hostname;
- }
+ return {
+ domain: bidderRequest?.refererInfo?.domain || '',
+ page: bidderRequest?.refererInfo?.page || '',
+ ref: bidderRequest?.refererInfo?.ref || ''
}
- return site;
}
function frameDevice() {
diff --git a/modules/richaudienceBidAdapter.js b/modules/richaudienceBidAdapter.js
index b49d7c5584c..564b67641a2 100755
--- a/modules/richaudienceBidAdapter.js
+++ b/modules/richaudienceBidAdapter.js
@@ -43,7 +43,8 @@ export const spec = {
bidderRequestId: bid.bidderRequestId,
tagId: bid.adUnitCode,
sizes: raiGetSizes(bid),
- referer: (typeof bidderRequest.refererInfo.referer != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.referer) : null),
+ // TODO: is 'page' the right value here?
+ referer: (typeof bidderRequest.refererInfo.page != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.page) : null),
numIframes: (typeof bidderRequest.refererInfo.numIframes != 'undefined' ? bidderRequest.refererInfo.numIframes : null),
transactionId: bid.transactionId,
timeout: config.getConfig('bidderTimeout'),
@@ -56,7 +57,8 @@ export const spec = {
schain: bid.schain
};
- REFERER = (typeof bidderRequest.refererInfo.referer != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.referer) : null)
+ // TODO: is 'page' the right value here?
+ REFERER = (typeof bidderRequest.refererInfo.page != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.page) : null)
payload.gdpr_consent = '';
payload.gdpr = false;
diff --git a/modules/riseBidAdapter.js b/modules/riseBidAdapter.js
index a8ea023d46a..3a39311a2f1 100644
--- a/modules/riseBidAdapter.js
+++ b/modules/riseBidAdapter.js
@@ -390,7 +390,7 @@ function generateGeneralParams(generalObject, bidderRequest) {
generalParams.userIds = JSON.stringify(userIdsParam);
}
- const ortb2Metadata = config.getConfig('ortb2') || {};
+ const ortb2Metadata = bidderRequest.ortb2 || {};
if (ortb2Metadata.site) {
generalParams.site_metadata = JSON.stringify(ortb2Metadata.site);
}
@@ -423,8 +423,10 @@ function generateGeneralParams(generalObject, bidderRequest) {
}
if (bidderRequest && bidderRequest.refererInfo) {
- generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.referer');
- generalParams.page_url = config.getConfig('pageUrl') || deepAccess(window, 'location.href');
+ // TODO: is 'ref' the right value here?
+ generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.ref');
+ // TODO: does the fallback make sense here?
+ generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || deepAccess(window, 'location.href');
}
return generalParams
diff --git a/modules/rockyouBidAdapter.md b/modules/rockyouBidAdapter.md
deleted file mode 100644
index 1c6d2708b99..00000000000
--- a/modules/rockyouBidAdapter.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Overview
-
-```
-Module Name: RockYou Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid.adapter@rockyou.com
-```
-
-# Description
-
-Connects to the RockYou exchange for bids.
-
-The RockYou bid adapter supports Banner and Video.
-
-For publishers who wish to be set up on the RockYou Ad Network, please contact
-publishers@rockyou.com.
-
-RockYou user syncing requires the `userSync.iframeEnabled` property be set to `true`.
-
-# Test PARAMETERS
-```
-var adUnits = [
-
- // Banner adUnit
- {
- code: 'banner-div',
- mediaTypes: {
- banner: {
- sizes: [[720, 480]]
- }
- },
-
- bids: [{
- bidder: 'rockyou',
- params: {
- placementId: '4954'
- }
- }]
- },
-
- // Video (outstream)
- {
- code: 'video-outstream',
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [720, 480]
- }
- },
- bids: [{
- bidder: 'rockyou',
- params: {
- placementId: '4957'
- }
- }]
- }
-]
-```
diff --git a/modules/rtbdemandBidAdapter.md b/modules/rtbdemandBidAdapter.md
deleted file mode 100644
index 2727d85e084..00000000000
--- a/modules/rtbdemandBidAdapter.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Overview
-
-**Module Name**: Rtbdemand Media fmxSSP Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: rtb@rtbdemand.com
-
-# Description
-
-Connects to Rtbdemand Media fmxSSP demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'banner-ad-div',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'rtbdemand',
- params: {
- zoneid: '9999',
- floor: 0.005,
- server: 'bidding.rtbdemand.com'
- }
- }]
- }];
-
-```
diff --git a/modules/rtbdemandadkBidAdapter.md b/modules/rtbdemandadkBidAdapter.md
deleted file mode 100644
index 96bd3f6c8d7..00000000000
--- a/modules/rtbdemandadkBidAdapter.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# Overview
-
-```
-Module Name: Rtbdemandadk Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: shreyanschopra@rtbdemand.com
-```
-
-# Description
-
-Connects to Rtbdemandadk whitelabel platform.
-Banner and video formats are supported.
-
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'banner-ad-div',
- sizes: [[300, 250]], // banner size
- bids: [
- {
- bidder: 'rtbdemandadk',
- params: {
- zoneId: '30164', //required parameter
- host: 'cpm.metaadserving.com' //required parameter
- }
- }
- ]
- }, {
- code: 'video-ad-player',
- sizes: [640, 480], // video player size
- bids: [
- {
- bidder: 'rtbdemandadk',
- mediaType : 'video',
- params: {
- zoneId: '30164', //required parameter
- host: 'cpm.metaadserving.com' //required parameter
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/rtbhouseBidAdapter.js b/modules/rtbhouseBidAdapter.js
index b8436179a30..f76b5ae18bd 100644
--- a/modules/rtbhouseBidAdapter.js
+++ b/modules/rtbhouseBidAdapter.js
@@ -180,7 +180,7 @@ function mapSite(slot, bidderRequest) {
publisher: {
id: pubId.toString(),
},
- page: bidderRequest.refererInfo.referer,
+ page: bidderRequest.refererInfo.page,
name: getOrigin()
};
if (channel) {
diff --git a/modules/rtbsapeBidAdapter.js b/modules/rtbsapeBidAdapter.js
index d58b3a1f240..cf3d79eb377 100644
--- a/modules/rtbsapeBidAdapter.js
+++ b/modules/rtbsapeBidAdapter.js
@@ -43,7 +43,8 @@ export const spec = {
requestId: bidderRequest.bidderRequestId,
bids: validBidRequests,
timezone: (tz > 0 ? '-' : '+') + padInt(Math.floor(Math.abs(tz) / 60)) + ':' + padInt(Math.abs(tz) % 60),
- refererInfo: bidderRequest.refererInfo
+ // TODO: please do not send internal data structures over the network
+ refererInfo: bidderRequest.refererInfo.legacy
},
}
},
diff --git a/modules/rtbsolutionsBidAdapter.md b/modules/rtbsolutionsBidAdapter.md
deleted file mode 100644
index e671de306a0..00000000000
--- a/modules/rtbsolutionsBidAdapter.md
+++ /dev/null
@@ -1,128 +0,0 @@
-# Overview
-
-Module Name: Rtbsolutions Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: info@rtbsolutions.pro
-
-# Description
-
-You can use this adapter to get a bid from rtbsolutions.
-
-About us: http://rtbsolutions.pro
-
-
-# Test Parameters
-```javascript
- var adUnits = [
- {
- code: '/19968336/header-bid-tag-1',
- mediaTypes: {
- banner: {
- sizes: sizes
- }
- },
- bids: [{
- bidder: 'rtbsolutions',
- params: {
- blockId: 777,
- s1: 'sub_1',
- s2: 'sub_2',
- s3: 'sub_3',
- s4: 'sub_4'
- }
- }]
- }];
-```
-
-Where:
-
-* blockId - Block ID from platform (required)
-* s1..s4 - Sub Id (optional)
-
-# Example page
-
-```html
-
-
-
-
- Prebid
-
-
-
-
-
- Prebid
- Div-1
-
-
-
-
-
-```
diff --git a/modules/rtdModule/index.js b/modules/rtdModule/index.js
index 381059c68f7..eafbe7b472c 100644
--- a/modules/rtdModule/index.js
+++ b/modules/rtdModule/index.js
@@ -152,13 +152,12 @@
*/
import {config} from '../../src/config.js';
-import {module} from '../../src/hook.js';
+import {getHook, module} from '../../src/hook.js';
import {logError, logInfo, logWarn} from '../../src/utils.js';
import * as events from '../../src/events.js';
import CONSTANTS from '../../src/constants.json';
import {gdprDataHandler, uspDataHandler} from '../../src/adapterManager.js';
import {find} from '../../src/polyfill.js';
-import {getGlobal} from '../../src/prebidGlobal.js';
/** @type {string} */
const MODULE_NAME = 'realTimeData';
@@ -229,7 +228,7 @@ export function init(config) {
_moduleConfig = realTimeData;
_dataProviders = realTimeData.dataProviders;
setEventsListeners();
- getGlobal().requestBids.before(setBidRequestsData, 40);
+ getHook('startAuction').before(setBidRequestsData, 20); // RTD should run before FPD
initSubModules();
});
}
diff --git a/modules/rubiconAnalyticsAdapter.js b/modules/rubiconAnalyticsAdapter.js
index 69335ff33a8..ca0d0c1fe65 100644
--- a/modules/rubiconAnalyticsAdapter.js
+++ b/modules/rubiconAnalyticsAdapter.js
@@ -148,7 +148,7 @@ function sendBillingEvent(event) {
function getBasicEventDetails(auctionId, trigger) {
let auctionCache = cache.auctions[auctionId];
- let referrer = config.getConfig('pageUrl') || pageReferer || (auctionCache && auctionCache.referrer);
+ let referrer = pageReferer || (auctionCache && auctionCache.referrer);
let message = {
timestamps: {
prebidLoaded: rubiconAdapter.MODULE_INITIALIZED_TIME,
@@ -676,7 +676,8 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
cacheEntry.bids = {};
cacheEntry.bidsWon = {};
cacheEntry.gamHasRendered = {};
- cacheEntry.referrer = pageReferer = deepAccess(args, 'bidderRequests.0.refererInfo.referer');
+ // TODO: is 'page' the right value here?
+ cacheEntry.referrer = pageReferer = deepAccess(args, 'bidderRequests.0.refererInfo.page');
cacheEntry.bidderOrder = [];
const floorData = deepAccess(args, 'bidderRequests.0.bids.0.floorData');
if (floorData) {
diff --git a/modules/rubiconBidAdapter.js b/modules/rubiconBidAdapter.js
index 48c5ddf813a..c551f8909cf 100644
--- a/modules/rubiconBidAdapter.js
+++ b/modules/rubiconBidAdapter.js
@@ -317,11 +317,6 @@ export const spec = {
applyFPD(bidRequest, VIDEO, data);
- // if storedAuctionResponse has been set, pass SRID
- if (bidRequest.storedAuctionResponse) {
- deepSetValue(data.imp[0], 'ext.prebid.storedauctionresponse.id', bidRequest.storedAuctionResponse.toString());
- }
-
// set ext.prebid.auctiontimestamp using auction time
deepSetValue(data.imp[0], 'ext.prebid.auctiontimestamp', bidderRequest.auctionStart);
@@ -836,11 +831,11 @@ function _getScreenResolution() {
* @returns {string}
*/
function _getPageUrl(bidRequest, bidderRequest) {
- let pageUrl = config.getConfig('pageUrl');
+ let pageUrl;
if (bidRequest.params.referrer) {
pageUrl = bidRequest.params.referrer;
- } else if (!pageUrl) {
- pageUrl = bidderRequest.refererInfo.referer;
+ } else {
+ pageUrl = bidderRequest.refererInfo.page;
}
return bidRequest.params.secure ? pageUrl.replace(/^http:/i, 'https:') : pageUrl;
}
@@ -1014,8 +1009,9 @@ function applyFPD(bidRequest, mediaType, data) {
if (bidRequest.params.keywords) BID_FPD.site.keywords = (isArray(bidRequest.params.keywords)) ? bidRequest.params.keywords.join(',') : bidRequest.params.keywords;
- let fpd = mergeDeep({}, config.getConfig('ortb2') || {}, BID_FPD);
- let impData = deepAccess(bidRequest.ortb2Imp, 'ext.data') || {};
+ let fpd = mergeDeep({}, bidRequest.ortb2 || {}, BID_FPD);
+ let impExt = deepAccess(bidRequest.ortb2Imp, 'ext') || {};
+ let impExtData = deepAccess(bidRequest.ortb2Imp, 'ext.data') || {};
const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.gpid');
const SEGTAX = {user: [4], site: [1, 2, 5, 6]};
@@ -1060,11 +1056,11 @@ function applyFPD(bidRequest, mediaType, data) {
}
});
});
- Object.keys(impData).forEach((key) => {
+ Object.keys(impExtData).forEach((key) => {
if (key !== 'adserver') {
- addBannerData(impData[key], 'site', key);
- } else if (impData[key].name === 'gam') {
- addBannerData(impData[key].adslot, name, key)
+ addBannerData(impExtData[key], 'site', key);
+ } else if (impExtData[key].name === 'gam') {
+ addBannerData(impExtData[key].adslot, name, key)
}
});
@@ -1078,8 +1074,8 @@ function applyFPD(bidRequest, mediaType, data) {
delete data['tg_i.dfp_ad_unit_code'];
}
} else {
- if (Object.keys(impData).length) {
- mergeDeep(data.imp[0].ext, {data: impData});
+ if (Object.keys(impExt).length) {
+ mergeDeep(data.imp[0].ext, impExt);
}
// add in gpid
if (gpid) {
diff --git a/modules/saambaaBidAdapter.js b/modules/saambaaBidAdapter.js
index 36ab50bfddd..5300fe879b0 100644
--- a/modules/saambaaBidAdapter.js
+++ b/modules/saambaaBidAdapter.js
@@ -1,3 +1,5 @@
+// TODO: this adapter appears to have no tests
+
import {deepAccess, generateUUID, isEmpty, isFn, parseSizesInput, parseUrl} from '../src/utils.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
@@ -321,8 +323,7 @@ function createVideoRequestData(bid, bidderRequest) {
}
function getTopWindowLocation(bidderRequest) {
- let url = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
- return parseUrl(config.getConfig('pageUrl') || url, { decodeSearchAsString: true });
+ return parseUrl(bidderRequest?.refererInfo?.page || '', { decodeSearchAsString: true });
}
function createBannerRequestData(bid, bidderRequest) {
diff --git a/modules/saraBidAdapter.md b/modules/saraBidAdapter.md
deleted file mode 100644
index 65572528181..00000000000
--- a/modules/saraBidAdapter.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Overview
-
-Module Name: Sara Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: github@sara.media
-
-# Description
-
-Module that connects to Sara demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "sara",
- params: {
- uid: '5',
- priceType: 'gross' // by default is 'net'
- }
- }
- ]
- },{
- code: 'test-div',
- sizes: [[728, 90]],
- bids: [
- {
- bidder: "sara",
- params: {
- uid: 6,
- priceType: 'gross'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js
index a071cdfea80..98b27de678c 100755
--- a/modules/seedingAllianceBidAdapter.js
+++ b/modules/seedingAllianceBidAdapter.js
@@ -62,7 +62,7 @@ export const spec = {
const pt = setOnAny(validBidRequests, 'params.pt') || setOnAny(validBidRequests, 'params.priceType') || 'net';
const tid = validBidRequests[0].transactionId;
const cur = [config.getConfig('currency.adServerCurrency') || DEFAULT_CUR];
- let url = bidderRequest.refererInfo.referer;
+ let url = bidderRequest.refererInfo.page;
const imp = validBidRequests.map((bid, id) => {
const assets = _map(bid.nativeParams, (bidParams, key) => {
diff --git a/modules/seedtagBidAdapter.js b/modules/seedtagBidAdapter.js
index 2f61e0bc56a..f0f82a002f3 100644
--- a/modules/seedtagBidAdapter.js
+++ b/modules/seedtagBidAdapter.js
@@ -189,7 +189,7 @@ export const spec = {
*/
buildRequests(validBidRequests, bidderRequest) {
const payload = {
- url: bidderRequest.refererInfo.referer,
+ url: bidderRequest.refererInfo.page,
publisherToken: validBidRequests[0].params.publisherId,
cmp: !!bidderRequest.gdprConsent,
timeout: bidderRequest.timeout,
diff --git a/modules/segmentoBidAdapter.md b/modules/segmentoBidAdapter.md
deleted file mode 100644
index e64153195c5..00000000000
--- a/modules/segmentoBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-```
-Module Name: Segmento Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: ssp@segmento.ru
-```
-
-# Description
-
-Module that connects to Segmento's demand sources
-
-# Test Parameters
-```
-var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[240,400],[160,600]],
- }
- },
- bids: [
- {
- bidder: 'segmento',
- params: {
- placementId: -1
- }
- }
- ]
- }
-];
-```
diff --git a/modules/sekindoUMBidAdapter.md b/modules/sekindoUMBidAdapter.md
deleted file mode 100644
index eeffff928eb..00000000000
--- a/modules/sekindoUMBidAdapter.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Overview
-
-**Module Name**: sekindoUM Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: nissime@sekindo.com
-
-# Description
-
-Connects to Sekindo (part of UM) demand source to fetch bids.
-Banner, Outstream and Native formats are supported.
-
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'banner-ad-div',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'sekindoUM',
- params: {
- spaceId: 14071
- width:300, ///optional
- height:250, //optional
- }
- }]
- },
- {
- code: 'video-ad-div',
- sizes: [[640, 480]],
- bids: [{
- bidder: 'sekindoUM',
- params: {
- spaceId: 87812,
- video:{
- playerWidth:640,
- playerHeight:480,
- vid_vastType: 5 //optional
- }
- }
- }]
- }
- ];
-```
diff --git a/modules/sharethroughBidAdapter.js b/modules/sharethroughBidAdapter.js
index 1dd95812e12..16495b647ab 100644
--- a/modules/sharethroughBidAdapter.js
+++ b/modules/sharethroughBidAdapter.js
@@ -23,7 +23,7 @@ export const sharethroughAdapterSpec = {
buildRequests: (bidRequests, bidderRequest) => {
const timeout = config.getConfig('bidderTimeout');
- const firstPartyData = config.getConfig('ortb2') || {};
+ const firstPartyData = bidderRequest.ortb2 || {};
const nonHttp = sharethroughInternal.getProtocol().indexOf('http') < 0;
const secure = nonHttp || (sharethroughInternal.getProtocol().indexOf('https') > -1);
@@ -34,9 +34,10 @@ export const sharethroughAdapterSpec = {
cur: ['USD'],
tmax: timeout,
site: {
- domain: window.location.hostname,
- page: window.location.href,
- ref: deepAccess(bidderRequest, 'refererInfo.referer'),
+ // TODO: do the fallbacks make sense here?
+ domain: deepAccess(bidderRequest, 'refererInfo.domain') || window.location.hostname,
+ page: deepAccess(bidderRequest, 'refererInfo.page') || window.location.href,
+ ref: deepAccess(bidderRequest, 'refererInfo.ref'),
...firstPartyData.site,
},
device: {
@@ -58,7 +59,7 @@ export const sharethroughAdapterSpec = {
schain: bidRequests[0].schain,
},
},
- bcat: bidRequests[0].params.bcat || [],
+ bcat: deepAccess(bidderRequest.ortb2Imp, 'bcat') || bidRequests[0].params.bcat || [],
badv: bidRequests[0].params.badv || [],
test: 0,
};
@@ -245,16 +246,6 @@ function getBidRequestFloor(bid) {
function userIdAsEids(bidRequest) {
const eids = createEidsArray(deepAccess(bidRequest, 'userId')) || [];
-
- const flocData = deepAccess(bidRequest, 'userId.flocId');
- const isFlocIdValid = flocData && flocData.id && flocData.version;
- if (isFlocIdValid) {
- eids.push({
- source: 'chrome.com',
- uids: [{ id: flocData.id, atype: 1, ext: { ver: flocData.version } }],
- });
- }
-
return eids;
}
diff --git a/modules/shinezBidAdapter.md b/modules/shinezBidAdapter.md
deleted file mode 100644
index e040cfbf36b..00000000000
--- a/modules/shinezBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-```
-Module Name: Shinez Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: tech-team@shinez.io
-```
-
-# Description
-
-Connects to shinez.io demand sources.
-
-The Shinez adapter requires setup and approval from the Shinez team.
-Please reach out to tech-team@shinez.io for more information.
-
-# Test Parameters
-
-```javascript
-var adUnits = [{
- code: "test-div",
- mediaTypes: {
- banner: {
- sizes: [[300, 250]]
- }
- },
- bids: [{
- bidder: "shinez",
- params: {
- placementId: "00654321"
- }
- }]
-}];
-```
\ No newline at end of file
diff --git a/modules/showheroes-bsBidAdapter.js b/modules/showheroes-bsBidAdapter.js
index 4c8fb812edc..c1987a32c80 100644
--- a/modules/showheroes-bsBidAdapter.js
+++ b/modules/showheroes-bsBidAdapter.js
@@ -30,7 +30,7 @@ export const spec = {
},
buildRequests: function(validBidRequests, bidderRequest) {
let adUnits = [];
- const pageURL = validBidRequests[0].params.contentPageUrl || bidderRequest.refererInfo.referer;
+ const pageURL = validBidRequests[0].params.contentPageUrl || bidderRequest.refererInfo.page;
const isStage = !!validBidRequests[0].params.stage;
const isOutstream = deepAccess(validBidRequests[0], 'mediaTypes.video.context') === 'outstream';
const isCustomRender = deepAccess(validBidRequests[0], 'params.outstreamOptions.customRender');
diff --git a/modules/sirdataRtdProvider.js b/modules/sirdataRtdProvider.js
index 84943450e3b..532d938375e 100644
--- a/modules/sirdataRtdProvider.js
+++ b/modules/sirdataRtdProvider.js
@@ -6,7 +6,6 @@
* @module modules/sirdataRtdProvider
* @requires module:modules/realTimeData
*/
-import {getGlobal} from '../src/prebidGlobal.js';
import {deepAccess, deepEqual, deepSetValue, isEmpty, logError, mergeDeep} from '../src/utils.js';
import {submodule} from '../src/hook.js';
import {ajax} from '../src/ajax.js';
@@ -19,7 +18,6 @@ const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'SirdataRTDModule';
export function getSegmentsAndCategories(reqBidsConfigObj, onDone, moduleConfig, userConsent) {
- const adUnits = reqBidsConfigObj.adUnits || getGlobal().adUnits;
moduleConfig.params = moduleConfig.params || {};
var tcString = (userConsent && userConsent.gdpr && userConsent.gdpr.consentString ? userConsent.gdpr.consentString : '');
@@ -37,7 +35,7 @@ export function getSegmentsAndCategories(reqBidsConfigObj, onDone, moduleConfig,
sendWithCredentials = false;
gdprApplies = null;
tcString = '';
- } else if (getGlobal().getConfig('consentManagement.gdpr')) {
+ } else if (config.getConfig('consentManagement.gdpr')) {
// Default endpoint is cookieless if gdpr management is set. Needed because the cookie-based endpoint will fail and return error if user is located in Europe and no consent has been given
sirdataDomain = 'cookieless-data.com';
sendWithCredentials = false;
@@ -49,8 +47,8 @@ export function getSegmentsAndCategories(reqBidsConfigObj, onDone, moduleConfig,
sirdataDomain = 'sddan.com';
sendWithCredentials = true;
}
-
- var actualUrl = moduleConfig.params.actualUrl || getRefererInfo().referer;
+ // TODO: is 'page' the right value here?
+ var actualUrl = moduleConfig.params.actualUrl || getRefererInfo().page;
const url = 'https://kvt.' + sirdataDomain + '/api/v1/public/p/' + moduleConfig.params.partnerId + '/d/' + moduleConfig.params.key + '/s?callback=&gdpr=' + gdprApplies + '&gdpr_consent=' + tcString + (actualUrl ? '&url=' + encodeURIComponent(actualUrl) : '');
@@ -61,7 +59,7 @@ export function getSegmentsAndCategories(reqBidsConfigObj, onDone, moduleConfig,
try {
const data = JSON.parse(response);
if (data && data.segments) {
- addSegmentData(adUnits, data, moduleConfig, onDone);
+ addSegmentData(reqBidsConfigObj, data, moduleConfig, onDone);
} else {
onDone();
}
@@ -88,10 +86,10 @@ export function getSegmentsAndCategories(reqBidsConfigObj, onDone, moduleConfig,
});
}
-export function setGlobalOrtb2(segments, categories) {
+export function setGlobalOrtb2(ortb2, segments, categories) {
try {
let addOrtb2 = {};
- let testGlobal = getGlobal().getConfig('ortb2') || {};
+ let testGlobal = ortb2 || {}
if (!deepAccess(testGlobal, 'user.ext.data.sd_rtd') || !deepEqual(testGlobal.user.ext.data.sd_rtd, segments)) {
deepSetValue(addOrtb2, 'user.ext.data.sd_rtd', segments || {});
}
@@ -99,8 +97,7 @@ export function setGlobalOrtb2(segments, categories) {
deepSetValue(addOrtb2, 'site.ext.data.sd_rtd', categories || {});
}
if (!isEmpty(addOrtb2)) {
- let ortb2 = {ortb2: mergeDeep({}, testGlobal, addOrtb2)};
- getGlobal().setConfig(ortb2);
+ mergeDeep(ortb2, addOrtb2);
}
} catch (e) {
logError(e)
@@ -109,10 +106,10 @@ export function setGlobalOrtb2(segments, categories) {
return true;
}
-export function setBidderOrtb2(bidder, segments, categories) {
+export function setBidderOrtb2(bidderOrtb2, bidder, segments, categories) {
try {
let addOrtb2 = {};
- let testBidder = deepAccess(config.getBidderConfig(), bidder + '.ortb2') || {};
+ let testBidder = bidderOrtb2[bidder];
if (!deepAccess(testBidder, 'user.ext.data.sd_rtd') || !deepEqual(testBidder.user.ext.data.sd_rtd, segments)) {
deepSetValue(addOrtb2, 'user.ext.data.sd_rtd', segments || {});
}
@@ -120,8 +117,7 @@ export function setBidderOrtb2(bidder, segments, categories) {
deepSetValue(addOrtb2, 'site.ext.data.sd_rtd', categories || {});
}
if (!isEmpty(addOrtb2)) {
- let ortb2 = {ortb2: mergeDeep({}, testBidder, addOrtb2)};
- getGlobal().setBidderConfig({bidders: [bidder], config: ortb2});
+ mergeDeep(bidderOrtb2[bidder], addOrtb2)
}
} catch (e) {
logError(e)
@@ -172,7 +168,8 @@ export function getSegAndCatsArray(data, minScore) {
return sirdataData;
}
-export function addSegmentData(adUnits, data, moduleConfig, onDone) {
+export function addSegmentData(reqBids, data, moduleConfig, onDone) {
+ const adUnits = reqBids.adUnits;
moduleConfig = moduleConfig || {};
moduleConfig.params = moduleConfig.params || {};
const globalMinScore = moduleConfig.params.hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.contextualMinRelevancyScore : 30;
@@ -187,7 +184,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
// Global ortb2
if (!biddersParamsExist) {
- setGlobalOrtb2(sirdataData.segments, sirdataData.categories);
+ setGlobalOrtb2(reqBids.ortb2Fragments?.global, sirdataData.segments, sirdataData.categories);
}
// Google targeting
@@ -299,13 +296,13 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
case 'ix':
- var ixConfig = getGlobal().getConfig('ix.firstPartyData.sd_rtd');
+ var ixConfig = config.getConfig('ix.firstPartyData.sd_rtd');
if (!ixConfig) {
// For curation index is pid 27248
curationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : '27248');
@@ -327,7 +324,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
ixLength += entry.toString().length;
}
});
- getGlobal().setConfig({ix: {firstPartyData: {sd_rtd: cappIxCategories}}});
+ config.setConfig({ix: {firstPartyData: {sd_rtd: cappIxCategories}}});
}
}
}
@@ -365,7 +362,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
@@ -381,7 +378,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
@@ -398,7 +395,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
@@ -414,7 +411,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
@@ -430,7 +427,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
@@ -446,7 +443,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
@@ -462,7 +459,7 @@ export function addSegmentData(adUnits, data, moduleConfig, onDone) {
if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) {
loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataMergedList, data, bid);
} else {
- setBidderOrtb2(bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
+ setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, data.segments.concat(curationData.segments), sirdataMergedList);
}
}
break;
diff --git a/modules/slimcutBidAdapter.js b/modules/slimcutBidAdapter.js
index 537372e687f..a04a2fda89a 100644
--- a/modules/slimcutBidAdapter.js
+++ b/modules/slimcutBidAdapter.js
@@ -113,8 +113,8 @@ function buildRequestObject(bid) {
}
function getReferrerInfo(bidderRequest) {
let ref = window.location.href;
- if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- ref = bidderRequest.refererInfo.referer;
+ if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ ref = bidderRequest.refererInfo.page;
}
return ref;
}
diff --git a/modules/smaatoBidAdapter.js b/modules/smaatoBidAdapter.js
index b792983534d..a24f296102f 100644
--- a/modules/smaatoBidAdapter.js
+++ b/modules/smaatoBidAdapter.js
@@ -16,9 +16,10 @@ const buildOpenRtbBidRequest = (bidRequest, bidderRequest) => {
tmax: bidderRequest.timeout,
site: {
id: window.location.hostname,
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidderRequest.refererInfo.referer
+ // TODO: do the fallbacks make sense here?
+ domain: bidderRequest.refererInfo.domain || window.location.hostname,
+ page: bidderRequest.refererInfo.page || window.location.href,
+ ref: bidderRequest.refererInfo.ref
},
device: {
language: (navigator && navigator.language) ? navigator.language.split('-')[0] : '',
@@ -44,7 +45,7 @@ const buildOpenRtbBidRequest = (bidRequest, bidderRequest) => {
}
};
- let ortb2 = config.getConfig('ortb2') || {};
+ let ortb2 = bidderRequest.ortb2 || {};
Object.assign(requestTemplate.user, ortb2.user);
Object.assign(requestTemplate.site, ortb2.site);
diff --git a/modules/smartadserverBidAdapter.js b/modules/smartadserverBidAdapter.js
index d6e1c8de452..5d64cad27b5 100644
--- a/modules/smartadserverBidAdapter.js
+++ b/modules/smartadserverBidAdapter.js
@@ -148,7 +148,8 @@ export const spec = {
appname: bid.params.appName && bid.params.appName !== '' ? bid.params.appName : undefined,
ckid: bid.params.ckId || 0,
tagId: bid.adUnitCode,
- pageDomain: bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer ? bidderRequest.refererInfo.referer : undefined,
+ // TODO: is 'page' the right value here?
+ pageDomain: bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page ? bidderRequest.refererInfo.page : undefined,
transactionId: bid.transactionId,
timeout: config.getConfig('bidderTimeout'),
bidId: bid.bidId,
diff --git a/modules/smarthubBidAdapter.js b/modules/smarthubBidAdapter.js
index a94ed972b2e..e15b4c488f4 100644
--- a/modules/smarthubBidAdapter.js
+++ b/modules/smarthubBidAdapter.js
@@ -100,7 +100,7 @@ function buildRequestParams(bidderRequest = {}, placements = []) {
winLocation = window.location;
}
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
+ const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.page;
let refferLocation;
try {
refferLocation = refferUrl && new URL(refferUrl);
diff --git a/modules/smartrtbBidAdapter.md b/modules/smartrtbBidAdapter.md
deleted file mode 100644
index c44903114cf..00000000000
--- a/modules/smartrtbBidAdapter.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Overview
-
-```
-Module Name: Smart RTB (smrtb.com) Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: evanm@smrtb.com
-```
-
-# Description
-
-Prebid adapter for Smart RTB. Requires approval and account setup.
-Video is supported but requires a publisher supplied adunit renderer at this time.
-
-# Test Parameters
-
-## Web
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300,250]]
- },
- video: { /* requires publisher supplied renderer */
- context: 'outstream',
- playerDimension: [640, 480]
- }
- },
- bids: [
- {
- bidder: "smartrtb",
- params: {
- zoneId: "N4zTDq3PPEHBIODv7cXK",
- forceBid: true
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/smartxBidAdapter.js b/modules/smartxBidAdapter.js
index 00c962445d9..5b36e17be11 100644
--- a/modules/smartxBidAdapter.js
+++ b/modules/smartxBidAdapter.js
@@ -67,7 +67,8 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidRequests, bidderRequest) {
- const page = bidderRequest.refererInfo.referer;
+ // TODO: does the fallback make sense here?
+ const page = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
const isPageSecure = !!page.match(/^https:/)
const smartxRequests = bidRequests.map(function (bid) {
diff --git a/modules/smartyadsBidAdapter.js b/modules/smartyadsBidAdapter.js
index b999d02b059..5125eacc716 100644
--- a/modules/smartyadsBidAdapter.js
+++ b/modules/smartyadsBidAdapter.js
@@ -35,8 +35,9 @@ export const spec = {
buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
+ // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
- location = new URL(bidderRequest.refererInfo.referer)
+ location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
diff --git a/modules/smilewantedBidAdapter.js b/modules/smilewantedBidAdapter.js
index 73bd6101670..f82e7c9258f 100644
--- a/modules/smilewantedBidAdapter.js
+++ b/modules/smilewantedBidAdapter.js
@@ -37,6 +37,11 @@ export const spec = {
transactionId: bid.transactionId,
timeout: config.getConfig('bidderTimeout'),
bidId: bid.bidId,
+ /** positionType is undocumented
+ It is unclear what this parameter means.
+ If it means the same as pos in openRTB,
+ It should read from openRTB object
+ or from mediaTypes.banner.pos */
positionType: bid.params.positionType || '',
prebidVersion: '$prebid.version$'
};
@@ -51,7 +56,7 @@ export const spec = {
}
if (bidderRequest && bidderRequest.refererInfo) {
- payload.pageDomain = bidderRequest.refererInfo.referer || '';
+ payload.pageDomain = bidderRequest.refererInfo.page || '';
}
if (bidderRequest && bidderRequest.gdprConsent) {
diff --git a/modules/smmsBidAdapter.md b/modules/smmsBidAdapter.md
deleted file mode 100644
index f1d6e233f96..00000000000
--- a/modules/smmsBidAdapter.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Overview
-
-Module Name: SMMS Bid Adapter
-
-Maintainer: SBBGRP-SSP-PMP@g.softbank.co.jp
-
-# Description
-
-Module that connects to softbank's demand sources
-
-# Test Parameters
-
-```javascript
- var adUnits = [
- {
- code: 'test',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- bids: [
- {
- bidder: 'smms',
- params: {
- placementId: 1440837,
- currency: 'USD'
- }
- }
- ]
- },
- {
- code: 'test',
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 80
- },
- image: {
- required: true,
- sizes: [150, 50]
- },
- sponsoredBy: {
- required: true
- }
- }
- },
- bids: [
- {
- bidder: 'smms',
- params: {
- placementId: 1440838,
- currency: 'USD'
- }
- },
- ],
- }
- ];
-```
diff --git a/modules/somoBidAdapter.md b/modules/somoBidAdapter.md
deleted file mode 100644
index e8457fc0ca2..00000000000
--- a/modules/somoBidAdapter.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Overview
-
-**Module Name**: Somo Audience Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: prebid@somoaudience.com
-# Description
-Connects to Somo Audience demand source.
-Please use ```somo``` as the bidder code.
-
-For video integration, Somo Audience returns content as vastXML and requires the publisher to define the cache url in config passed to Prebid for it to be valid in the auction
-# Test Site Parameters
-```
- var adUnits = [{
- code: 'banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]]
- }
- },
- bids: [{
- bidder: 'somo',
- params: {
- placementId: '22a58cfb0c9b656bff713d1236e930e8'
- }
- }]
- }];
-```
-# Test App Parameters
-```
-var adUnits = [{
- code: 'banner-ad-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]]
- }
- },
- bids: [{
- bidder: 'somo',
- params: {
- placementId: '22a58cfb0c9b656bff713d1236e930e8',
- app: {
- bundle: 'com.somoaudience.apps',
- storeUrl: 'http://somoaudience.com/apps',
- domain: 'somoaudience.com',
- }
- }
- }]
-}];
-```
diff --git a/modules/sonobiBidAdapter.js b/modules/sonobiBidAdapter.js
index c5fc07320d8..b65fde79553 100644
--- a/modules/sonobiBidAdapter.js
+++ b/modules/sonobiBidAdapter.js
@@ -76,7 +76,8 @@ export const spec = {
const payload = {
'key_maker': JSON.stringify(data),
- 'ref': bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ 'ref': bidderRequest.refererInfo.page,
's': generateUUID(),
'pv': PAGEVIEW_ID,
'vp': _getPlatform(),
@@ -86,7 +87,7 @@ export const spec = {
};
- const fpd = config.getConfig('ortb2');
+ const fpd = bidderRequest.ortb2;
if (fpd) {
payload.fpd = JSON.stringify(fpd);
diff --git a/modules/sortableAnalyticsAdapter.js b/modules/sortableAnalyticsAdapter.js
deleted file mode 100644
index 4580ce6dbb8..00000000000
--- a/modules/sortableAnalyticsAdapter.js
+++ /dev/null
@@ -1,535 +0,0 @@
-import { logInfo, getParameterByName, getOldestHighestCpmBid } from '../src/utils.js';
-import adapter from '../src/AnalyticsAdapter.js';
-import CONSTANTS from '../src/constants.json';
-import adapterManager from '../src/adapterManager.js';
-import {ajax} from '../src/ajax.js';
-import {getGlobal} from '../src/prebidGlobal.js';
-import { config } from '../src/config.js';
-import {bidderSettings} from '../src/bidderSettings.js';
-
-const DEFAULT_PROTOCOL = 'https';
-const DEFAULT_HOST = 'pa.deployads.com';
-const DEFAULT_URL = `${DEFAULT_PROTOCOL}://${DEFAULT_HOST}/pae`;
-const ANALYTICS_TYPE = 'endpoint';
-const UTM_STORE_KEY = 'sortable_utm';
-
-export const DEFAULT_PBID_TIMEOUT = 1000;
-export const TIMEOUT_FOR_REGISTRY = 250;
-
-const settings = {};
-const {
- EVENTS: {
- AUCTION_INIT,
- AUCTION_END,
- BID_REQUESTED,
- BID_ADJUSTMENT,
- BID_WON,
- BID_TIMEOUT,
- }
-} = CONSTANTS;
-
-const minsToMillis = mins => mins * 60 * 1000;
-const UTM_TTL = minsToMillis(30);
-
-const SORTABLE_EVENTS = {
- BID_WON: 'pbrw',
- BID_TIMEOUT: 'pbto',
- ERROR: 'pber',
- PB_BID: 'pbid'
-};
-
-const UTM_PARAMS = [
- 'utm_campaign',
- 'utm_source',
- 'utm_medium',
- 'utm_content',
- 'utm_term'
-];
-
-const EVENT_KEYS_SHORT_NAMES = {
- 'auctionId': 'ai',
- 'adUnitCode': 'ac',
- 'adId': 'adi',
- 'bidderAlias': 'bs',
- 'bidFactor': 'bif',
- 'bidId': 'bid',
- 'bidRequestCount': 'brc',
- 'bidderRequestId': 'brid',
- 'bidRequestedSizes': 'rs',
- 'bidTopCpm': 'btcp',
- 'bidTopCpmCurrency': 'btcc',
- 'bidTopIsNetRevenue': 'btin',
- 'bidTopFactor': 'btif',
- 'bidTopSrc': 'btsrc',
- 'cpm': 'c',
- 'currency': 'cc',
- 'dealId': 'did',
- 'isNetRevenue': 'inr',
- 'isTop': 'it',
- 'isWinner': 'iw',
- 'isTimeout': 'ito',
- 'mediaType': 'mt',
- 'reachedTop': 'rtp',
- 'numIframes': 'nif',
- 'size': 'siz',
- 'start': 'st',
- 'tagId': 'tgid',
- 'transactionId': 'trid',
- 'ttl': 'ttl',
- 'ttr': 'ttr',
- 'url': 'u',
- 'utm_campaign': 'uc',
- 'utm_source': 'us',
- 'utm_medium': 'um',
- 'utm_content': 'un',
- 'utm_term': 'ut'
-};
-
-const auctionCache = {};
-
-let bidderFactors = null;
-
-let timeoutId = null;
-let eventsToBeSent = [];
-
-function getStorage() {
- try {
- return window['sessionStorage'];
- } catch (e) {
- return null;
- }
-}
-
-function putParams(k, v) {
- try {
- const storage = getStorage();
- if (!storage) {
- return false;
- }
- if (v === null) {
- storage.removeItem(k);
- } else {
- storage.setItem(k, JSON.stringify(v));
- }
- return true;
- } catch (e) {
- return false;
- }
-}
-
-function getParams(k) {
- try {
- let storage = getStorage();
- if (!storage) {
- return null;
- }
- let value = storage.getItem(k);
- return value === null ? null : JSON.parse(value);
- } catch (e) {
- return null;
- }
-}
-
-function storeParams(key, paramsToSave) {
- if (!settings.disableSessionTracking) {
- for (let property in paramsToSave) {
- if (paramsToSave.hasOwnProperty(property)) {
- putParams(key, paramsToSave);
- break;
- }
- }
- }
-}
-
-function getSiteKey(options) {
- const sortableConfig = config.getConfig('sortable') || {};
- const globalSiteId = sortableConfig.siteId;
- return globalSiteId || options.siteId;
-}
-
-function generateRandomId() {
- let s = (+new Date()).toString(36);
- for (let i = 0; i < 6; ++i) { s += (Math.random() * 36 | 0).toString(36); }
- return s;
-}
-
-function getSessionParams() {
- const stillValid = paramsFromStorage => (paramsFromStorage.created) < (+new Date() + UTM_TTL);
- let sessionParams = null;
- if (!settings.disableSessionTracking) {
- const paramsFromStorage = getParams(UTM_STORE_KEY);
- sessionParams = paramsFromStorage && stillValid(paramsFromStorage) ? paramsFromStorage : null;
- }
- sessionParams = sessionParams || {'created': +new Date(), 'sessionId': generateRandomId()};
- const urlParams = UTM_PARAMS.map(getParameterByName);
- if (UTM_PARAMS.every(key => !sessionParams[key])) {
- UTM_PARAMS.forEach((v, i) => sessionParams[v] = urlParams[i] || sessionParams[v]);
- sessionParams.created = +new Date();
- storeParams(UTM_STORE_KEY, sessionParams);
- }
- return sessionParams;
-}
-
-function getPrebidVersion() {
- return getGlobal().version;
-}
-
-function getFactor(bidder) {
- if (bidder && bidder.bidCpmAdjustment) {
- return bidder.bidCpmAdjustment(1.0);
- } else {
- return null;
- }
-}
-
-function getBiddersFactors() {
- const result = {};
- const settings = bidderSettings.getSettings();
- if (settings) {
- Object.keys(settings).forEach(bidderKey => {
- const bidder = settings[bidderKey];
- const factor = getFactor(bidder);
- if (factor !== null) {
- result[bidderKey] = factor;
- }
- });
- }
- return result;
-}
-
-function getBaseEvent(auctionId, adUnitCode, bidderCode) {
- const event = {};
- event.s = settings.key;
- event.ai = auctionId;
- event.ac = adUnitCode;
- event.bs = bidderCode;
- return event;
-}
-
-function getBidBaseEvent(auctionId, adUnitCode, bidderCode) {
- const sessionParams = getSessionParams();
- const prebidVersion = getPrebidVersion();
- const event = getBaseEvent(auctionId, adUnitCode, bidderCode);
- event.sid = sessionParams.sessionId;
- event.pv = settings.pageviewId;
- event.to = auctionCache[auctionId].timeout;
- event.pbv = prebidVersion;
- UTM_PARAMS.filter(k => sessionParams[k]).forEach(k => event[EVENT_KEYS_SHORT_NAMES[k]] = sessionParams[k]);
- return event;
-}
-
-function createPBBidEvent(bid) {
- const event = getBidBaseEvent(bid.auctionId, bid.adUnitCode, bid.bidderAlias);
- Object.keys(bid).forEach(k => {
- const shortName = EVENT_KEYS_SHORT_NAMES[k];
- if (shortName) {
- event[shortName] = bid[k];
- }
- });
- event._type = SORTABLE_EVENTS.PB_BID;
- return event;
-}
-
-function getBidFactor(bidderAlias) {
- if (!bidderFactors) {
- bidderFactors = getBiddersFactors();
- }
- const factor = bidderFactors[bidderAlias];
- return typeof factor !== 'undefined' ? factor : 1.0;
-}
-
-function createPrebidBidWonEvent({auctionId, adUnitCode, bidderAlias, cpm, currency, isNetRevenue}) {
- const bidFactor = getBidFactor(bidderAlias);
- const event = getBaseEvent(auctionId, adUnitCode, bidderAlias);
- event.bif = bidFactor;
- bidderFactors = null;
- event.c = cpm;
- event.cc = currency;
- event.inr = isNetRevenue;
- event._type = SORTABLE_EVENTS.BID_WON;
- return event;
-}
-
-function createPrebidTimeoutEvent({auctionId, adUnitCode, bidderAlias}) {
- const event = getBaseEvent(auctionId, adUnitCode, bidderAlias);
- event._type = SORTABLE_EVENTS.BID_TIMEOUT;
- return event;
-}
-
-function getDistinct(arr) {
- return arr.filter((v, i, a) => a.indexOf(v) === i);
-}
-
-function groupBy(list, keyGetterFn) {
- const map = {};
- list.forEach(item => {
- const key = keyGetterFn(item);
- map[key] = map[key] ? map[key].concat(item) : [item];
- });
- return map;
-}
-
-function mergeAndCompressEventsByType(events, type) {
- if (!events.length) {
- return {};
- }
- const allKeys = getDistinct(events.map(ev => Object.keys(ev)).reduce((prev, curr) => prev.concat(curr), []));
- const eventsAsMap = {};
- allKeys.forEach(k => {
- events.forEach(ev => eventsAsMap[k] = eventsAsMap[k] ? eventsAsMap[k].concat(ev[k]) : [ev[k]]);
- });
- const allSame = arr => arr.every(el => arr[0] === el);
- Object.keys(eventsAsMap)
- .forEach(k => eventsAsMap[k] = (eventsAsMap[k].length && allSame(eventsAsMap[k])) ? eventsAsMap[k][0] : eventsAsMap[k]);
- eventsAsMap._count = events.length;
- const result = {};
- result[type] = eventsAsMap;
- return result;
-}
-
-function mergeAndCompressEvents(events) {
- const types = getDistinct(events.map(e => e._type));
- const groupedEvents = groupBy(events, e => e._type);
- const results = types.map(t => groupedEvents[t])
- .map(events => mergeAndCompressEventsByType(events, events[0]._type));
- return results.reduce((prev, eventMap) => {
- const key = Object.keys(eventMap)[0];
- prev[key] = eventMap[key];
- return prev;
- }, {});
-}
-
-function registerEvents(events) {
- eventsToBeSent = eventsToBeSent.concat(events);
- if (!timeoutId) {
- timeoutId = setTimeout(() => {
- const _eventsToBeSent = eventsToBeSent.slice();
- eventsToBeSent = [];
- sendEvents(_eventsToBeSent);
- timeoutId = null;
- }, TIMEOUT_FOR_REGISTRY);
- }
-}
-
-function sendEvents(events) {
- const url = settings.url;
- const mergedEvents = mergeAndCompressEvents(events);
- const options = {
- 'contentType': 'text/plain',
- 'method': 'POST',
- 'withCredentials': true
- };
- const onSend = () => logInfo('Sortable Analytics data sent');
- ajax(url, onSend, JSON.stringify(mergedEvents), options);
-}
-
-// converts [[300, 250], [728, 90]] to '300x250,728x90'
-function sizesToString(sizes) {
- return sizes.map(s => s.join('x')).join(',');
-}
-
-function dimsToSizeString(width, height) {
- return `${width}x${height}`;
-}
-
-function handleBidRequested(event) {
- const refererInfo = event.refererInfo;
- const url = refererInfo.referer;
- const reachedTop = refererInfo.reachedTop;
- const numIframes = refererInfo.numIframes;
- event.bids.forEach(bid => {
- const auctionId = bid.auctionId;
- const adUnitCode = bid.adUnitCode;
- const tagId = bid.bidder === 'sortable' ? bid.params.tagId : '';
- if (!auctionCache[auctionId].adUnits[adUnitCode]) {
- auctionCache[auctionId].adUnits[adUnitCode] = {bids: {}};
- }
- const adUnit = auctionCache[auctionId].adUnits[adUnitCode];
- const bids = adUnit.bids;
- const newBid = {
- adUnitCode: bid.adUnitCode,
- auctionId: event.auctionId,
- bidderAlias: bid.bidder,
- bidId: bid.bidId,
- bidderRequestId: bid.bidderRequestId,
- bidRequestCount: bid.bidRequestsCount,
- bidRequestedSizes: sizesToString(bid.sizes),
- currency: bid.currency,
- cpm: 0.0,
- isTimeout: false,
- isTop: false,
- isWinner: false,
- numIframes: numIframes,
- start: event.start,
- tagId: tagId,
- transactionId: bid.transactionId,
- reachedTop: reachedTop,
- url: encodeURI(url)
- };
- bids[newBid.bidderAlias] = newBid;
- });
-}
-
-function handleBidAdjustment(event) {
- const auctionId = event.auctionId;
- const adUnitCode = event.adUnitCode;
- const adUnit = auctionCache[auctionId].adUnits[adUnitCode];
- const bid = adUnit.bids[event.bidderCode];
- const bidFactor = getBidFactor(event.bidderCode);
- bid.adId = event.adId;
- bid.adUnitCode = event.adUnitCode;
- bid.auctionId = event.auctionId;
- bid.bidderAlias = event.bidderCode;
- bid.bidFactor = bidFactor;
- bid.cpm = event.cpm;
- bid.currency = event.currency;
- bid.dealId = event.dealId;
- bid.isNetRevenue = event.netRevenue;
- bid.mediaType = event.mediaType;
- bid.responseTimestamp = event.responseTimestamp;
- bid.size = dimsToSizeString(event.width, event.height);
- bid.ttl = event.ttl;
- bid.ttr = event.timeToRespond;
-}
-
-function handleBidWon(event) {
- const auctionId = event.auctionId;
- const auction = auctionCache[auctionId];
- if (auction) {
- const adUnitCode = event.adUnitCode;
- const adUnit = auction.adUnits[adUnitCode];
- Object.keys(adUnit.bids).forEach(bidderCode => {
- const bidFromUnit = adUnit.bids[bidderCode];
- bidFromUnit.isWinner = event.bidderCode === bidderCode;
- });
- } else {
- const ev = createPrebidBidWonEvent({
- adUnitCode: event.adUnitCode,
- auctionId: event.auctionId,
- bidderAlias: event.bidderCode,
- currency: event.currency,
- cpm: event.cpm,
- isNetRevenue: event.netRevenue,
- });
- registerEvents([ev]);
- }
-}
-
-function handleBidTimeout(event) {
- event.forEach(timeout => {
- const auctionId = timeout.auctionId;
- const adUnitCode = timeout.adUnitCode;
- const bidderAlias = timeout.bidder;
- const auction = auctionCache[auctionId];
- if (auction) {
- const adUnit = auction.adUnits[adUnitCode];
- const bid = adUnit.bids[bidderAlias];
- bid.isTimeout = true;
- } else {
- const prebidTimeoutEvent = createPrebidTimeoutEvent({auctionId, adUnitCode, bidderAlias});
- registerEvents([prebidTimeoutEvent]);
- }
- });
-}
-
-function handleAuctionInit(event) {
- const auctionId = event.auctionId;
- const timeout = event.timeout;
- auctionCache[auctionId] = {timeout: timeout, auctionId: auctionId, adUnits: {}};
-}
-
-function handleAuctionEnd(event) {
- const auction = auctionCache[event.auctionId];
- const adUnits = auction.adUnits;
- setTimeout(() => {
- const events = Object.keys(adUnits).map(adUnitCode => {
- const bidderKeys = Object.keys(auction.adUnits[adUnitCode].bids);
- const bids = bidderKeys.map(bidderCode => auction.adUnits[adUnitCode].bids[bidderCode]);
- const highestBid = bids.length ? bids.reduce(getOldestHighestCpmBid) : null;
- return bidderKeys.map(bidderCode => {
- const bid = auction.adUnits[adUnitCode].bids[bidderCode];
- if (highestBid && highestBid.cpm) {
- bid.isTop = highestBid.bidderAlias === bid.bidderAlias;
- bid.bidTopFactor = getBidFactor(highestBid.bidderAlias);
- bid.bidTopCpm = highestBid.cpm;
- bid.bidTopCpmCurrency = highestBid.currency;
- bid.bidTopIsNetRevenue = highestBid.isNetRevenue;
- bid.bidTopSrc = highestBid.bidderAlias;
- }
- return createPBBidEvent(bid);
- });
- }).reduce((prev, curr) => prev.concat(curr), []);
- bidderFactors = null;
- sendEvents(events);
- delete auctionCache[event.auctionId];
- }, settings.timeoutForPbid);
-}
-
-function handleError(eventType, event, e) {
- const ev = {};
- ev.s = settings.key;
- ev.ti = eventType;
- ev.args = JSON.stringify(event);
- ev.msg = e.message;
- ev._type = SORTABLE_EVENTS.ERROR;
- registerEvents([ev]);
-}
-
-const sortableAnalyticsAdapter = Object.assign(adapter({url: DEFAULT_URL, ANALYTICS_TYPE}), {
- track({eventType, args}) {
- try {
- switch (eventType) {
- case AUCTION_INIT:
- handleAuctionInit(args);
- break;
- case AUCTION_END:
- handleAuctionEnd(args);
- break;
- case BID_REQUESTED:
- handleBidRequested(args);
- break;
- case BID_ADJUSTMENT:
- handleBidAdjustment(args);
- break;
- case BID_WON:
- handleBidWon(args);
- break;
- case BID_TIMEOUT:
- handleBidTimeout(args);
- break;
- }
- } catch (e) {
- handleError(eventType, args, e);
- }
- }
-});
-
-sortableAnalyticsAdapter.originEnableAnalytics = sortableAnalyticsAdapter.enableAnalytics;
-
-sortableAnalyticsAdapter.enableAnalytics = function (setupConfig) {
- if (this.initConfig(setupConfig)) {
- logInfo('Sortable Analytics adapter enabled');
- sortableAnalyticsAdapter.originEnableAnalytics(setupConfig);
- }
-};
-
-sortableAnalyticsAdapter.initConfig = function (setupConfig) {
- settings.disableSessionTracking = setupConfig.disableSessionTracking === undefined ? false : setupConfig.disableSessionTracking;
- settings.key = getSiteKey(setupConfig.options);
- settings.protocol = setupConfig.options.protocol || DEFAULT_PROTOCOL;
- settings.url = `${settings.protocol}://${setupConfig.options.eventHost || DEFAULT_HOST}/pae/${settings.key}`;
- settings.pageviewId = generateRandomId();
- settings.timeoutForPbid = setupConfig.timeoutForPbid ? Math.max(setupConfig.timeoutForPbid, 0) : DEFAULT_PBID_TIMEOUT;
- return !!settings.key;
-};
-
-sortableAnalyticsAdapter.getOptions = function () {
- return settings;
-};
-
-adapterManager.registerAnalyticsAdapter({
- adapter: sortableAnalyticsAdapter,
- code: 'sortable'
-});
-
-export default sortableAnalyticsAdapter;
diff --git a/modules/sortableAnalyticsAdapter.md b/modules/sortableAnalyticsAdapter.md
deleted file mode 100644
index a4aa8019031..00000000000
--- a/modules/sortableAnalyticsAdapter.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Overview
-
-Module Name: Sortable Analytics Adapter
-Module Type: Analytics Adapter
-Maintainer: prebid@sortable.com
-
-# Description
-
-Analytics adapter for Sortable. Contact prebid@sortable.com for information.
diff --git a/modules/sortableBidAdapter.js b/modules/sortableBidAdapter.js
deleted file mode 100644
index 15246a10eab..00000000000
--- a/modules/sortableBidAdapter.js
+++ /dev/null
@@ -1,366 +0,0 @@
-import { _each, logError, isFn, isPlainObject, isNumber, isStr, deepAccess, parseUrl, _map, getUniqueIdentifierStr, createTrackPixelHtml } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
-import { createEidsArray } from './userId/eids.js';
-
-const BIDDER_CODE = 'sortable';
-const SERVER_URL = 'https://c.deployads.com';
-
-function setAssetRequired(native, asset) {
- if (native.required) {
- asset.required = 1;
- }
- return asset;
-}
-
-function buildNativeRequest(nativeMediaType) {
- const assets = [];
- const title = nativeMediaType.title;
- if (title) {
- assets.push(setAssetRequired(title, {
- title: {len: title.len}
- }));
- }
- const img = nativeMediaType.image;
- if (img) {
- assets.push(setAssetRequired(img, {
- img: {
- type: 3, // Main
- wmin: 1,
- hmin: 1
- }
- }));
- }
- const icon = nativeMediaType.icon;
- if (icon) {
- assets.push(setAssetRequired(icon, {
- img: {
- type: 1, // Icon
- wmin: 1,
- hmin: 1
- }
- }));
- }
- const body = nativeMediaType.body;
- if (body) {
- assets.push(setAssetRequired(body, {data: {type: 2}}));
- }
- const cta = nativeMediaType.cta;
- if (cta) {
- assets.push(setAssetRequired(cta, {data: {type: 12}}));
- }
- const sponsoredBy = nativeMediaType.sponsoredBy;
- if (sponsoredBy) {
- assets.push(setAssetRequired(sponsoredBy, {data: {type: 1}}));
- }
-
- _each(assets, (asset, id) => asset.id = id);
- return {
- ver: '1',
- request: JSON.stringify({
- ver: '1',
- assets
- })
- };
-}
-
-function tryParseNativeResponse(adm) {
- let native = null;
- try {
- native = JSON.parse(adm);
- } catch (e) {
- logError('Sortable bid adapter unable to parse native bid response:\n\n' + e);
- }
- return native && native.native;
-}
-
-function createImgObject(img) {
- if (img.w || img.h) {
- return {
- url: img.url,
- width: img.w,
- height: img.h
- };
- } else {
- return img.url;
- }
-}
-
-function interpretNativeResponse(response) {
- const native = {};
- if (response.link) {
- native.clickUrl = response.link.url;
- }
- _each(response.assets, asset => {
- switch (asset.id) {
- case 1:
- native.title = asset.title.text;
- break;
- case 2:
- native.image = createImgObject(asset.img);
- break;
- case 3:
- native.icon = createImgObject(asset.img);
- break;
- case 4:
- native.body = asset.data.value;
- break;
- case 5:
- native.cta = asset.data.value;
- break;
- case 6:
- native.sponsoredBy = asset.data.value;
- break;
- }
- });
- return native;
-}
-
-function transformSyncs(responses, type, syncs) {
- _each(responses, res => {
- if (res.body && res.body.ext && res.body.ext.sync_dsps && res.body.ext.sync_dsps.length) {
- _each(res.body.ext.sync_dsps, sync => {
- if (sync[0] === type && sync[1]) {
- syncs.push({type, url: sync[1]});
- }
- });
- }
- });
-}
-
-function getBidFloor(bid) {
- if (!isFn(bid.getFloor)) {
- return bid.params.floor ? bid.params.floor : null;
- }
-
- // MediaType and Size will automatically get set for us if the bid only has
- // one media type or one size.
- let floor = bid.getFloor({
- currency: 'USD',
- mediaType: '*',
- size: '*'
- });
- if (isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'USD') {
- return floor.floor;
- }
- return null;
-}
-
-export const spec = {
- code: BIDDER_CODE,
- supportedMediaTypes: [BANNER, NATIVE, VIDEO],
-
- isBidRequestValid: function(bid) {
- const sortableConfig = config.getConfig('sortable');
- const haveSiteId = (sortableConfig && !!sortableConfig.siteId) || bid.params.siteId;
- const floor = getBidFloor(bid);
- const validFloor = !floor || isNumber(floor);
- const validKeywords = !bid.params.keywords ||
- (isPlainObject(bid.params.keywords) &&
- Object.keys(bid.params.keywords).every(key =>
- isStr(key) && isStr(bid.params.keywords[key])
- ))
- const isBanner = !bid.mediaTypes || bid.mediaTypes[BANNER] || !(bid.mediaTypes[NATIVE] || bid.mediaTypes[VIDEO]);
- const bannerSizes = isBanner ? deepAccess(bid, `mediaType.${BANNER}.sizes`) || bid.sizes : null;
- return !!(bid.params.tagId && haveSiteId && validFloor && validKeywords && (!isBanner ||
- (bannerSizes && bannerSizes.length > 0 && bannerSizes.every(sizeArr => sizeArr.length == 2 && sizeArr.every(num => isNumber(num))))));
- },
-
- buildRequests: function(validBidReqs, bidderRequest) {
- const sortableConfig = config.getConfig('sortable') || {};
- const globalSiteId = sortableConfig.siteId;
- let loc = parseUrl(bidderRequest.refererInfo.referer);
-
- const sortableImps = _map(validBidReqs, bid => {
- const rv = {
- id: bid.bidId,
- tagid: bid.params.tagId,
- ext: {}
- };
- const bannerMediaType = deepAccess(bid, `mediaTypes.${BANNER}`);
- const nativeMediaType = deepAccess(bid, `mediaTypes.${NATIVE}`);
- const videoMediaType = deepAccess(bid, `mediaTypes.${VIDEO}`);
- if (bannerMediaType || !(nativeMediaType || videoMediaType)) {
- const bannerSizes = (bannerMediaType && bannerMediaType.sizes) || bid.sizes;
- rv.banner = {
- format: _map(bannerSizes, ([width, height]) => ({w: width, h: height}))
- };
- }
- if (nativeMediaType) {
- rv.native = buildNativeRequest(nativeMediaType);
- }
- if (videoMediaType && videoMediaType.context === 'instream') {
- const video = {placement: 1};
- video.mimes = videoMediaType.mimes || [];
- video.minduration = deepAccess(bid, 'params.video.minduration') || 10;
- video.maxduration = deepAccess(bid, 'params.video.maxduration') || 60;
- const startDelay = deepAccess(bid, 'params.video.startdelay');
- if (startDelay != null) {
- video.startdelay = startDelay;
- }
- if (videoMediaType.playerSize && videoMediaType.playerSize.length) {
- const size = videoMediaType.playerSize[0];
- video.w = size[0];
- video.h = size[1];
- }
- if (videoMediaType.api) {
- video.api = videoMediaType.api;
- }
- if (videoMediaType.protocols) {
- video.protocols = videoMediaType.protocols;
- }
- if (videoMediaType.playbackmethod) {
- video.playbackmethod = videoMediaType.playbackmethod;
- }
- rv.video = video;
- }
- const floor = getBidFloor(bid);
- if (floor) {
- rv.floor = floor;
- }
- if (bid.params.keywords) {
- rv.ext.keywords = bid.params.keywords;
- }
- if (bid.params.bidderParams) {
- _each(bid.params.bidderParams, (params, partner) => {
- rv.ext[partner] = params;
- });
- }
- rv.ext.gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
- return rv;
- });
- const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
- const bidUserId = validBidReqs[0].userId;
- const eids = createEidsArray(bidUserId);
- const sortableBidReq = {
- id: getUniqueIdentifierStr(),
- imp: sortableImps,
- source: {
- ext: {
- schain: validBidReqs[0].schain
- }
- },
- regs: {
- ext: {}
- },
- site: {
- domain: loc.hostname,
- page: loc.href,
- ref: loc.href,
- publisher: {
- id: globalSiteId || validBidReqs[0].params.siteId,
- },
- device: {
- w: screen.width,
- h: screen.height
- },
- },
- user: {
- ext: {}
- }
- };
- if (bidderRequest && bidderRequest.timeout > 0) {
- sortableBidReq.tmax = bidderRequest.timeout;
- }
- if (gdprConsent) {
- sortableBidReq.user = {
- ext: {
- consent: gdprConsent.consentString
- }
- };
- if (typeof gdprConsent.gdprApplies == 'boolean') {
- sortableBidReq.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0
- }
- }
- if (eids.length) {
- sortableBidReq.user.ext.eids = eids;
- }
- if (bidderRequest.uspConsent) {
- sortableBidReq.regs.ext.us_privacy = bidderRequest.uspConsent;
- }
- return {
- method: 'POST',
- url: `${SERVER_URL}/openrtb2/auction?src=$$REPO_AND_VERSION$$&host=${loc.hostname}`,
- data: JSON.stringify(sortableBidReq),
- options: {contentType: 'text/plain'}
- };
- },
-
- interpretResponse: function(serverResponse) {
- const { body: {id, seatbid} } = serverResponse;
- const sortableBids = [];
- if (id && seatbid) {
- _each(seatbid, seatbid => {
- _each(seatbid.bid, bid => {
- const bidObj = {
- requestId: bid.impid,
- cpm: parseFloat(bid.price),
- width: parseInt(bid.w),
- height: parseInt(bid.h),
- creativeId: bid.crid || bid.id,
- dealId: bid.dealid || null,
- currency: 'USD',
- netRevenue: true,
- mediaType: BANNER,
- ttl: 60,
- meta: {
- advertiserDomains: bid.adomain || []
- }
- };
- if (bid.adm) {
- const adFormat = deepAccess(bid, 'ext.ad_format')
- if (adFormat === 'native') {
- let native = tryParseNativeResponse(bid.adm);
- if (!native) {
- return;
- }
- bidObj.mediaType = NATIVE;
- bidObj.native = interpretNativeResponse(native);
- } else if (adFormat === 'instream') {
- bidObj.mediaType = VIDEO;
- bidObj.vastXml = bid.adm;
- } else {
- bidObj.mediaType = BANNER;
- bidObj.ad = bid.adm;
- if (bid.nurl) {
- bidObj.ad += createTrackPixelHtml(decodeURIComponent(bid.nurl));
- }
- }
- } else if (bid.nurl) {
- bidObj.adUrl = bid.nurl;
- }
- if (bid.ext) {
- bidObj[BIDDER_CODE] = bid.ext;
- }
- sortableBids.push(bidObj);
- });
- });
- }
- return sortableBids;
- },
-
- getUserSyncs: (syncOptions, responses) => {
- const syncs = [];
- if (syncOptions.iframeEnabled) {
- transformSyncs(responses, 'iframe', syncs);
- }
- if (syncOptions.pixelEnabled) {
- transformSyncs(responses, 'image', syncs);
- }
- return syncs;
- },
-
- onTimeout(details) {
- fetch(`${SERVER_URL}/prebid/timeout`, {
- method: 'POST',
- body: JSON.stringify(details),
- mode: 'no-cors',
- headers: new Headers({
- 'Content-Type': 'text/plain'
- })
- });
- }
-};
-
-registerBidder(spec);
diff --git a/modules/sortableBidAdapter.md b/modules/sortableBidAdapter.md
deleted file mode 100644
index c24ad85b752..00000000000
--- a/modules/sortableBidAdapter.md
+++ /dev/null
@@ -1,109 +0,0 @@
-# Overview
-
-```
-Module Name: Sortable Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@sortable.com
-```
-
-# Description
-
-Sortable's adapter integration to the Prebid library. Posts plain-text JSON to the /openrtb2/auction endpoint.
-
-# Test Parameters
-
-```
-var adUnits = [
- {
- code: 'test-pb-leaderboard',
- mediaTypes: {
- banner: {
- sizes: [[728, 90]],
- }
- },
- bids: [{
- bidder: 'sortable',
- params: {
- tagId: 'test-pb-leaderboard',
- siteId: 'prebid.example.com',
- 'keywords': {
- 'key1': 'val1',
- 'key2': 'val2'
- }
- }
- }]
- }, {
- code: 'test-pb-banner',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [{
- bidder: 'sortable',
- params: {
- tagId: 'test-pb-banner',
- siteId: 'prebid.example.com'
- }
- }]
- }, {
- code: 'test-pb-sidebar',
- mediaTypes: {
- banner: {
- sizes: [[160, 600]],
- }
- },
- bids: [{
- bidder: 'sortable',
- params: {
- tagId: 'test-pb-sidebar',
- siteId: 'prebid.example.com',
- 'keywords': {
- 'keyA': 'valA'
- }
- }
- }]
- }, {
- code: 'test-pb-native',
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 800
- },
- image: {
- required: true,
- sizes: [790, 294],
- },
- sponsoredBy: {
- required: true
- }
- }
- },
- bids: [{
- bidder: 'sortable',
- params: {
- tagId: 'test-pb-native',
- siteId: 'prebid.example.com'
- }
- }]
- }, {
- code: 'test-pb-video',
- mediaTypes: {
- video: {
- playerSize: [640,480],
- context: 'instream'
- }
- },
- bids: [
- {
- bidder: 'sortable',
- params: {
- tagId: 'test-pb-video',
- siteId: 'prebid.example.com'
- }
- }
- ]
- }
-]
-```
diff --git a/modules/sovrnAnalyticsAdapter.js b/modules/sovrnAnalyticsAdapter.js
index 065cfaa58bc..8a5b816ef43 100644
--- a/modules/sovrnAnalyticsAdapter.js
+++ b/modules/sovrnAnalyticsAdapter.js
@@ -5,6 +5,7 @@ import CONSTANTS from '../src/constants.json';
import {ajaxBuilder} from '../src/ajax.js';
import {config} from '../src/config.js';
import {find, includes} from '../src/polyfill.js';
+import {getRefererInfo} from '../src/refererDetection.js';
const ajax = ajaxBuilder(0)
@@ -22,49 +23,11 @@ let pbaUrl = 'https://pba.aws.lijit.com/analytics'
let currentAuctions = {};
const analyticsType = 'endpoint'
-const getClosestTop = () => {
- let topFrame = window;
- let err = false;
- try {
- while (topFrame.parent.document !== topFrame.document) {
- if (topFrame.parent.document) {
- topFrame = topFrame.parent;
- } else {
- throw new Error();
- }
- }
- } catch (e) {
- // bException = true;
- }
-
- return {
- topFrame,
- err
- };
-};
-
-const getBestPageUrl = ({err: crossDomainError, topFrame}) => {
- let sBestPageUrl = '';
-
- if (!crossDomainError) {
- // easy case- we can get top frame location
- sBestPageUrl = topFrame.location.href;
- } else {
- try {
- try {
- sBestPageUrl = window.top.location.href;
- } catch (e) {
- let aOrigins = window.location.ancestorOrigins;
- sBestPageUrl = aOrigins[aOrigins.length - 1];
- }
- } catch (e) {
- sBestPageUrl = topFrame.document.referrer;
- }
- }
-
- return sBestPageUrl;
-};
-const rootURL = getBestPageUrl(getClosestTop())
+const rootURL = (() => {
+ const ref = getRefererInfo();
+ // TODO: does the fallback make sense here?
+ return ref.page || ref.topmostLocation;
+})();
let sovrnAnalyticsAdapter = Object.assign(adapter({url: pbaUrl, analyticsType}), {
track({ eventType, args }) {
diff --git a/modules/sovrnBidAdapter.js b/modules/sovrnBidAdapter.js
index eed9ccb7461..13a866d61f5 100644
--- a/modules/sovrnBidAdapter.js
+++ b/modules/sovrnBidAdapter.js
@@ -1,8 +1,17 @@
-import { _each, getBidIdParameter, isArray, deepClone, parseUrl, getUniqueIdentifierStr, deepSetValue, logError, deepAccess, isInteger, logWarn } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js'
-import { ADPOD, BANNER, VIDEO } from '../src/mediaTypes.js'
-import { createEidsArray } from './userId/eids.js'
-import {config} from '../src/config.js'
+import {
+ _each,
+ deepAccess,
+ deepSetValue,
+ getBidIdParameter,
+ getUniqueIdentifierStr,
+ isArray,
+ isInteger,
+ logError,
+ logWarn
+} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {ADPOD, BANNER, VIDEO} from '../src/mediaTypes.js';
+import {createEidsArray} from './userId/eids.js';
const ORTB_VIDEO_PARAMS = {
'mimes': (value) => Array.isArray(value) && value.length > 0 && value.every(v => typeof v === 'string'),
@@ -135,12 +144,11 @@ export const spec = {
sovrnImps.push(imp)
})
- const fpd = deepClone(config.getConfig('ortb2'))
+ const fpd = bidderRequest.ortb2 || {};
const site = fpd.site || {}
- site.page = bidderRequest.refererInfo.referer
- // clever trick to get the domain
- site.domain = parseUrl(site.page).hostname
+ site.page = bidderRequest.refererInfo.page
+ site.domain = bidderRequest.refererInfo.domain
const sovrnBidReq = {
id: getUniqueIdentifierStr(),
diff --git a/modules/spotxBidAdapter.js b/modules/spotxBidAdapter.js
index 5bea39d95de..86a37e97e2f 100644
--- a/modules/spotxBidAdapter.js
+++ b/modules/spotxBidAdapter.js
@@ -68,7 +68,8 @@ export const spec = {
* @return {ServerRequest} Info describing the request to the server.
*/
buildRequests: function(bidRequests, bidderRequest) {
- const referer = bidderRequest.refererInfo.referer;
+ // TODO: does the fallback make sense here?
+ const referer = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
const isPageSecure = !!referer.match(/^https:/);
const siteId = '';
@@ -76,8 +77,6 @@ export const spec = {
let page;
if (getBidIdParameter('page', bid.params)) {
page = getBidIdParameter('page', bid.params);
- } else if (config.getConfig('pageUrl')) {
- page = config.getConfig('pageUrl');
} else {
page = referer;
}
@@ -194,6 +193,10 @@ export const spec = {
if (getBidIdParameter('position', bid.params) != '') {
spotxReq.video.ext.pos = getBidIdParameter('position', bid.params);
+ } else {
+ if (deepAccess(bid, 'mediaTypes.video.pos')) {
+ spotxReq.video.ext.pos = deepAccess(bid, 'mediaTypes.video.pos');
+ }
}
if (bid.crumbs && bid.crumbs.pubcid) {
diff --git a/modules/sspBCBidAdapter.js b/modules/sspBCBidAdapter.js
index 67f806ff792..89bf4bb331d 100644
--- a/modules/sspBCBidAdapter.js
+++ b/modules/sspBCBidAdapter.js
@@ -1,9 +1,9 @@
-import { deepAccess, isArray, logWarn, parseUrl, getWindowTop } from '../src/utils.js';
-import { ajax } from '../src/ajax.js';
-import { config } from '../src/config.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
-import { includes as strIncludes } from '../src/polyfill.js';
+import {deepAccess, getWindowTop, isArray, logWarn} from '../src/utils.js';
+import {ajax} from '../src/ajax.js';
+import {config} from '../src/config.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
+import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
+import {includes as strIncludes} from '../src/polyfill.js';
const BIDDER_CODE = 'sspBC';
const BIDDER_URL = 'https://ssp.wp.pl/bidder/';
@@ -543,18 +543,12 @@ const spec = {
const siteId = setOnAny(validBidRequests, 'params.siteId');
const publisherId = setOnAny(validBidRequests, 'params.publisherId');
- const page = setOnAny(validBidRequests, 'params.page') || bidderRequest.refererInfo.referer;
- const domain = setOnAny(validBidRequests, 'params.domain') || parseUrl(page).hostname;
+ const page = setOnAny(validBidRequests, 'params.page') || bidderRequest.refererInfo.page;
+ const domain = setOnAny(validBidRequests, 'params.domain') || bidderRequest.refererInfo.domain;
const tmax = setOnAny(validBidRequests, 'params.tmax') ? parseInt(setOnAny(validBidRequests, 'params.tmax'), 10) : TMAX;
const pbver = '$prebid.version$';
const testMode = setOnAny(validBidRequests, 'params.test') ? 1 : undefined;
-
- let ref;
-
- try {
- if (W.self === W.top && document.referrer) { ref = document.referrer; }
- } catch (e) {
- }
+ const ref = bidderRequest.refererInfo.ref;
const payload = {
id: bidderRequest.auctionId,
@@ -718,6 +712,7 @@ const spec = {
},
getUserSyncs(syncOptions, serverResponses, gdprConsent) {
let mySyncs = [];
+ // TODO: the check on CMP api version does not seem to make sense here. It means "always run the usersync unless an old (v1) CMP was detected". No attention is paid to the consent choices.
if (syncOptions.iframeEnabled && consentApiVersion != 1) {
mySyncs.push({
type: 'iframe',
diff --git a/modules/staqAnalyticsAdapter.js b/modules/staqAnalyticsAdapter.js
index 55d9da54656..b9bfe5212c6 100644
--- a/modules/staqAnalyticsAdapter.js
+++ b/modules/staqAnalyticsAdapter.js
@@ -24,9 +24,10 @@ const STAQ_EVENTS = {
}
function buildRequestTemplate(connId) {
- const url = staqAdapterRefWin.referer;
- const ref = staqAdapterRefWin.referer;
- const topLocation = staqAdapterRefWin.referer;
+ // TODO: what should these pick from refererInfo?
+ const url = staqAdapterRefWin.topmostLocation;
+ const ref = staqAdapterRefWin.topmostLocation;
+ const topLocation = staqAdapterRefWin.topmostLocation;
return {
ver: ANALYTICS_VERSION,
diff --git a/modules/stvBidAdapter.md b/modules/stvBidAdapter.md
deleted file mode 100644
index 79e958c3bba..00000000000
--- a/modules/stvBidAdapter.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Overview
-
-```
-Module Name: STV Video Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid@dspx.tv
-```
-
-# Description
-
-STV video adapter for Prebid.js 1.x
-
-# Parameters
-```
- var adUnits = [
- {
- // video settings
- code: 'video-obj',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480]
- }
- },
- bids: [
- {
- bidder: "stv",
- params: {
- placement: "", // placement ID of inventory with STV
- noskip: 1, // 0 or 1
- pfilter: {/*
- min_duration: 10, // min duration
- max_duration: 30, // max duration
- min_bitrate: 300, // min bitrate
- max_bitrate: 1600, // max bitrate
- */}
- }
- }
- ]
- }
- ];
-```
-
diff --git a/modules/sublimeBidAdapter.js b/modules/sublimeBidAdapter.js
index 4dfdd4f3faa..2d177fbe6eb 100644
--- a/modules/sublimeBidAdapter.js
+++ b/modules/sublimeBidAdapter.js
@@ -154,7 +154,8 @@ function buildRequests(validBidRequests, bidderRequest) {
// RefererInfo
if (bidderRequest && bidderRequest.refererInfo) {
- commonPayload.referer = bidderRequest.refererInfo.referer;
+ // TODO: is 'topmostLocation' the right value here?
+ commonPayload.referer = bidderRequest.refererInfo.topmostLocation;
commonPayload.numIframes = bidderRequest.refererInfo.numIframes;
}
// GDPR handling
diff --git a/modules/supply2BidAdapter.md b/modules/supply2BidAdapter.md
deleted file mode 100644
index 3d86f065abf..00000000000
--- a/modules/supply2BidAdapter.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Overview
-
-Module Name: Supply2 Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: vishal@mediadonuts.com
-
-# Description
-
-Module that connects to Media Donuts demand source to fetch bids.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "supply2",
- params: {
- uid: '23',
- priceType: 'gross' // by default is 'net'
- }
- }
- ]
- },{
- code: 'test-div',
- sizes: [[728, 90]],
- bids: [
- {
- bidder: "supply2",
- params: {
- uid: 24,
- priceType: 'gross'
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/synacormediaBidAdapter.js b/modules/synacormediaBidAdapter.js
index 76e33ffbf79..cddd4f0736c 100644
--- a/modules/synacormediaBidAdapter.js
+++ b/modules/synacormediaBidAdapter.js
@@ -38,9 +38,10 @@ export const spec = {
const openRtbBidRequest = {
id: bidderRequest.auctionId,
site: {
- domain: config.getConfig('publisherDomain') || location.hostname,
- page: refererInfo.referer,
- ref: document.referrer
+ // TODO: does the fallback make sense here?
+ domain: refererInfo.domain || location.hostname,
+ page: refererInfo.page,
+ ref: refererInfo.ref
},
device: {
ua: navigator.userAgent
diff --git a/modules/taboolaBidAdapter.js b/modules/taboolaBidAdapter.js
index b6c5ef5d676..7338a26c5ef 100644
--- a/modules/taboolaBidAdapter.js
+++ b/modules/taboolaBidAdapter.js
@@ -3,7 +3,7 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
-import {getWindowSelf, getWindowTop} from '../src/utils.js'
+import {getWindowSelf} from '../src/utils.js'
import {getStorageManager} from '../src/storageManager.js';
const BIDDER_CODE = 'taboola';
@@ -60,28 +60,12 @@ export const userData = {
export const internal = {
getPageUrl: (refererInfo = {}) => {
- if (refererInfo.canonicalUrl) {
- return refererInfo.canonicalUrl;
- }
-
- if (config.getConfig('pageUrl')) {
- return config.getConfig('pageUrl');
- }
-
- try {
- return getWindowTop().location.href;
- } catch (e) {
- return getWindowSelf().location.href;
- }
+ return refererInfo.page || getWindowSelf().location.href;
},
getReferrer: (refererInfo = {}) => {
- if (refererInfo.referer) {
- return refererInfo.referer;
- }
-
- try {
- return getWindowTop().document.referrer;
- } catch (e) {
+ if (refererInfo.ref) {
+ return refererInfo.ref;
+ } else {
return getWindowSelf().document.referrer;
}
}
@@ -126,7 +110,7 @@ export const spec = {
regs.coppa = 1
}
- const ortb2 = config.getConfig('ortb2') || {
+ const ortb2 = bidderRequest.ortb2 || {
badv: [],
bcat: []
};
@@ -176,7 +160,7 @@ function getSiteProperties({publisherId, bcat = []}, refererInfo) {
return {
id: publisherId,
name: publisherId,
- domain: window.location.host,
+ domain: refererInfo?.domain || window.location.host,
page: getPageUrl(refererInfo),
ref: getReferrer(refererInfo),
publisher: {
diff --git a/modules/taphypeBidAdapter.md b/modules/taphypeBidAdapter.md
deleted file mode 100644
index c6ff40a42ba..00000000000
--- a/modules/taphypeBidAdapter.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Overview
-
-Module Name: TapHype Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: admin@taphype.com
-
-# Description
-
-You can use this adapter to get a bid from taphype.com.
-
-
-# Test Parameters
-```javascript
- var adUnits = [
- {
- code: 'div-taphype-example',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "taphype",
- params: {
- placementId: 12345
- }
- }
- ]
- }
- ];
-```
-
-Where:
-
-* placementId - TapHype Placement ID
diff --git a/modules/tappxBidAdapter.js b/modules/tappxBidAdapter.js
index 769e8f73565..fd038f3104e 100644
--- a/modules/tappxBidAdapter.js
+++ b/modules/tappxBidAdapter.js
@@ -5,6 +5,7 @@ import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { config } from '../src/config.js';
import { Renderer } from '../src/Renderer.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'tappx';
const GVLID_CODE = 628;
@@ -555,19 +556,9 @@ export function _checkParamDataType(key, value, datatype) {
}
export function _extractPageUrl(validBidRequests, bidderRequest) {
- let referrer = deepAccess(bidderRequest, 'refererInfo.referer');
- let page = deepAccess(bidderRequest, 'refererInfo.canonicalUrl') || deepAccess(window, 'location.href');
- let paramUrl = deepAccess(validBidRequests, 'params.domainUrl') || config.getConfig('pageUrl');
-
- let domainUrl = referrer || page || paramUrl;
-
- try {
- domainUrl = domainUrl.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img)[0].replace(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?/img, '');
- } catch (error) {
- domainUrl = undefined;
- }
-
- return domainUrl;
+ // TODO: does the fallback make sense?
+ let url = bidderRequest?.refererInfo?.page || bidderRequest.refererInfo?.topmostLocation;
+ return parseDomain(url, {noLeadingWww: true});
}
registerBidder(spec);
diff --git a/modules/teadsBidAdapter.js b/modules/teadsBidAdapter.js
index a8902c896f6..c40f76e743e 100644
--- a/modules/teadsBidAdapter.js
+++ b/modules/teadsBidAdapter.js
@@ -54,7 +54,6 @@ export const spec = {
data: bids,
deviceWidth: screen.width,
hb_version: '$prebid.version$',
- ...getFLoCParameters(deepAccess(validBidRequests, '0.userId.flocId')),
...getUnifiedId2Parameter(deepAccess(validBidRequests, '0.userId.uid2')),
...getFirstPartyTeadsIdParameter()
};
@@ -68,7 +67,7 @@ export const spec = {
let isCmp = typeof gdpr.gdprApplies === 'boolean';
let isConsentString = typeof gdpr.consentString === 'string';
let status = isCmp
- ? findGdprStatus(gdpr.gdprApplies, gdpr.vendorData, gdpr.apiVersion)
+ ? findGdprStatus(gdpr.gdprApplies, gdpr.vendorData)
: gdprStatus.CMP_NOT_FOUND_OR_ERROR;
payload.gdpr_iab = {
consent: isConsentString ? gdpr.consentString : '',
@@ -127,8 +126,8 @@ export const spec = {
function getReferrerInfo(bidderRequest) {
let ref = '';
- if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- ref = bidderRequest.refererInfo.referer;
+ if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ ref = bidderRequest.refererInfo.page;
}
return ref;
}
@@ -166,10 +165,10 @@ function getTimeToFirstByte(win) {
return ttfbWithTimingV1 ? ttfbWithTimingV1.toString() : '';
}
-function findGdprStatus(gdprApplies, gdprData, apiVersion) {
+function findGdprStatus(gdprApplies, gdprData) {
let status = gdprStatus.GDPR_APPLIES_PUBLISHER;
if (gdprApplies) {
- if (isGlobalConsent(gdprData, apiVersion)) {
+ if (gdprData && !gdprData.isServiceSpecific) {
status = gdprStatus.GDPR_APPLIES_GLOBAL;
}
} else {
@@ -178,14 +177,6 @@ function findGdprStatus(gdprApplies, gdprData, apiVersion) {
return status;
}
-function isGlobalConsent(gdprData, apiVersion) {
- return gdprData && apiVersion === 1
- ? (gdprData.hasGlobalScope || gdprData.hasGlobalConsent)
- : gdprData && apiVersion === 2
- ? !gdprData.isServiceSpecific
- : false;
-}
-
function buildRequestObject(bid) {
const reqObj = {};
let placementId = getValue(bid.params, 'placementId');
@@ -237,20 +228,6 @@ function _validateId(id) {
return (parseInt(id) > 0);
}
-/**
- * Get FLoC parameters to be sent in the bid request.
- * @param `{id: string, version: string} | undefined` optionalFlocId FLoC user ID object available if "flocIdSystem" module is enabled.
- * @returns `{} | {cohortId: string} | {cohortVersion: string} | {cohortId: string, cohortVersion: string}`
- */
-function getFLoCParameters(optionalFlocId) {
- if (!optionalFlocId) {
- return {};
- }
- const cohortId = optionalFlocId.id ? { cohortId: optionalFlocId.id } : {};
- const cohortVersion = optionalFlocId.version ? { cohortVersion: optionalFlocId.version } : {};
- return { ...cohortId, ...cohortVersion };
-}
-
/**
* Get unified ID v2 parameter to be sent in bid request.
* @param `{id: string} | undefined` optionalUid2 uid2 user ID object available if "uid2IdSystem" module is enabled.
diff --git a/modules/telariaBidAdapter.js b/modules/telariaBidAdapter.js
index 3132e82b9b2..5fb71d1d627 100644
--- a/modules/telariaBidAdapter.js
+++ b/modules/telariaBidAdapter.js
@@ -247,8 +247,9 @@ function generateUrl(bid, bidderRequest) {
}
}
- if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- url += (`&referrer=${encodeURIComponent(bidderRequest.refererInfo.referer)}`);
+ if (bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ // TODO: is 'page' the right value here?
+ url += (`&referrer=${encodeURIComponent(bidderRequest.refererInfo.page)}`);
}
}
diff --git a/modules/theAdxBidAdapter.js b/modules/theAdxBidAdapter.js
index d7a79fe74d0..92bfb89f5e0 100644
--- a/modules/theAdxBidAdapter.js
+++ b/modules/theAdxBidAdapter.js
@@ -155,7 +155,8 @@ export const spec = {
withCredentials: true,
},
bidder: 'theadx',
- referrer: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: is 'page' the right value here?
+ referrer: encodeURIComponent(bidderRequest.refererInfo.page || ''),
data: generatePayload(bidRequest, bidderRequest),
mediaTypes: bidRequest['mediaTypes'],
requestId: bidderRequest.bidderRequestId,
@@ -314,7 +315,7 @@ export const spec = {
}
let buildSiteComponent = (bidRequest, bidderRequest) => {
- let loc = parseUrl(bidderRequest.refererInfo.referer, {
+ let loc = parseUrl(bidderRequest.refererInfo.page || '', {
decodeSearchAsString: true
});
diff --git a/modules/timBidAdapter.md b/modules/timBidAdapter.md
deleted file mode 100644
index 684f2e5f7c4..00000000000
--- a/modules/timBidAdapter.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Overview
-
-```
-Module Name: tim Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: boris@thetimmedia.com
-```
-
-# Description
-
-Module that connects to tim's demand sources
-
-# Test Parameters
-```
- var adUnits = [{
- "code":"99",
- "sizes":[[300,250]],
- "bids":[{"bidder":"tim",
- "params":{
- "placementCode":"testPlacementCode",
- "publisherid":"testpublisherid"
- }
- }]
- }]
-```
-
diff --git a/modules/topRTBBidAdapter.md b/modules/topRTBBidAdapter.md
deleted file mode 100644
index d1930c928e4..00000000000
--- a/modules/topRTBBidAdapter.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Overview
-
-```
-Module Name: topRTB Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: karthikeyan.d@djaxtech.com
-```
-
-# Description
-
-topRTB Bidder Adapter for Prebid.js.
-Only Banner & video format is supported.
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div-0',
- sizes: [[728, 90]], // a display size
- bids: [
- {
- bidder: 'topRTB',
- params: {
- adUnitId: 'c5c06f77430c4c33814a0577cb4cc978'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/tpmnBidAdapter.js b/modules/tpmnBidAdapter.js
index 88e89bcd64b..8687ab06f4c 100644
--- a/modules/tpmnBidAdapter.js
+++ b/modules/tpmnBidAdapter.js
@@ -116,13 +116,13 @@ registerBidder(spec);
* Creates site description object
*/
function createSite(refInfo) {
- let url = parseUrl(refInfo.referer);
+ let url = parseUrl(refInfo.page || '');
let site = {
'domain': url.hostname,
'page': url.protocol + '://' + url.hostname + url.pathname
};
- if (self === top && document.referrer) {
- site.ref = document.referrer;
+ if (refInfo.ref) {
+ site.ref = refInfo.ref
}
let keywords = document.getElementsByTagName('meta')['keywords'];
if (keywords && keywords.content) {
diff --git a/modules/trafficrootsBidAdapter.md b/modules/trafficrootsBidAdapter.md
deleted file mode 100644
index 2aceb0c866b..00000000000
--- a/modules/trafficrootsBidAdapter.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Overview
-
-Module Name: Trafficroots Bid Adapter
-
-Module Type: Bidder Adapter
-
-Maintainer: cary@trafficroots.com
-
-# Description
-
-Module that connects to Trafficroots demand sources
-
-# Test Parameters
-```javascript
-
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250],[300,600]], // a display size
- bids: [
- {
- bidder: 'trafficroots',
- params: {
- zoneId: 'aa0444af31',
- deliveryUrl: location.protocol + '//service.trafficroots.com/prebid'
- }
- },{
- bidder: 'trafficroots',
- params: {
- zoneId: '8f527a4835',
- deliveryUrl: location.protocol + '//service.trafficroots.com/prebid'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/trendqubeBidAdapter.md b/modules/trendqubeBidAdapter.md
deleted file mode 100644
index 8b72c225575..00000000000
--- a/modules/trendqubeBidAdapter.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Overview
-
-```
-Module Name: trendqube Bidder Adapter
-Module Type: trendqube Bidder Adapter
-```
-
-# Description
-
-Module that connects to trendqube demand sources
-
-# Test Parameters
-```
- var adUnits = [
- // Will return static test banner
- {
- code: 'placementId_0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [
- {
- bidder: 'trendqube',
- params: {
- placementId: 0,
- traffic: 'banner'
- }
- }
- ]
- },
- // Will return test vast xml. All video params are stored under placement in publishers UI
- {
- code: 'placementId_0',
- mediaTypes: {
- video: {
- playerSize: [640, 480],
- context: 'instream'
- }
- },
- bids: [
- {
- bidder: 'trendqube',
- params: {
- placementId: 0,
- traffic: 'video'
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/tribeosBidAdapter.md b/modules/tribeosBidAdapter.md
deleted file mode 100644
index 670810abec9..00000000000
--- a/modules/tribeosBidAdapter.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Overview
-
-```
-Module Name: tribeOS Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: dev@tribeos.io
-```
-
-# Description
-
-tribeOS adapter
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'test-tribeos',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250]
- ],
- }
- },
- bids: [{
- bidder: "tribeos",
- params: {
- placementId: '12345' // REQUIRED
- }
- }]
- }];
-```
diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js
index 7e964661db6..e9e6e5d2a63 100644
--- a/modules/tripleliftBidAdapter.js
+++ b/modules/tripleliftBidAdapter.js
@@ -21,13 +21,13 @@ export const tripleliftAdapterSpec = {
buildRequests: function(bidRequests, bidderRequest) {
let tlCall = STR_ENDPOINT;
- let data = _buildPostBody(bidRequests);
+ let data = _buildPostBody(bidRequests, bidderRequest);
tlCall = tryAppendQueryString(tlCall, 'lib', 'prebid');
tlCall = tryAppendQueryString(tlCall, 'v', '$prebid.version$');
if (bidderRequest && bidderRequest.refererInfo) {
- let referrer = bidderRequest.refererInfo.referer;
+ let referrer = bidderRequest.refererInfo.page;
tlCall = tryAppendQueryString(tlCall, 'referrer', referrer);
}
@@ -107,10 +107,10 @@ function _getSyncType(syncOptions) {
if (syncOptions.pixelEnabled) return 'image';
}
-function _buildPostBody(bidRequests) {
+function _buildPostBody(bidRequests, bidderRequest) {
let data = {};
let { schain } = bidRequests[0];
- const globalFpd = _getGlobalFpd();
+ const globalFpd = _getGlobalFpd(bidderRequest);
data.imp = bidRequests.map(function(bidRequest, index) {
let imp = {
@@ -192,11 +192,11 @@ function _getFloor (bid) {
return floor !== null ? floor : bid.params.floor;
}
-function _getGlobalFpd() {
+function _getGlobalFpd(bidderRequest) {
const fpd = {};
const context = {}
const user = {};
- const ortbData = config.getConfig('ortb2') || {};
+ const ortbData = bidderRequest.ortb2 || {};
const fpdContext = Object.assign({}, ortbData.site);
const fpdUser = Object.assign({}, ortbData.user);
diff --git a/modules/trustxBidAdapter.js b/modules/trustxBidAdapter.js
deleted file mode 100644
index 7d40a0b0452..00000000000
--- a/modules/trustxBidAdapter.js
+++ /dev/null
@@ -1,532 +0,0 @@
-import {isEmpty, deepAccess, logError, logWarn, parseGPTSingleSizeArrayToRtbSize, mergeDeep} from '../src/utils.js';
-import {registerBidder} from '../src/adapters/bidderFactory.js';
-import { Renderer } from '../src/Renderer.js';
-import { VIDEO, BANNER } from '../src/mediaTypes.js';
-import { config } from '../src/config.js';
-
-const BIDDER_CODE = 'trustx';
-const ENDPOINT_URL = 'https://grid.bidswitch.net/hbjson?sp=trustx';
-const TIME_TO_LIVE = 360;
-const ADAPTER_SYNC_URL = 'https://x.bidswitch.net/sync?ssp=themediagrid';
-const RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';
-
-const LOG_ERROR_MESS = {
- noAuid: 'Bid from response has no auid parameter - ',
- noAdm: 'Bid from response has no adm parameter - ',
- noBid: 'Array of bid objects is empty',
- noPlacementCode: 'Can\'t find in requested bids the bid with auid - ',
- emptyUids: 'Uids should be not empty',
- emptySeatbid: 'Seatbid array from response has empty item',
- emptyResponse: 'Response is empty',
- hasEmptySeatbidArray: 'Response has empty seatbid array',
- hasNoArrayOfBids: 'Seatbid from response has no array of bid objects - '
-};
-
-export const spec = {
- code: BIDDER_CODE,
- 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.uid;
- },
- /**
- * Make a server request from the list of BidRequests.
- *
- * @param {BidRequest[]} validBidRequests - an array of bids
- * @param {bidderRequest} bidderRequest bidder request object
- * @return ServerRequest Info describing the request to the server.
- */
- buildRequests: function(validBidRequests, bidderRequest) {
- if (!validBidRequests.length) {
- return null;
- }
- let pageKeywords = null;
- let jwpseg = null;
- let permutiveseg = null;
- let content = null;
- let schain = null;
- let userId = null;
- let userIdAsEids = null;
- let user = null;
- let userExt = null;
- let {bidderRequestId, auctionId, gdprConsent, uspConsent, timeout, refererInfo} = bidderRequest || {};
-
- const referer = refererInfo ? encodeURIComponent(refererInfo.referer) : '';
- const imp = [];
- const bidsMap = {};
-
- validBidRequests.forEach((bid) => {
- if (!bidderRequestId) {
- bidderRequestId = bid.bidderRequestId;
- }
- if (!auctionId) {
- auctionId = bid.auctionId;
- }
- if (!schain) {
- schain = bid.schain;
- }
- if (!userId) {
- userId = bid.userId;
- }
- if (!userIdAsEids) {
- userIdAsEids = bid.userIdAsEids;
- }
- const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp} = bid;
- bidsMap[bidId] = bid;
- const bidFloor = _getFloor(mediaTypes || {}, bid);
- if (rtd) {
- const jwTargeting = rtd.jwplayer && rtd.jwplayer.targeting;
- if (jwTargeting) {
- if (!jwpseg && jwTargeting.segments) {
- jwpseg = jwTargeting.segments;
- }
- if (!content && jwTargeting.content) {
- content = jwTargeting.content;
- }
- }
- const permutiveTargeting = rtd.p_standard && rtd.p_standard.targeting;
- if (!permutiveseg && permutiveTargeting && permutiveTargeting.segments) {
- permutiveseg = permutiveTargeting.segments;
- }
- }
- let impObj = {
- id: bidId && bidId.toString(),
- tagid: uid.toString(),
- ext: {
- divid: adUnitCode && adUnitCode.toString()
- }
- };
-
- if (ortb2Imp) {
- if (ortb2Imp.instl) {
- impObj.instl = ortb2Imp.instl;
- }
- if (ortb2Imp.ext && ortb2Imp.ext.data) {
- impObj.ext.data = ortb2Imp.ext.data;
- if (impObj.ext.data.adserver && impObj.ext.data.adserver.adslot) {
- impObj.ext.gpid = impObj.ext.data.adserver.adslot.toString();
- } else {
- impObj.ext.gpid = ortb2Imp.ext.data.pbadslot && ortb2Imp.ext.data.pbadslot.toString();
- }
- }
- }
-
- if (!isEmpty(keywords)) {
- if (!pageKeywords) {
- pageKeywords = keywords;
- }
- impObj.ext.bidder = { keywords };
- }
-
- if (bidFloor) {
- impObj.bidfloor = bidFloor;
- }
-
- if (!mediaTypes || mediaTypes[BANNER]) {
- const banner = createBannerRequest(bid, mediaTypes ? mediaTypes[BANNER] : {});
- if (banner) {
- impObj.banner = banner;
- }
- }
- if (mediaTypes && mediaTypes[VIDEO]) {
- const video = createVideoRequest(bid, mediaTypes[VIDEO]);
- if (video) {
- impObj.video = video;
- }
- }
-
- if (impObj.banner || impObj.video) {
- imp.push(impObj);
- }
- });
-
- const source = {
- tid: auctionId && auctionId.toString(),
- ext: {
- wrapper: 'Prebid_js',
- wrapper_version: '$prebid.version$'
- }
- };
-
- if (schain) {
- source.ext.schain = schain;
- }
-
- const bidderTimeout = config.getConfig('bidderTimeout') || timeout;
- const tmax = timeout ? Math.min(bidderTimeout, timeout) : bidderTimeout;
-
- let request = {
- id: bidderRequestId && bidderRequestId.toString(),
- site: {
- page: referer
- },
- tmax,
- source,
- imp
- };
-
- if (content) {
- request.site.content = content;
- }
-
- if (jwpseg && jwpseg.length) {
- user = {
- data: [{
- name: 'iow_labs_pub_data',
- segment: segmentProcessing(jwpseg, 'jwpseg'),
- }]
- };
- }
-
- const ortb2UserData = config.getConfig('ortb2.user.data');
- if (ortb2UserData && ortb2UserData.length) {
- if (!user) {
- user = { data: [] };
- }
- user = mergeDeep(user, {
- data: [...ortb2UserData]
- });
- }
-
- if (gdprConsent && gdprConsent.consentString) {
- userExt = {consent: gdprConsent.consentString};
- }
-
- if (userIdAsEids && userIdAsEids.length) {
- userExt = userExt || {};
- userExt.eids = [...userIdAsEids];
- }
-
- if (userExt && Object.keys(userExt).length) {
- user = user || {};
- user.ext = userExt;
- }
-
- if (user) {
- request.user = user;
- }
-
- const userKeywords = deepAccess(config.getConfig('ortb2.user'), 'keywords') || null;
- const siteKeywords = deepAccess(config.getConfig('ortb2.site'), 'keywords') || null;
-
- if (userKeywords) {
- pageKeywords = pageKeywords || {};
- pageKeywords.user = pageKeywords.user || {};
- pageKeywords.user.ortb2 = [
- {
- name: 'keywords',
- keywords: userKeywords.split(','),
- }
- ];
- }
- if (siteKeywords) {
- pageKeywords = pageKeywords || {};
- pageKeywords.site = pageKeywords.site || {};
- pageKeywords.site.ortb2 = [
- {
- name: 'keywords',
- keywords: siteKeywords.split(','),
- }
- ];
- }
-
- if (pageKeywords) {
- pageKeywords = reformatKeywords(pageKeywords);
- if (pageKeywords) {
- request.ext = {
- keywords: pageKeywords
- };
- }
- }
-
- if (gdprConsent && gdprConsent.gdprApplies) {
- request.regs = {
- ext: {
- gdpr: gdprConsent.gdprApplies ? 1 : 0
- }
- }
- }
-
- if (uspConsent) {
- if (!request.regs) {
- request.regs = {ext: {}};
- }
- request.regs.ext.us_privacy = uspConsent;
- }
-
- return {
- method: 'POST',
- url: ENDPOINT_URL,
- data: JSON.stringify(request),
- bidsMap
- };
- },
- /**
- * Unpack the response from the server into a list of bids.
- *
- * @param {*} serverResponse A successful response from the server.
- * @param {*} bidRequest
- * @param {*} RendererConst
- * @return {Bid[]} An array of bids which were nested inside the server.
- */
- interpretResponse: function(serverResponse, bidRequest, RendererConst = Renderer) {
- serverResponse = serverResponse && serverResponse.body;
- const bidResponses = [];
-
- let errorMessage;
-
- if (!serverResponse) errorMessage = LOG_ERROR_MESS.emptyResponse;
- else if (serverResponse.seatbid && !serverResponse.seatbid.length) {
- errorMessage = LOG_ERROR_MESS.hasEmptySeatbidArray;
- }
-
- if (!errorMessage && serverResponse.seatbid) {
- serverResponse.seatbid.forEach(respItem => {
- _addBidResponse(_getBidFromResponse(respItem), bidRequest, bidResponses, RendererConst);
- });
- }
- if (errorMessage) logError(errorMessage);
- return bidResponses;
- },
- getUserSyncs: function(syncOptions, responses, gdprConsent, uspConsent) {
- if (syncOptions.pixelEnabled) {
- let params = [];
- if (gdprConsent) {
- if (typeof gdprConsent.gdprApplies === 'boolean') {
- params.push(`gdpr=${Number(gdprConsent.gdprApplies)}`);
- }
- if (typeof gdprConsent.consentString === 'string') {
- params.push(`gdpr_consent=${gdprConsent.consentString}`);
- }
- }
- if (uspConsent) {
- params.push(`us_privacy=${uspConsent}`);
- }
- const stringParams = params.join('&');
- return {
- type: 'image',
- url: ADAPTER_SYNC_URL + stringParams
- };
- }
- }
-}
-
-function _getBidFromResponse(respItem) {
- if (!respItem) {
- logError(LOG_ERROR_MESS.emptySeatbid);
- } else if (!respItem.bid) {
- logError(LOG_ERROR_MESS.hasNoArrayOfBids + JSON.stringify(respItem));
- } else if (!respItem.bid[0]) {
- logError(LOG_ERROR_MESS.noBid);
- }
- return respItem && respItem.bid && respItem.bid[0];
-}
-
-function _addBidResponse(serverBid, bidRequest, bidResponses, RendererConst) {
- if (!serverBid) return;
- let errorMessage;
- if (!serverBid.auid) errorMessage = LOG_ERROR_MESS.noAuid + JSON.stringify(serverBid);
- if (!serverBid.adm && !serverBid.nurl) errorMessage = LOG_ERROR_MESS.noAdm + JSON.stringify(serverBid);
- else {
- const { bidsMap } = bidRequest;
- const bid = bidsMap[serverBid.impid];
-
- if (!errorMessage && bid) {
- const bidResponse = {
- requestId: bid.bidId, // bid.bidderRequestId,
- cpm: serverBid.price,
- width: serverBid.w,
- height: serverBid.h,
- creativeId: serverBid.auid, // bid.bidId,
- currency: 'USD',
- netRevenue: false,
- ttl: TIME_TO_LIVE,
- dealId: serverBid.dealid,
- meta: {
- advertiserDomains: serverBid.adomain ? serverBid.adomain : []
- },
- };
- if (serverBid.content_type === 'video') {
- if (serverBid.adm) {
- bidResponse.vastXml = serverBid.adm;
- bidResponse.adResponse = {
- content: bidResponse.vastXml
- };
- } else if (serverBid.nurl) {
- bidResponse.vastUrl = serverBid.nurl;
- }
- bidResponse.mediaType = VIDEO;
- if (!bid.renderer && (!bid.mediaTypes || !bid.mediaTypes.video || bid.mediaTypes.video.context === 'outstream')) {
- bidResponse.renderer = createRenderer(bidResponse, {
- id: bid.bidId,
- url: RENDERER_URL
- }, RendererConst);
- }
- } else {
- bidResponse.ad = serverBid.adm;
- bidResponse.mediaType = BANNER;
- }
-
- bidResponses.push(bidResponse);
- }
- }
- if (errorMessage) {
- logError(errorMessage);
- }
-}
-
-function outstreamRender (bid) {
- bid.renderer.push(() => {
- window.ANOutstreamVideo.renderAd({
- targetId: bid.adUnitCode,
- adResponse: bid.adResponse
- });
- });
-}
-
-function createRenderer (bid, rendererParams, RendererConst) {
- const rendererInst = RendererConst.install({
- id: rendererParams.id,
- url: rendererParams.url,
- loaded: false
- });
-
- try {
- rendererInst.setRender(outstreamRender);
- } catch (err) {
- logWarn('Prebid Error calling setRender on renderer', err);
- }
-
- return rendererInst;
-}
-
-function createVideoRequest(bid, mediaType) {
- const {playerSize, mimes, durationRangeSec, protocols} = mediaType;
- const size = (playerSize || bid.sizes || [])[0];
- if (!size) return;
-
- let result = parseGPTSingleSizeArrayToRtbSize(size);
-
- if (mimes) {
- result.mimes = mimes;
- }
-
- if (durationRangeSec && durationRangeSec.length === 2) {
- result.minduration = durationRangeSec[0];
- result.maxduration = durationRangeSec[1];
- }
-
- if (protocols && protocols.length) {
- result.protocols = protocols;
- }
-
- return result;
-}
-
-function createBannerRequest(bid, mediaType) {
- const sizes = mediaType.sizes || bid.sizes;
- if (!sizes || !sizes.length) return;
-
- let format = sizes.map((size) => parseGPTSingleSizeArrayToRtbSize(size));
- let result = parseGPTSingleSizeArrayToRtbSize(sizes[0]);
-
- if (format.length) {
- result.format = format
- }
- return result;
-}
-
-function segmentProcessing(segment, forceSegName) {
- return segment
- .map((seg) => {
- const value = seg && (seg.value || seg.id || seg);
- if (typeof value === 'string' || typeof value === 'number') {
- return {
- value: value.toString(),
- ...(forceSegName && { name: forceSegName }),
- ...(seg.name && { name: seg.name }),
- };
- }
- return null;
- })
- .filter((seg) => !!seg);
-}
-
-function reformatKeywords(pageKeywords) {
- const formatedPageKeywords = {};
- Object.keys(pageKeywords).forEach((name) => {
- const keywords = pageKeywords[name];
- if (keywords) {
- if (name === 'site' || name === 'user') {
- const formatedKeywords = {};
- Object.keys(keywords).forEach((pubName) => {
- if (Array.isArray(keywords[pubName])) {
- const formatedPublisher = [];
- keywords[pubName].forEach((pubItem) => {
- if (typeof pubItem === 'object' && pubItem.name) {
- const formatedPubItem = { name: pubItem.name, segments: [] };
- Object.keys(pubItem).forEach((key) => {
- if (Array.isArray(pubItem[key])) {
- pubItem[key].forEach((keyword) => {
- if (keyword) {
- if (typeof keyword === 'string') {
- formatedPubItem.segments.push({ name: key, value: keyword });
- } else if (key === 'segments' && typeof keyword.name === 'string' && typeof keyword.value === 'string') {
- formatedPubItem.segments.push(keyword);
- }
- }
- });
- }
- });
- if (formatedPubItem.segments.length) {
- formatedPublisher.push(formatedPubItem);
- }
- }
- });
- if (formatedPublisher.length) {
- formatedKeywords[pubName] = formatedPublisher;
- }
- }
- });
- formatedPageKeywords[name] = formatedKeywords;
- } else {
- formatedPageKeywords[name] = keywords;
- }
- }
- });
- return Object.keys(formatedPageKeywords).length && formatedPageKeywords;
-}
-
-/**
- * Gets bidfloor
- * @param {Object} mediaTypes
- * @param {Object} bid
- * @returns {Number} floor
- */
-function _getFloor (mediaTypes, bid) {
- const curMediaType = mediaTypes.video ? 'video' : 'banner';
- let floor = bid.params.bidFloor || 0;
-
- if (typeof bid.getFloor === 'function') {
- const floorInfo = bid.getFloor({
- currency: 'USD',
- mediaType: curMediaType,
- size: bid.sizes.map(([w, h]) => ({w, h}))
- });
-
- if (typeof floorInfo === 'object' &&
- floorInfo.currency === 'USD' &&
- !isNaN(parseFloat(floorInfo.floor))) {
- floor = Math.max(floor, parseFloat(floorInfo.floor));
- }
- }
-
- return floor;
-}
-
-registerBidder(spec);
diff --git a/modules/trustxBidAdapter.md b/modules/trustxBidAdapter.md
deleted file mode 100644
index f29d47eaf36..00000000000
--- a/modules/trustxBidAdapter.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# Overview
-
-Module Name: TrustX Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: paul@trustx.org
-
-# Description
-
-Module that connects to TrustX demand source to fetch bids.
-TrustX Bid Adapter supports Banner and Video (instream and outstream).
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[300, 250]],
- }
- },
- bids: [
- {
- bidder: "trustx",
- params: {
- uid: '58851',
- }
- }
- ]
- },{
- code: 'test-div',
- mediaTypes: {
- banner: {
- sizes: [[728, 90],[300, 250]],
- }
- },
- bids: [
- {
- bidder: "trustx",
- params: {
- uid: 58851,
- keywords: {
- site: {
- publisher: {
- name: 'someKeywordsName',
- brandsafety: ['disaster'],
- topic: ['stress', 'fear']
- }
- }
- }
- }
- }
- ]
- },{
- code: 'test-div',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 360],
- mimes: ['video/mp4'],
- protocols: [1, 2, 3, 4, 5, 6, 7, 8],
- playbackmethod: [2],
- skip: 1
- }
- },
- bids: [
- {
- bidder: "trustx",
- params: {
- uid: 7697
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/ttdBidAdapter.js b/modules/ttdBidAdapter.js
index 4919442336f..55d7490a4ad 100644
--- a/modules/ttdBidAdapter.js
+++ b/modules/ttdBidAdapter.js
@@ -125,14 +125,14 @@ function getUser(bidderRequest) {
function getSite(bidderRequest, firstPartyData) {
var site = {
id: utils.deepAccess(bidderRequest, 'bids.0.params.siteId'),
- page: utils.deepAccess(bidderRequest, 'refererInfo.referer'),
+ page: utils.deepAccess(bidderRequest, 'refererInfo.page'),
publisher: {
id: utils.deepAccess(bidderRequest, 'bids.0.params.publisherId'),
},
...firstPartyData.site
};
- var publisherDomain = config.getConfig('publisherDomain');
+ var publisherDomain = bidderRequest.refererInfo.domain;
if (publisherDomain) {
utils.deepSetValue(site, 'publisher.domain', publisherDomain);
}
@@ -373,7 +373,7 @@ export const spec = {
* @return {ServerRequest} Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
- const firstPartyData = config.getConfig('ortb2') || {};
+ const firstPartyData = bidderRequest.ortb2 || {};
let topLevel = {
id: bidderRequest.auctionId,
imp: validBidRequests.map(bidRequest => getImpression(bidRequest)),
diff --git a/modules/ucfunnelBidAdapter.js b/modules/ucfunnelBidAdapter.js
index ec087d005d6..33bcda29881 100644
--- a/modules/ucfunnelBidAdapter.js
+++ b/modules/ucfunnelBidAdapter.js
@@ -264,13 +264,13 @@ function getRequestData(bid, bidderRequest) {
}
addUserId(bidData, bid.userId);
+ // TODO: is 'page' the right value here? does the fallback make sense?
+ bidData.u = bidderRequest?.refererInfo?.page || bidderRequest?.refererInfo?.topmostLocation;
try {
bidData.host = window.top.location.hostname;
- bidData.u = config.getConfig('publisherDomain') || window.top.location.href;
bidData.xr = 0;
} catch (e) {
bidData.host = window.location.hostname;
- bidData.u = config.getConfig('publisherDomain') || bidderRequest.refererInfo.referrer || document.referrer || window.location.href;
bidData.xr = 1;
}
@@ -314,17 +314,10 @@ function getRequestData(bid, bidderRequest) {
}
if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.apiVersion == 1) {
- Object.assign(bidData, {
- gdpr: bidderRequest.gdprConsent.gdprApplies ? 1 : 0,
- euconsent: bidderRequest.gdprConsent.consentString
- });
- } else if (bidderRequest.gdprConsent.apiVersion == 2) {
- Object.assign(bidData, {
- gdpr: bidderRequest.gdprConsent.gdprApplies ? 1 : 0,
- 'euconsent-v2': bidderRequest.gdprConsent.consentString
- });
- }
+ Object.assign(bidData, {
+ gdpr: bidderRequest.gdprConsent.gdprApplies ? 1 : 0,
+ 'euconsent-v2': bidderRequest.gdprConsent.consentString
+ });
}
if (config.getConfig('coppa')) {
@@ -338,9 +331,9 @@ function addUserId(bidData, userId) {
bidData['eids'] = '';
_each(userId, (userIdObjectOrValue, userIdProviderKey) => {
switch (userIdProviderKey) {
- case 'haloId':
- if (userIdObjectOrValue.haloId) {
- bidData[userIdProviderKey + 'haloId'] = userIdObjectOrValue.haloId;
+ case 'hadronId':
+ if (userIdObjectOrValue.hadronId) {
+ bidData[userIdProviderKey + 'hadronId'] = userIdObjectOrValue.hadronId;
}
if (userIdObjectOrValue.auSeg) {
bidData[userIdProviderKey + '_auSeg'] = userIdObjectOrValue.auSeg;
@@ -373,11 +366,6 @@ function addUserId(bidData, userId) {
: ('verizonMediaId,' + userIdObjectOrValue);
}
break;
- case 'flocId':
- if (userIdObjectOrValue.id) {
- bidData['cid'] = userIdObjectOrValue.id;
- }
- break;
default:
bidData[userIdProviderKey] = userIdObjectOrValue;
break;
diff --git a/modules/undertoneBidAdapter.js b/modules/undertoneBidAdapter.js
index f86faf3fe4d..eda4b6f579c 100644
--- a/modules/undertoneBidAdapter.js
+++ b/modules/undertoneBidAdapter.js
@@ -2,8 +2,8 @@
* Adapter to send bids to Undertone
*/
-import { deepAccess, parseUrl } from '../src/utils.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
+import {deepAccess, parseUrl} from '../src/utils.js';
+import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
const BIDDER_CODE = 'undertone';
@@ -26,18 +26,6 @@ function getBidFloor(bidRequest, mediaType) {
return (floor && floor.currency === 'USD' && floor.floor) || 0;
}
-function getCanonicalUrl() {
- try {
- let doc = window.top.document;
- let element = doc.querySelector("link[rel='canonical']");
- if (element !== null) {
- return element.href;
- }
- } catch (e) {
- }
- return null;
-}
-
function extractDomainFromHost(pageHost) {
let domain = null;
try {
@@ -111,8 +99,8 @@ export const spec = {
'x-ut-hb-params': [],
'commons': commons
};
- const referer = bidderRequest.refererInfo.referer;
- const canonicalUrl = getCanonicalUrl();
+ const referer = bidderRequest.refererInfo.topmostLocation;
+ const canonicalUrl = bidderRequest.refererInfo.canonicalUrl;
if (referer) {
commons.referrer = referer;
}
diff --git a/modules/unicornBidAdapter.js b/modules/unicornBidAdapter.js
index 977e694acf7..9cbc79f3e61 100644
--- a/modules/unicornBidAdapter.js
+++ b/modules/unicornBidAdapter.js
@@ -64,9 +64,9 @@ function buildOpenRtbBidRequestPayload(validBidRequests, bidderRequest) {
publisher: {
id: String(deepAccess(validBidRequests[0], 'params.publisherId') || 0)
},
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidderRequest.refererInfo.referer
+ domain: bidderRequest.refererInfo.domain,
+ page: bidderRequest.refererInfo.page,
+ ref: bidderRequest.refererInfo.ref
},
device: {
language: navigator.language,
diff --git a/modules/uolBidAdapter.md b/modules/uolBidAdapter.md
deleted file mode 100644
index 1d465c9a9c5..00000000000
--- a/modules/uolBidAdapter.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# Overview
-
-```
-Module Name: UOL Project Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: l-prebid@uolinc.com
-```
-
-# Description
-
-Connect to UOL Project's exchange for bids.
-
-For proper setup, please contact UOL Project's team at l-prebid@uolinc.com
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: '/19968336/header-bid-tag-0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250],[300, 600]]
- }
- },
- bids: [{
- bidder: 'uol',
- params: {
- placementId: 1231244,
- test: true,
- cpmFactor: 2
- }
- }
- ]
- },
- {
- code: '/19968336/header-bid-tag-1',
- mediaTypes: {
- banner: {
- sizes: [[970, 250],[728, 90]]
- }
- },
- bids: [{
- bidder: 'uol',
- params: {
- placementId: 1231242,
- test: false
- }
- }]
- }
- ];
-```
diff --git a/modules/userId/eids.js b/modules/userId/eids.js
index 1713699e4f2..a077043a228 100644
--- a/modules/userId/eids.js
+++ b/modules/userId/eids.js
@@ -191,24 +191,12 @@ export const USER_IDS_CONFIG = {
atype: 1
},
- // haloId (deprecated in 7.0, use hadronId)
- 'haloId': {
- source: 'audigent.com',
- atype: 1
- },
-
// quantcastId
'quantcastId': {
source: 'quantcast.com',
atype: 1
},
- // nextroll
- 'nextrollId': {
- source: 'nextroll.com',
- atype: 1
- },
-
// IDx
'idx': {
source: 'idx.lat',
@@ -255,12 +243,6 @@ export const USER_IDS_CONFIG = {
}
},
- // Akamai Data Activation Platform (DAP)
- 'dapId': {
- source: 'akamai.com',
- atype: 1
- },
-
'deepintentId': {
source: 'deepintent.com',
atype: 3
diff --git a/modules/userId/eids.md b/modules/userId/eids.md
index 45237ac5f26..2682eca8dbc 100644
--- a/modules/userId/eids.md
+++ b/modules/userId/eids.md
@@ -154,14 +154,6 @@ userIdAsEids = [
}]
},
- {
- source: 'nextroll.com',
- uids: [{
- id: 'some-random-id-value',
- atype: 1
- }]
- },
-
{
source: 'audigent.com',
uids: [{
@@ -213,13 +205,6 @@ userIdAsEids = [
atype: 3
}]
},
- {
- source: 'akamai.com',
- uids: [{
- id: 'some-random-id-value',
- atype: 1
- }]
- },
{
source: 'admixer.net',
uids: [{
diff --git a/modules/userId/index.js b/modules/userId/index.js
index 809ca624748..7edc2862b57 100644
--- a/modules/userId/index.js
+++ b/modules/userId/index.js
@@ -153,6 +153,7 @@ import {
} from '../../src/utils.js';
import {getPPID as coreGetPPID} from '../../src/adserver.js';
import {promiseControls} from '../../src/utils/promise.js';
+import {hasPurpose1Consent} from '../../src/utils/gpdr.js';
const MODULE_NAME = 'User ID';
const COOKIE = 'cookie';
@@ -338,26 +339,6 @@ function storedConsentDataMatchesConsentData(storedConsentData, consentData) {
);
}
-/**
- * test if consent module is present, applies, and is valid for local storage or cookies (purpose 1)
- * @param {ConsentData} consentData
- * @returns {boolean}
- */
-function hasGDPRConsent(consentData) {
- if (consentData && typeof consentData.gdprApplies === 'boolean' && consentData.gdprApplies) {
- if (!consentData.consentString) {
- return false;
- }
- if (consentData.apiVersion === 1 && deepAccess(consentData, 'vendorData.purposeConsents.1') === false) {
- return false;
- }
- if (consentData.apiVersion === 2 && deepAccess(consentData, 'vendorData.purpose.consents.1') === false) {
- return false;
- }
- }
- return true;
-}
-
/**
* Find the root domain
* @param {string|undefined} fullDomain
@@ -850,7 +831,7 @@ function populateSubmoduleId(submodule, consentData, storedConsentData, forceRef
function initSubmodules(dest, submodules, consentData, forceRefresh = false) {
// gdpr consent with purpose one is required, otherwise exit immediately
let { userIdModules, hasValidated } = validateGdprEnforcement(submodules, consentData);
- if (!hasValidated && !hasGDPRConsent(consentData)) {
+ if (!hasValidated && !hasPurpose1Consent(consentData)) {
logWarn(`${MODULE_NAME} - gdpr permission not valid for local storage or cookies, exit module`);
return [];
}
diff --git a/modules/userId/userId.md b/modules/userId/userId.md
index 4b2338fa3eb..77a8b4b771f 100644
--- a/modules/userId/userId.md
+++ b/modules/userId/userId.md
@@ -73,16 +73,6 @@ pbjs.setConfig({
// Replace partner with comma-separated (if more than one) Parrable Partner Client ID(s) for Parrable-aware bid adapters in use
partner: "30182847-e426-4ff9-b2b5-9ca1324ea09b"
}
- },{
- name: 'akamaiDAPId',
- params: {
- apiHostname: '',
- domain: 'your-domain.com',
- type: 'email' | 'mobile' | ... | 'dap-signature:1.0.0',
- identity: ‘your@email.com’ | ‘6175551234' | ...,
- apiVersion: 'v1' | 'x1',
- attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "...","last_name": "..." }'
- }
},{
name: 'identityLink',
params: {
@@ -149,11 +139,6 @@ pbjs.setConfig({
name: '__adm__admixer',
expires: 30
}
- },{
- name: 'flocId',
- params: {
- token: "Registered token or default sharedid.org token" // Default sharedid.org token: "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
- }
},{
name: "kpuid",
params:{
@@ -254,11 +239,6 @@ pbjs.setConfig({
expires: 90, // Expiration in days
refreshInSeconds: 8*3600 // User Id cache lifetime in seconds, defaulting to 'expires'
},
- }, {
- name: 'nextrollId',
- params: {
- partnerId: "1009", // Set your real NextRoll partner ID here for production
- }
}, {
name: 'criteo',
storage: { // It is best not to specify this parameter since the module needs to be called as many times as possible
@@ -293,24 +273,12 @@ pbjs.setConfig({
expires: 30
}
},{
- name: 'flocId',
- params: {
- token: "Registered token or default sharedid.org token" // Default sharedid.org token: "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
- }
- },{
name: "deepintentId",
storage: {
type: "html5",
name: "_dpes_id",
expires: 90
}
- },{
- name: "deepintentId",
- storage: {
- type: "cookie",
- name: "_dpes_id",
- expires: 90
- }
},{
name: "kpuid",
params:{
diff --git a/modules/userIdTargeting.js b/modules/userIdTargeting.js
deleted file mode 100644
index b7fd137779b..00000000000
--- a/modules/userIdTargeting.js
+++ /dev/null
@@ -1,63 +0,0 @@
-import {config} from '../src/config.js';
-import {getGlobal} from '../src/prebidGlobal.js';
-import CONSTANTS from '../src/constants.json';
-import * as events from '../src/events.js';
-import { isStr, isPlainObject, isBoolean, isFn, hasOwn, logInfo } from '../src/utils.js';
-
-const MODULE_NAME = 'userIdTargeting';
-const GAM = 'GAM';
-const GAM_KEYS_CONFIG = 'GAM_KEYS';
-
-export function userIdTargeting(userIds, config) {
- if (!isPlainObject(config)) {
- logInfo(MODULE_NAME + ': Invalid config found, not sharing userIds externally.');
- return;
- }
-
- const PUB_GAM_KEYS = isPlainObject(config[GAM_KEYS_CONFIG]) ? config[GAM_KEYS_CONFIG] : {};
- let SHARE_WITH_GAM = isBoolean(config[GAM]) ? config[GAM] : false;
- let GAM_API;
-
- if (!SHARE_WITH_GAM) {
- logInfo(MODULE_NAME + ': Not enabled for ' + GAM);
- } else if (window.googletag && isFn(window.googletag.pubads) && hasOwn(window.googletag.pubads(), 'setTargeting') && isFn(window.googletag.pubads().setTargeting)) {
- GAM_API = window.googletag.pubads().setTargeting;
- } else {
- window.googletag = window.googletag || {};
- window.googletag.cmd = window.googletag.cmd || [];
- GAM_API = function (key, value) {
- window.googletag.cmd.push(function () {
- window.googletag.pubads().setTargeting(key, value);
- });
- };
- }
-
- Object.keys(userIds).forEach(function(key) {
- if (userIds[key]) {
- // PUB_GAM_KEYS: { "tdid": '' } means the publisher does not want to send the tdid to GAM
- if (SHARE_WITH_GAM && PUB_GAM_KEYS[key] !== '') {
- let uidStr;
- if (isStr(userIds[key])) {
- uidStr = userIds[key];
- } else if (isPlainObject(userIds[key])) {
- uidStr = JSON.stringify(userIds[key])
- } else {
- logInfo(MODULE_NAME + ': ' + key + ' User ID is not an object or a string.');
- return;
- }
- GAM_API(
- (hasOwn(PUB_GAM_KEYS, key) ? PUB_GAM_KEYS[key] : key),
- [ uidStr ]
- );
- }
- }
- });
-}
-
-export function init(config) {
- events.on(CONSTANTS.EVENTS.AUCTION_END, function() {
- userIdTargeting((getGlobal()).getUserIds(), config.getConfig(MODULE_NAME));
- })
-}
-
-init(config)
diff --git a/modules/userIdTargeting.md b/modules/userIdTargeting.md
deleted file mode 100644
index 340c1b6abf2..00000000000
--- a/modules/userIdTargeting.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## userIdTargeting Module
-- This module works with userId module.
-- This module is used to pass userIds to GAM in targeting so that user ids can be used to pass in Google Exchange Bidding or can be used for targeting in GAM.
-
-## Sample config
-```
-pbjs.setConfig({
-
- // your existing userIds config
-
- userSync: {
- userIds: [{...}, ...]
- },
-
- // new userIdTargeting config
-
- userIdTargeting: {
- "GAM": true,
- "GAM_KEYS": {
- "tdid": "TTD_ID" // send tdid as TTD_ID
- }
- }
-});
-```
-
-## Config options
-- GAM: is required to be set to true if a publisher wants to send UserIds as targeting in GAM call. This module uses ``` googletag.pubads().setTargeting('key-name', ['value']) ``` API to set GAM targeting.
-- GAM_KEYS: is an optional config object to be used with ``` "GAM": true ```. If not passed then all UserIds are passed with respective key-name used in UserIds object.
-If a publisher wants to pass ```UserId.tdid``` as TTD_ID in targeting then set ``` GAM_KEYS: { "tdid": "TTD_ID" }```
-If a publisher does not wants to pass ```UserId.tdid``` but wants to pass other Ids in UserId tthen set ``` GAM_KEYS: { "tdid": "" }```
-
-## Including this module in Prebid
-``` $ gulp build --modules=userId,userIdTargeting,pubmaticBidAdapter ```
-
-## Notes
-- We can add support for other external systems like GAM in future
-- We have not added support for A9/APSTag as it is called in parallel with Prebid. This module executes when ```pbjs.requestBids``` is called, in practice, call to A9 is expected to execute in paralle to Prebid thus we have not covered A9 here. For sending Uids in A9, one will need to set those Ids in params key in the object passed to ```apstag.init```, ```pbjs.getUserIds``` can be used for the same.
diff --git a/modules/validationFpdModule/index.js b/modules/validationFpdModule/index.js
index 2db170c1bd1..8771e50b156 100644
--- a/modules/validationFpdModule/index.js
+++ b/modules/validationFpdModule/index.js
@@ -2,11 +2,10 @@
* This module sets default values and validates ortb2 first part data
* @module modules/firstPartyData
*/
-import { config } from '../../src/config.js';
-import { isEmpty, isNumber, logWarn, deepAccess } from '../../src/utils.js';
-import { ORTB_MAP } from './config.js';
-import { submodule } from '../../src/hook.js';
-import { getStorageManager } from '../../src/storageManager.js';
+import {deepAccess, isEmpty, isNumber, logWarn} from '../../src/utils.js';
+import {ORTB_MAP} from './config.js';
+import {submodule} from '../../src/hook.js';
+import {getStorageManager} from '../../src/storageManager.js';
const STORAGE = getStorageManager();
let optout;
@@ -192,29 +191,16 @@ export function validateFpd(fpd, path = '', parent = '') {
* Run validation on global and bidder config data for ortb2
*/
function runValidations(data) {
- let conf = validateFpd(data);
-
- let bidderDuplicate = { ...config.getBidderConfig() };
-
- Object.keys(bidderDuplicate).forEach(bidder => {
- let modConf = Object.keys(bidderDuplicate[bidder]).reduce((res, key) => {
- let valid = (key !== 'ortb2') ? bidderDuplicate[bidder][key] : validateFpd(bidderDuplicate[bidder][key]);
-
- if (valid) res[key] = valid;
-
- return res;
- }, {});
-
- if (Object.keys(modConf).length) config.setBidderConfig({ bidders: [bidder], config: modConf });
- });
-
- return conf;
+ return {
+ global: validateFpd(data.global),
+ bidder: Object.fromEntries(Object.entries(data.bidder).map(([bidder, conf]) => [bidder, validateFpd(conf)]))
+ }
}
/**
* Sets default values to ortb2 if exists and adds currency and ortb2 setConfig callbacks on init
*/
-export function initSubmodule(fpdConf, data) {
+export function processFpd(fpdConf, data) {
// Checks for existsnece of pubcid optout cookie/storage
// if exists, filters user data out
optout = (STORAGE.cookiesAreEnabled() && STORAGE.getCookie('_pubcid_optout')) ||
@@ -227,7 +213,7 @@ export function initSubmodule(fpdConf, data) {
export const validationSubmodule = {
name: 'validation',
queue: 1,
- init: initSubmodule
+ processFpd
}
submodule('firstPartyData', validationSubmodule)
diff --git a/modules/vdoaiBidAdapter.js b/modules/vdoaiBidAdapter.js
index 40e3b3322a7..e149a56f988 100644
--- a/modules/vdoaiBidAdapter.js
+++ b/modules/vdoaiBidAdapter.js
@@ -37,7 +37,8 @@ export const spec = {
placementId: bidRequest.params.placementId,
sizes: sizes,
bidId: bidRequest.bidId,
- referer: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ referer: bidderRequest.refererInfo.page,
id: bidRequest.auctionId,
mediaType: bidRequest.mediaTypes.video ? 'video' : 'banner'
};
diff --git a/modules/ventes.md b/modules/ventes.md
deleted file mode 100644
index 5f0f571ecd8..00000000000
--- a/modules/ventes.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-layout: bidder
-title: ventes
-description: Prebid ventes Bidder Adapter
-pbjs: false
-biddercode: ventes
-gdpr_supported: false
-usp_supported: false
-media_types: banner
-coppa_supported: false
-schain_supported: false
-dchain_supported: false
-prebid_member: false
----
-
-### BidParams
-{: .table .table-bordered .table-striped }
-| Name | Scope | Description | Example | Type |
-|-----------------|----------|-----------------------------------------------------------|----------------------------------------------|---------------|
-| `placementId` | required | Placement ID from Ventes Avenues | `'VA-062-0013-0183'` | `string` |
-| `publisherId` | required | Publisher ID from Ventes Avenues | `'VA-062'` | `string` |
-| `user` | optional | Object that specifies information about an external user. | `user: { age: 25, gender: 0, dnt: true}` | `object` |
-| `app` | optional | Object containing mobile app parameters. | `app : { id: 'app-id'}` | `object` |
-
-#### User Object
-
-{: .table .table-bordered .table-striped }
-| Name | Description | Example | Type |
-|-------------------|-------------------------------------------------------------------------------------------|-----------------------|-----------------------|
-| `age` | The age of the user. | `35` | `integer` |
-| `externalUid` | Specifies a string that corresponds to an external user ID for this user. | `'1234567890abcdefg'` | `string` |
-| `segments` | Specifies the segments to which the user belongs. | `[1, 2]` | `Array` |
-| `gender` | Specifies the gender of the user. Allowed values: Unknown: `0`; Male: `1`; Female: `2` | `1` | `integer` |
-| `dnt` | Do not track flag. Indicates if tracking cookies should be disabled for this auction | `true` | `boolean` |
-| `language` | Two-letter ANSI code for this user's language. | `EN` | `string` |
-
-
-### Ad Unit Setup for Banner
-```javascript
-var adUnits = [
-{
- code: 'test-hb-ad-11111-1',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250]
- ]
- }
- },
- bids: [{
- bidder: 'ventes',
- params: {
- placementId: 'VA-062-0013-0183',
- publisherId: '5cebea3c9eea646c7b623d5e',
- IABCategories: "['IAB1', 'IAB5']",
- device:{
- ip: '123.145.167.189',
- ifa:"AEBE52E7-03EE-455A-B3C4-E57283966239",
- },
- app: {
- id: "agltb3B1Yi1pbmNyDAsSA0FwcBiJkfIUDA",
- name: "Yahoo Weather",
- bundle: 'com.kiloo.subwaysurf',
- storeurl: 'https://play.google.com/store/apps/details?id=com.kiloo.subwaysurf&hl=en',
- domain: 'somoaudience.com',
- }
- }
- }]
- }
-]
-```
diff --git a/modules/ventesBidAdapter.js b/modules/ventesBidAdapter.js
index 42292ddaed3..054d59807a4 100644
--- a/modules/ventesBidAdapter.js
+++ b/modules/ventesBidAdapter.js
@@ -6,8 +6,6 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
const BID_METHOD = 'POST';
const BIDDER_URL = 'http://13.234.201.146:8088/va/ad';
-const DOMAIN_REGEX = new RegExp('//([^/]*)');
-
function groupBy(values, key) {
const groups = values.reduce((acc, value) => {
const groupId = value[key];
@@ -69,26 +67,16 @@ function validateParameters(parameters) {
return true;
}
-function extractSiteDomainFromURL(url) {
- if (!url || !isStr(url)) return null;
-
- const domain = url.match(DOMAIN_REGEX);
-
- if (isArray(domain) && domain.length === 2) return domain[1];
-
- return null;
-}
-
function generateSiteFromAdUnitContext(bidRequests, adUnitContext) {
if (!adUnitContext || !adUnitContext.refererInfo) return null;
- const domain = extractSiteDomainFromURL(adUnitContext.refererInfo.referer);
+ const domain = adUnitContext.refererInfo.domain;
const publisherId = bidRequests[0].params.publisherId;
if (!domain) return null;
return {
- page: adUnitContext.refererInfo.referer,
+ page: adUnitContext.refererInfo.page,
domain: domain,
name: domain,
publisher: {
diff --git a/modules/vertamediaBidAdapter.md b/modules/vertamediaBidAdapter.md
deleted file mode 100644
index 6b1265fa792..00000000000
--- a/modules/vertamediaBidAdapter.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Overview
-
-**Module Name**: VertaMedia Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: support@verta.media
-
-# Description
-
-Get access to multiple demand partners across VertaMedia AdExchange and maximize your yield with VertaMedia header bidding adapter.
-
-VertaMedia header bidding adapter connects with VertaMedia demand sources in order to fetch bids.
-This adapter provides a solution for accessing Video demand and display demand
-
-
-# Test Parameters
-```
- var adUnits = [
-
- // Video instream adUnit
- {
- code: 'div-test-div',
- sizes: [[640, 480]],
- mediaTypes: {
- video: {
- context: 'instream'
- }
- },
- bids: [{
- bidder: 'vertamedia',
- params: {
- aid: 331133
- }
- }]
- },
-
- // Video outstream adUnit
- {
- code: 'outstream-test-div',
- sizes: [[640, 480]],
- mediaTypes: {
- video: {
- context: 'outstream'
- }
- },
- bids: [{
- bidder: 'vertamedia',
- params: {
- aid: 331133
- }
- }]
- },
-
- // Banner adUnit
- {
- code: 'div-test-div',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'vertamedia',
- params: {
- aid: 350975
- }
- }]
- }
- ];
-```
diff --git a/modules/viBidAdapter.md b/modules/viBidAdapter.md
deleted file mode 100644
index 2608ccc4adb..00000000000
--- a/modules/viBidAdapter.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Overview
-
-```
-Module Name: vi bid adapter
-Module Type: Bidder adapter
-Maintainer: support@vi.ai
-```
-
-# Description
-
-The video intelligence (vi) adapter integration to the Prebid library.
-Connects to vi’s demand sources.
-There should be only one ad unit with vi bid adapter on each single page.
-
-# Test Parameters
-
-```
-var adUnits = [{
- code: 'div-0',
- sizes: [[320, 480]],
- bids: [{
- bidder: 'vi',
- params: {
- pubId: 'sb_test',
- lang: 'en-US',
- cat: 'IAB1',
- bidFloor: 0.05 //optional
- }
- }]
-}];
-```
-
-# Parameters
-
-| Name | Scope | Description | Example |
-| :------------ | :------- | :---------------------------------------------- | :--------------------------------- |
-| `pubId` | required | Publisher ID, provided by vi | 'sb_test' |
-| `lang` | required | Ad language, in ISO 639-1 language code format | 'en-US', 'es-ES', 'de' |
-| `cat` | required | Ad IAB category (top-level or subcategory), single one supported | 'IAB1', 'IAB9-1' |
-| `bidFloor` | optional | Lowest value of expected bid price | 0.001 |
-| `useSizes` | optional | Specifies from which section of the config sizes are taken, possible values are 'banner', 'video'. If omitted, sizes from both sections are merged. | 'banner' |
-
diff --git a/modules/vidazooBidAdapter.js b/modules/vidazooBidAdapter.js
index cf252bda2dc..3933d7632b6 100644
--- a/modules/vidazooBidAdapter.js
+++ b/modules/vidazooBidAdapter.js
@@ -15,7 +15,6 @@ const SESSION_ID_KEY = 'vidSid';
export const SUPPORTED_ID_SYSTEMS = {
'britepoolid': 1,
'criteoId': 1,
- 'digitrustid': 1,
'id5id': 1,
'idl_env': 1,
'lipb': 1,
@@ -129,7 +128,8 @@ function appendUserIdsToRequestPayload(payloadRef, userIds) {
}
function buildRequests(validBidRequests, bidderRequest) {
- const topWindowUrl = bidderRequest.refererInfo.referer;
+ // TODO: does the fallback make sense here?
+ const topWindowUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
const requests = [];
validBidRequests.forEach(validBidRequest => {
const sizes = parseSizesInput(validBidRequest.sizes);
diff --git a/modules/videoNowBidAdapter.md b/modules/videoNowBidAdapter.md
deleted file mode 100644
index 2ac2a431378..00000000000
--- a/modules/videoNowBidAdapter.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Overview
-
-```
-Module Name: Videonow Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: info@videonow.ru
-```
-
-# Description
-
-Connect to Videonow for bids.
-
-The Videonow bidder adapter requires setup and approval from the videoNow team.
-Please reach out to your account team or info@videonow.ru for more information.
-
-# Test Parameters
-```javascript
-var adUnits = [
- // Banner adUnit
- {
- code: 'banner-div',
- mediaTypes: {
- banner: {
- sizes: [[640, 480], [300, 250], [336, 280]]
- }
- },
- bids: [{
- bidder: 'videonow',
- params: {
- pId: 1,
- placementId: '36891'
- }
- }]
- }]
-```
diff --git a/modules/videobyteBidAdapter.js b/modules/videobyteBidAdapter.js
index 6e99b5bc42a..2ecc3d481aa 100644
--- a/modules/videobyteBidAdapter.js
+++ b/modules/videobyteBidAdapter.js
@@ -221,9 +221,9 @@ function buildRequestData(bidRequest, bidderRequest) {
}
],
site: {
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidRequest.refererInfo ? bidRequest.refererInfo.referer || null : null
+ domain: bidderRequest.refererInfo.domain,
+ page: bidderRequest.refererInfo.page,
+ ref: bidderRequest.refererInfo.ref,
},
ext: {
hb: 1,
diff --git a/modules/videofyBidAdapter.md b/modules/videofyBidAdapter.md
deleted file mode 100644
index b50eaf5672e..00000000000
--- a/modules/videofyBidAdapter.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Overview
-
-```
-Module Name: Videofy Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: support1@videofy.ai
-```
-
-# Description
-
-Connects to Videofy for bids.
-
-Videofy bid adapter supports Video ads currently.
-
-# Sample Ad Unit: For Publishers
-```javascript
-var videoAdUnit = [
-{
- code: 'video1',
- mediaTypes: {
- video: {
- playerSize: [[640, 480]],
- context: 'outstream'
- },
- },
- bids: [{
- bidder: 'videofy',
- params: {
- AV_PUBLISHERID: '55b78633181f4603178b4568',
- AV_CHANNELID: '5d19dfca4b6236688c0a2fc4'
- }
- }]
-}];
-```
-
-```
diff --git a/modules/videoheroesBidAdapter.js b/modules/videoheroesBidAdapter.js
index edcdd698153..61123820cf5 100644
--- a/modules/videoheroesBidAdapter.js
+++ b/modules/videoheroesBidAdapter.js
@@ -62,23 +62,7 @@ export const spec = {
return impObject;
});
- let w = window;
- let l = w.document.location.href;
- let r = w.document.referrer;
-
- let loopChecker = 0;
- while (w !== w.parent) {
- if (++loopChecker == 10) break;
- try {
- w = w.parent;
- l = w.location.href;
- r = w.document.referrer;
- } catch (e) {
- break;
- }
- }
-
- let page = l || bidderRequest.refererInfo.referer;
+ let page = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
let data = {
id: bidderRequest.bidderRequestId,
@@ -97,8 +81,8 @@ export const spec = {
imp
};
- if (r) {
- data.site.ref = r;
+ if (bidderRequest.refererInfo.ref) {
+ data.site.ref = bidderRequest.refererInfo.ref
}
if (bidderRequest.gdprConsent) {
diff --git a/modules/videoreachBidAdapter.js b/modules/videoreachBidAdapter.js
index 61ecd55a2ef..1fc38066407 100644
--- a/modules/videoreachBidAdapter.js
+++ b/modules/videoreachBidAdapter.js
@@ -28,7 +28,8 @@ export const spec = {
};
if (bidderRequest && bidderRequest.refererInfo) {
- data.referrer = bidderRequest.refererInfo.referer;
+ // TODO: is 'page' the right value here?
+ data.referrer = bidderRequest.refererInfo.page;
}
if (bidderRequest && bidderRequest.gdprConsent) {
diff --git a/modules/vidoomyBidAdapter.js b/modules/vidoomyBidAdapter.js
index ffa4a290072..ebecb5a46ae 100644
--- a/modules/vidoomyBidAdapter.js
+++ b/modules/vidoomyBidAdapter.js
@@ -73,9 +73,8 @@ const buildRequests = (validBidRequests, bidderRequest) => {
}
const [w, h] = (parseSizesInput(sizes)[0] || '0x0').split('x');
- const aElement = document.createElement('a');
- aElement.href = (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) || top.location.href;
- const hostname = aElement.hostname
+ // TODO: is 'domain' the right value here?
+ const hostname = bidderRequest.refererInfo.domain || window.location.hostname;
const videoContext = deepAccess(bid, 'mediaTypes.video.context');
const bidfloor = deepAccess(bid, `params.bidfloor`, 0);
@@ -95,7 +94,8 @@ const buildRequests = (validBidRequests, bidderRequest) => {
schain: bid.schain || '',
bidfloor,
d: getDomainWithoutSubdomain(hostname), // 'vidoomy.com',
- sp: encodeURIComponent(aElement.href),
+ // TODO: does the fallback make sense here?
+ sp: encodeURIComponent(bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation),
usp: bidderRequest.uspConsent || '',
coppa: !!config.getConfig('coppa'),
videoContext: videoContext || ''
diff --git a/modules/viewdeosDXBidAdapter.js b/modules/viewdeosDXBidAdapter.js
index 9e0cb91af9b..7afd23cbde7 100644
--- a/modules/viewdeosDXBidAdapter.js
+++ b/modules/viewdeosDXBidAdapter.js
@@ -125,7 +125,8 @@ function parseRTBResponse(serverResponse, bidderRequest) {
function bidToTag(bidRequests, bidderRequest) {
const tag = {
- domain: deepAccess(bidderRequest, 'refererInfo.referer')
+ // TODO: is 'page' the right value here?
+ domain: deepAccess(bidderRequest, 'refererInfo.page')
};
if (deepAccess(bidderRequest, 'gdprConsent.gdprApplies')) {
diff --git a/modules/visxBidAdapter.js b/modules/visxBidAdapter.js
index 696d54e4b52..cec48a83c35 100644
--- a/modules/visxBidAdapter.js
+++ b/modules/visxBidAdapter.js
@@ -94,8 +94,9 @@ export const spec = {
if (bidderRequest) {
timeout = bidderRequest.timeout;
- if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- payload.u = bidderRequest.refererInfo.referer;
+ if (bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ // TODO: is 'page' the right value here?
+ payload.u = bidderRequest.refererInfo.page;
}
if (bidderRequest.gdprConsent) {
if (bidderRequest.gdprConsent.consentString) {
diff --git a/modules/vmgBidAdapter.md b/modules/vmgBidAdapter.md
deleted file mode 100644
index 3ebfce91dee..00000000000
--- a/modules/vmgBidAdapter.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Overview
-
-```
-Module Name: VMG Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: paul@vmgood.com
-```
-
-# Description
-
-Connects DFP to the VMG Predict engine.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'div-0',
- mediaTypes: {
- banner: {
- sizes: sizes
- }
- },
- bids: [
- {
- bidder: 'vmg'
- }
- ]
- }];
-```
diff --git a/modules/voxBidAdapter.js b/modules/voxBidAdapter.js
index 25dbbda90cf..7b8cb42bb0a 100644
--- a/modules/voxBidAdapter.js
+++ b/modules/voxBidAdapter.js
@@ -198,7 +198,8 @@ export const spec = {
*/
buildRequests(validBidRequests, bidderRequest) {
const payload = {
- url: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ url: bidderRequest.refererInfo.page,
cmp: !!bidderRequest.gdprConsent,
bidRequests: buildBidRequests(validBidRequests)
};
diff --git a/modules/vubleAnalyticsAdapter.md b/modules/vubleAnalyticsAdapter.md
deleted file mode 100644
index dfe0a8d8eb0..00000000000
--- a/modules/vubleAnalyticsAdapter.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Overview
-
-Module Name: Vuble Analytics Adapter
-
-Module Type: Vuble Analytics Adapter
-
-Maintainer: abruyere@mediabong.com
-
-# Description
-
-Analytics adapter for vuble.tv Contact contact@mediabong.com for information.
-
-# Test Parameters
-
-```
-{
- provider: 'vuble',
- options: {
- pubId: 18, // require
- env: 'net', // require
- }
-}
-```
diff --git a/modules/vubleBidAdapter.md b/modules/vubleBidAdapter.md
deleted file mode 100644
index 6bd8d3f779a..00000000000
--- a/modules/vubleBidAdapter.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Overview
-
-```
-Module Name: Vuble Bidder Adapter
-Module Type: Vuble Adapter
-Maintainer: gv@mediabong.com
-```
-
-# Description
-
-Module that connects to Vuble's demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-video-instream',
- sizes: [[640, 360]],
- mediaTypes: {
- video: {
- context: 'instream'
- }
- },
- bids: [
- {
- bidder: "vuble",
- params: {
- env: 'net',
- pubId: '18',
- zoneId: '12345',
- referrer: "http://www.vuble.tv/", // optional
- floorPrice: 5.00 // optional
- }
- }
- ]
- },
- {
- code: 'test-video-outstream',
- sizes: [[640, 360]],
- mediaTypes: {
- video: {
- context: 'outstream'
- }
- },
- bids: [
- {
- bidder: "vuble",
- params: {
- env: 'net',
- pubId: '18',
- zoneId: '12345',
- referrer: "http://www.vuble.tv/", // optional
- floorPrice: 5.00 // optional
- }
- }
- ]
- }
- ];
\ No newline at end of file
diff --git a/modules/waardexBidAdapter.js b/modules/waardexBidAdapter.js
index 1a97e3bd351..92b7fc26e4c 100644
--- a/modules/waardexBidAdapter.js
+++ b/modules/waardexBidAdapter.js
@@ -69,7 +69,8 @@ const getCommonBidsData = bidderRequest => {
};
if (bidderRequest && bidderRequest.refererInfo) {
- payload.referer = encodeURIComponent(bidderRequest.refererInfo.referer);
+ // TODO: is 'page' the right value here?
+ payload.referer = encodeURIComponent(bidderRequest.refererInfo.page || '');
}
if (bidderRequest && bidderRequest.uspConsent) {
@@ -97,7 +98,7 @@ const getBidRequestToSend = validBidRequest => {
bidId: validBidRequest.bidId,
bidfloor: 0,
position: parseInt(validBidRequest.params.position) || 1,
- instl: parseInt(validBidRequest.params.instl) || 0,
+ instl: deepAccess(validBidRequest.ortb2Imp, 'instl') === 1 || parseInt(validBidRequest.params.instl) === 1 ? 1 : 0,
};
if (validBidRequest.mediaTypes[BANNER]) {
diff --git a/modules/weboramaRtdProvider.js b/modules/weboramaRtdProvider.js
index 64cdd6508bb..35440849db4 100644
--- a/modules/weboramaRtdProvider.js
+++ b/modules/weboramaRtdProvider.js
@@ -86,17 +86,15 @@ import {
import {
deepSetValue,
isEmpty,
- mergeDeep,
+ isFn,
logError,
- logWarn,
- tryAppendQueryString,
logMessage,
- isFn,
isArray,
isStr,
isBoolean,
isPlainObject,
deepClone,
+ tryAppendQueryString, mergeDeep, logWarn
} from '../src/utils.js';
import {
submodule
@@ -626,7 +624,7 @@ function handleBidRequestData(reqBids, moduleParams) {
if (ph.sendToBidders(bid, adUnit.code, cph.data, cph.metadata)) {
// logMessage(`handling bidder '${bid.bidder}' with ${ph.metadata.source} data`);
- handleBid(bid, cph.data, ph.metadata);
+ handleBid(reqBids, bid, cph.data, ph.metadata);
}
})
)
@@ -671,15 +669,17 @@ const SMARTADSERVER = 'smartadserver';
const bidderAliasRegistry = adapterManager.aliasRegistry || {};
/** handle individual bid
+ * @param reqBids
* @param {Object} bid
* @param {Object} profile
* @param {Object} metadata
* @returns {void}
*/
-function handleBid(bid, profile, metadata) {
+function handleBid(reqBids, bid, profile, metadata) {
const bidder = bidderAliasRegistry[bid.bidder] || bid.bidder;
switch (bidder) {
+ // TODO: these special cases should not be necessary - all adapters should look into FPD, not just their params
case APPNEXUS:
handleAppnexusBid(bid, profile);
@@ -699,7 +699,7 @@ function handleBid(bid, profile, metadata) {
break;
default:
- handleBidViaORTB2(bid, profile, metadata);
+ handleBidViaORTB2(reqBids, bid, profile, metadata);
}
}
@@ -786,18 +786,19 @@ function handleRubiconBid(bid, profile, metadata) {
}
/** handle generic bid via ortb2 arbitrary data
+ * @param reqBids
* @param {Object} bid
* @param {Object} profile
* @param {Object} metadata
* @returns {void}
*/
-function handleBidViaORTB2(bid, profile, metadata) {
+function handleBidViaORTB2(reqBids, bid, profile, metadata) {
if (isBoolean(metadata.user)) {
logMessage(`bidder '${bid.bidder}' is not directly supported, trying set data via bidder ortb2 fpd`);
const section = ((metadata.user) ? 'user' : 'site');
- const base = `ortb2.${section}.ext.data`;
+ const base = `${bid.bidder}.${section}.ext.data`;
- assignProfileToObject(bid, base, profile);
+ assignProfileToObject(reqBids.ortb2Fragments?.bidder, base, profile);
} else {
logMessage(`SKIP unsupported bidder '${bid.bidder}', data from '${metadata.source}' is not defined as user or site-centric`);
}
diff --git a/modules/windtalkerBidAdapter.md b/modules/windtalkerBidAdapter.md
deleted file mode 100644
index f7441effc47..00000000000
--- a/modules/windtalkerBidAdapter.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# Overview
-
-**Module Name**: Windtalker Bidder Adapter
-**Module Type**: Bidder Adapter
-**Maintainer**: corbin@windtalker.io
-
-# Description
-
-Connects to Windtalker demand source to fetch bids.
-Banner, Native, Video formats are supported.
-Please use ```windtalker``` as the bidder code.
-
-# Test Parameters
-```
- var adUnits = [{
- code: 'dfp-native-div',
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 75
- },
- image: {
- required: true
- },
- body: {
- len: 200
- },
- icon: {
- required: false
- }
- }
- },
- bids: [{
- bidder: 'windtalker',
- params: {
- pubId: '584971',
- siteId: '584971',
- placementId: '123',
- bidFloor: '0.001', // optional
- ifa: 'XXX-XXX', // optional
- latitude: '40.712775', // optional
- longitude: '-74.005973', // optional
- }
- }]
- },
- {
- code: 'dfp-banner-div',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250],[300,600]
- ],
- }
- },
- bids: [{
- bidder: 'windtalker',
- params: {
- pubId: '584971',
- siteId: '584971',
- placementId: '123',
- }
- }]
- },
- {
- code: 'dfp-video-div',
- mediaTypes: {
- video: {
- playerSize: [[640, 480]],
- context: "instream"
- }
- },
- bids: [{
- bidder: 'windtalker',
- params: {
- pubId: '584971',
- siteId: '584971',
- placementId: '123',
- video: {
- skipppable: true,
- }
- }
- }]
- }
- ];
-```
diff --git a/modules/winrBidAdapter.js b/modules/winrBidAdapter.js
index 124aba57866..3b86e5b59dc 100644
--- a/modules/winrBidAdapter.js
+++ b/modules/winrBidAdapter.js
@@ -17,6 +17,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
import {find, includes} from '../src/polyfill.js';
import {getStorageManager} from '../src/storageManager.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const BIDDER_CODE = 'winr';
const URL = 'https://ib.adnxs.com/ut/v3/prebid';
@@ -227,7 +228,8 @@ export const spec = {
if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
- rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
+ // TODO: this collects everything it finds, except for canonicalUrl
+ rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack
@@ -240,7 +242,6 @@ export const spec = {
if (bidRequests[0].userId) {
let eids = [];
- addUserId(eids, deepAccess(bidRequests[0], `userId.flocId.id`), 'chrome.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.criteoId`), 'criteo.com', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.netId`), 'netid.de', null);
addUserId(eids, deepAccess(bidRequests[0], `userId.idl_env`), 'liveramp.com', null);
@@ -356,24 +357,6 @@ function deleteValues(keyPairObj) {
}
}
-function hasPurpose1Consent(bidderRequest) {
- let result = true;
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (
- bidderRequest.gdprConsent.gdprApplies &&
- bidderRequest.gdprConsent.apiVersion === 2
- ) {
- result = !!(
- deepAccess(
- bidderRequest.gdprConsent,
- 'vendorData.purpose.consents.1'
- ) === true
- );
- }
- }
- return result;
-}
-
function formatRequest(payload, bidderRequest) {
let request = [];
let options = {
@@ -382,7 +365,7 @@ function formatRequest(payload, bidderRequest) {
let endpointUrl = URL;
- if (!hasPurpose1Consent(bidderRequest)) {
+ if (!hasPurpose1Consent(bidderRequest?.gdprConsent)) {
endpointUrl = URL_SIMPLE;
}
diff --git a/modules/xendizBidAdapter.md b/modules/xendizBidAdapter.md
deleted file mode 100644
index 4ecabe7070f..00000000000
--- a/modules/xendizBidAdapter.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Overview
-
-Module Name: Xendiz Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: hello@xendiz.com
-
-# Description
-
-Module that connects to Xendiz demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [
- {
- bidder: "xendiz",
- params: {
- pid: '00000000-0000-0000-0000-000000000000'
- }
- }
- ]
- },{
- code: 'test-div',
- sizes: [[300, 50]],
- bids: [
- {
- bidder: "xendiz",
- params: {
- pid: '00000000-0000-0000-0000-000000000000',
- ext: {
- uid: '550e8400-e29b-41d4-a716-446655440000'
- }
- }
- }
- ]
- }
- ];
-```
\ No newline at end of file
diff --git a/modules/xhbBidAdapter.md b/modules/xhbBidAdapter.md
deleted file mode 100644
index bb95f4f499c..00000000000
--- a/modules/xhbBidAdapter.md
+++ /dev/null
@@ -1,100 +0,0 @@
-# Overview
-
-```
-Module Name: XHB Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: daniel.hoffmann@xaxis.com
-```
-
-# Description
-
-Connects to Appnexus exchange for bids.
-
-XHB bid adapter supports Banner, Video (instream and outstream) and Native.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner adUnit
- {
- code: 'banner-div',
- sizes: [[300, 250], [300,600]],
- bids: [{
- bidder: 'xhb',
- params: {
- placementId: '10433394'
- }
- }]
- },
- // Native adUnit
- {
- code: 'native-div',
- sizes: [[300, 250], [300,600]],
- mediaTypes: {
- native: {
- title: {
- required: true,
- len: 80
- },
- body: {
- required: true
- },
- image: {
- required: true
- },
- clickUrl: {
- required: true
- },
- }
- },
- bids: [{
- bidder: 'xhb',
- params: {
- placementId: '9880618'
- }
- }]
- },
- // Video instream adUnit
- {
- code: 'video-instream',
- sizes: [640, 480],
- mediaTypes: {
- video: {
- context: 'instream'
- },
- },
- bids: [{
- bidder: 'xhb',
- params: {
- placementId: '9333431',
- video: {
- skippable: true,
- playback_methods: ['auto_play_sound_off']
- }
- }
- }]
- },
- // Video outstream adUnit
- {
- code: 'video-outstream',
- sizes: [[640, 480]],
- mediaTypes: {
- video: {
- context: 'outstream'
- }
- },
- bids: [
- {
- bidder: 'xhb',
- params: {
- placementId: '5768085',
- video: {
- skippable: true,
- playback_method: ['auto_play_sound_off']
- }
- }
- }
- ]
- }
-];
-```
diff --git a/modules/yahoosspBidAdapter.js b/modules/yahoosspBidAdapter.js
index b14efc9bce7..926c3317f1d 100644
--- a/modules/yahoosspBidAdapter.js
+++ b/modules/yahoosspBidAdapter.js
@@ -3,6 +3,7 @@ import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { deepAccess, isFn, isStr, isNumber, isArray, isEmpty, isPlainObject, generateUUID, logInfo, logWarn } from '../src/utils.js';
import { config } from '../src/config.js';
import { Renderer } from '../src/Renderer.js';
+import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const INTEGRATION_METHOD = 'prebid.js';
const BIDDER_CODE = 'yahoossp';
@@ -54,14 +55,6 @@ const SUPPORTED_USER_ID_SOURCES = [
];
/* Utility functions */
-function hasPurpose1Consent(bidderRequest) {
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
- return deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true;
- }
- }
- return true;
-}
function getSize(size) {
return {
@@ -239,7 +232,7 @@ function generateOpenRtbObject(bidderRequest, bid) {
cur: [getFloorModuleData(bidderRequest).currency || deepAccess(bid, 'params.bidOverride.cur') || DEFAULT_CURRENCY],
imp: [],
site: {
- page: deepAccess(bidderRequest, 'refererInfo.referer'),
+ page: deepAccess(bidderRequest, 'refererInfo.page'),
},
device: {
dnt: 0,
@@ -284,7 +277,7 @@ function generateOpenRtbObject(bidderRequest, bid) {
outBoundBidRequest.site.id = bid.params.dcn;
};
- if (config.getConfig('ortb2')) {
+ if (bidderRequest.ortb2) {
outBoundBidRequest = appendFirstPartyData(outBoundBidRequest, bid);
};
@@ -376,7 +369,7 @@ function appendImpObject(bid, openRtbObject) {
};
function appendFirstPartyData(outBoundBidRequest, bid) {
- const ortb2Object = config.getConfig('ortb2');
+ const ortb2Object = bid.ortb2;
const siteObject = deepAccess(ortb2Object, 'site') || undefined;
const siteContentObject = deepAccess(siteObject, 'content') || undefined;
const siteContentDataArray = deepAccess(siteObject, 'content.data') || undefined;
@@ -547,7 +540,7 @@ export const spec = {
}
};
- requestOptions.withCredentials = hasPurpose1Consent(bidderRequest);
+ requestOptions.withCredentials = hasPurpose1Consent(bidderRequest.gdprConsent);
const filteredBidRequests = filterBidRequestByMode(validBidRequests);
diff --git a/modules/yandexBidAdapter.js b/modules/yandexBidAdapter.js
index e20f71bc08d..ae2fb16c8ac 100644
--- a/modules/yandexBidAdapter.js
+++ b/modules/yandexBidAdapter.js
@@ -1,4 +1,4 @@
-import {parseUrl, formatQS, deepAccess} from '../src/utils.js';
+import {formatQS, deepAccess} from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
const BIDDER_CODE = 'yandex';
@@ -20,8 +20,8 @@ export const spec = {
let referrer = '';
if (bidderRequest && bidderRequest.refererInfo) {
- const url = parseUrl(bidderRequest.refererInfo.referer);
- referrer = url.hostname;
+ // TODO: is 'domain' the right value here?
+ referrer = bidderRequest.refererInfo.domain
}
return validBidRequests.map((bidRequest) => {
diff --git a/modules/yieldlabBidAdapter.js b/modules/yieldlabBidAdapter.js
index 9535461f4c7..02486a82115 100644
--- a/modules/yieldlabBidAdapter.js
+++ b/modules/yieldlabBidAdapter.js
@@ -3,7 +3,6 @@ import { registerBidder } from '../src/adapters/bidderFactory.js'
import { find } from '../src/polyfill.js'
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'
import { Renderer } from '../src/Renderer.js'
-import { config } from '../src/config.js'
const ENDPOINT = 'https://ad.yieldlab.net'
const BIDDER_CODE = 'yieldlab'
@@ -61,8 +60,9 @@ export const spec = {
})
if (bidderRequest) {
- if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
- query.pubref = bidderRequest.refererInfo.referer
+ if (bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
+ // TODO: is 'page' the right value here?
+ query.pubref = bidderRequest.refererInfo.page
}
if (bidderRequest.gdprConsent) {
@@ -334,8 +334,8 @@ function getContentObject(bid) {
return bid.params.iabContent
}
- const globalContent = config.getConfig('ortb2.site') ? config.getConfig('ortb2.site.content')
- : config.getConfig('ortb2.app.content')
+ const globalContent = deepAccess(bid, 'ortb2.site') ? deepAccess(bid, 'ortb2.site.content')
+ : deepAccess(bid, 'ortb2.app.content')
if (globalContent && isPlainObject(globalContent)) {
return globalContent
}
diff --git a/modules/yieldliftBidAdapter.js b/modules/yieldliftBidAdapter.js
index 61b99d95605..9fe1bfe84fc 100644
--- a/modules/yieldliftBidAdapter.js
+++ b/modules/yieldliftBidAdapter.js
@@ -44,9 +44,9 @@ export const spec = {
id: bidderRequest.auctionId,
imp: impressions,
site: {
- domain: window.location.hostname,
- page: window.location.href,
- ref: bidderRequest.refererInfo ? bidderRequest.refererInfo.referer || null : null
+ domain: bidderRequest.refererInfo?.domain,
+ page: bidderRequest.refererInfo?.page,
+ ref: bidderRequest.refererInfo?.ref,
},
ext: {
exchange: {
diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js
index bc29f4822c8..538de3f448d 100644
--- a/modules/yieldmoBidAdapter.js
+++ b/modules/yieldmoBidAdapter.js
@@ -66,7 +66,8 @@ export const spec = {
let serverRequest = {
pbav: '$prebid.version$',
p: [],
- page_url: bidderRequest.refererInfo.referer,
+ // TODO: is 'page' the right value here?
+ page_url: bidderRequest.refererInfo.page,
bust: new Date().getTime().toString(),
dnt: getDNT(),
description: getPageDescription(),
@@ -352,7 +353,7 @@ function openRtbRequest(bidRequests, bidderRequest) {
site: openRtbSite(bidRequests[0], bidderRequest),
device: openRtbDevice(bidRequests[0]),
badv: bidRequests[0].params.badv || [],
- bcat: bidRequests[0].params.bcat || [],
+ bcat: deepAccess(bidderRequest, 'bcat') || bidRequests[0].params.bcat || [],
ext: {
prebid: '$prebid.version$',
},
@@ -445,13 +446,13 @@ function extractPlayerSize(bidRequest) {
function openRtbSite(bidRequest, bidderRequest) {
let result = {};
- const loc = parseUrl(deepAccess(bidderRequest, 'refererInfo.referer'));
+ const loc = parseUrl(deepAccess(bidderRequest, 'refererInfo.page'));
if (!isEmpty(loc)) {
result.page = `${loc.protocol}://${loc.hostname}${loc.pathname}`;
}
- if (self === top && document.referrer) {
- result.ref = document.referrer;
+ if (bidderRequest.refererInfo?.ref) {
+ result.ref = bidderRequest.refererInfo.ref;
}
const keywords = document.getElementsByTagName('meta')['keywords'];
diff --git a/modules/yieldnexusBidAdapter.md b/modules/yieldnexusBidAdapter.md
deleted file mode 100644
index 675e8948a3e..00000000000
--- a/modules/yieldnexusBidAdapter.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Overview
-
-```
-Module Name: YieldNexus Bid Adapter
-Module Type: Bidder Adapter
-Maintainer: rtbops@yieldnexus.com
-```
-
-# Description
-
-Adds support to query the YieldNexus platform for bids. The YieldNexus platform supports banners & video.
-
-Only one parameter is required: `spid`, which provides your YieldNexus account number.
-
-# Test Parameters
-```
-var adUnits = [
- // Banner:
- {
- code: 'banner-ad-unit',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'yieldnexus',
- params: {
- spid: '1253', // your supply ID in your YieldNexus dashboard
- bidfloor: 0.03, // an optional custom bid floor
- adpos: 1, // ad position on the page (optional)
- instl: 0 // interstitial placement? (0 or 1, optional)
- }
- }]
- },
- // Outstream video:
- {
- code: 'video-ad-unit',
- sizes: [[640, 480]],
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [640, 480]
- }
- },
- bids: [ {
- bidder: 'yieldnexus',
- params: {
- spid: '1254', // your supply ID in your YieldNexus dashboard
- bidfloor: 0.03, // an optional custom bid floor
- adpos: 1, // ad position on the page (optional)
- instl: 0 // interstitial placement? (0 or 1, optional)
- }
- }]
- }
-];
-```
diff --git a/modules/yieldoneAnalyticsAdapter.js b/modules/yieldoneAnalyticsAdapter.js
index cb13503365e..126e3504f98 100644
--- a/modules/yieldoneAnalyticsAdapter.js
+++ b/modules/yieldoneAnalyticsAdapter.js
@@ -99,7 +99,8 @@ const yieldoneAnalytics = Object.assign(adapter({analyticsType}), {
if (currentAuctionId) {
const eventsStorage = yieldoneAnalytics.eventsStorage;
if (!eventsStorage[currentAuctionId]) eventsStorage[currentAuctionId] = {events: []};
- const referrer = args.refererInfo && args.refererInfo.referer;
+ // TODO: is 'page' the right value here?
+ const referrer = args.refererInfo && args.refererInfo.page;
if (referrer && referrers[currentAuctionId] !== referrer) {
referrers[currentAuctionId] = referrer;
}
diff --git a/modules/yieldoneBidAdapter.js b/modules/yieldoneBidAdapter.js
index 334de9eb3fa..69a5def17bd 100644
--- a/modules/yieldoneBidAdapter.js
+++ b/modules/yieldoneBidAdapter.js
@@ -25,7 +25,8 @@ export const spec = {
const params = bidRequest.params;
const placementId = params.placementId;
const cb = Math.floor(Math.random() * 99999999999);
- const referrer = bidderRequest.refererInfo.referer;
+ // TODO: is 'page' the right value here?
+ const referrer = bidderRequest.refererInfo.page;
const bidId = bidRequest.bidId;
const transactionId = bidRequest.transactionId;
const unitCode = bidRequest.adUnitCode;
diff --git a/modules/yuktamediaAnalyticsAdapter.js b/modules/yuktamediaAnalyticsAdapter.js
index 6872820dd48..8ff22faa7f4 100644
--- a/modules/yuktamediaAnalyticsAdapter.js
+++ b/modules/yuktamediaAnalyticsAdapter.js
@@ -18,7 +18,8 @@ const events = {
const localStoragePrefix = 'yuktamediaAnalytics_';
const utmTags = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
const location = getWindowLocation();
-const referer = getRefererInfo().referer;
+// TODO: is 'page' the right value here?
+const referer = getRefererInfo().page;
const _pageInfo = {
userAgent: window.navigator.userAgent,
timezoneOffset: new Date().getTimezoneOffset(),
diff --git a/modules/zedoBidAdapter.md b/modules/zedoBidAdapter.md
deleted file mode 100644
index 2f31e8aed9b..00000000000
--- a/modules/zedoBidAdapter.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Overview
-
-Module Name: ZEDO Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: prebidsupport@zedo.com
-
-# Description
-
-Module that connects to ZEDO's demand sources.
-
-ZEDO supports both display and video.
-For video integration, ZEDO returns content as vastXML and requires the publisher to define the cache url in config passed to Prebid for it to be valid in the auction
-
-ZEDO has its own renderer and will render the video unit if not defined in the config.
-
-
-# Test Parameters
-# display
-```
-
- var adUnits = [{
- code: 'div-gpt-ad-1460505748561-0',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300,600]],
- }
- },
- // Replace this object to test a new Adapter!
- bids: [{
- bidder: 'zedo',
- params: {
- channelCode: 2264004735, //REQUIRED
- dimId:9 //REQUIRED
- }
- }]
-
- }];
-```
-# video
-```
-
- var adUnit1 = [
- {
- code: 'videoAdUnit',
- mediaTypes:
- {
- video:
- {
- context: 'outstream',
- playerSize: [640, 480]
- }
- },
- bids: [
- {
- bidder: 'zedo',
- params:
- {
- channelCode: 2264004735, // required
- dimId: 85, // required
- pubId: 1 // optional
- }
- }
- ]
- }];
-```
\ No newline at end of file
diff --git a/modules/zetaBidAdapter.js b/modules/zetaBidAdapter.js
index 27650888677..159ea42cead 100644
--- a/modules/zetaBidAdapter.js
+++ b/modules/zetaBidAdapter.js
@@ -1,4 +1,4 @@
-import { logWarn } from '../src/utils.js';
+import { logWarn, deepAccess } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
const BIDDER_CODE = 'zeta_global';
@@ -84,7 +84,7 @@ export const spec = {
allimps: params.allimps,
cur: [DEFAULT_CUR],
wlang: params.wlang,
- bcat: params.bcat,
+ bcat: deepAccess(bidderRequest.ortb2Imp, 'bcat') || params.bcat,
badv: params.badv,
bapp: params.bapp,
source: params.source ? params.source : {},
@@ -94,7 +94,7 @@ export const spec = {
payload.device.ua = navigator.userAgent;
payload.device.ip = navigator.ip;
- payload.site.page = bidderRequest.refererInfo.referer;
+ payload.site.page = bidderRequest.refererInfo.page;
payload.site.mobile = /(ios|ipod|ipad|iphone|android)/i.test(navigator.userAgent) ? 1 : 0;
payload.ext.definerId = params.definerId;
diff --git a/modules/zetaSspBidAdapter.md b/modules/zetaSspBidAdapter.md
deleted file mode 100644
index 00d8663586c..00000000000
--- a/modules/zetaSspBidAdapter.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Overview
-
-```
-Module Name: Zeta Ssp Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: miakovlev@zetaglobal.com
-```
-
-# Description
-
-Module that connects to Zeta's SSP
-
-# Banner Ad Unit: For Publishers
-```
- var adUnits = [
- {
- mediaTypes: {
- banner: {
- sizes: [[300, 250]], // a display size
- }
- },
- bids: [
- {
- bidder: 'zeta_global_ssp',
- bidId: 12345,
- params: {
- placement: 12345,
- user: {
- uid: 12345,
- buyeruid: 12345
- },
- tags: {
- someTag: 123,
- sid: 'publisherId'
- },
- test: 1
- }
- }
- ]
- }
- ];
-```
-
-# Video Ad Unit: For Publishers
-```
- var adUnits = [
- {
- mediaTypes: {
- video: {
- playerSize: [640, 480],
- context: 'outstream'
- }
- },
- bids: [
- {
- bidder: 'zeta_global_ssp',
- bidId: 12345,
- params: {
- placement: 12345,
- user: {
- uid: 12345,
- buyeruid: 12345
- },
- tags: {
- someTag: 123,
- sid: 'publisherId'
- },
- test: 1
- }
- }
- ]
- }
- ];
-```
diff --git a/modules/zeta_global_sspBidAdapter.js b/modules/zeta_global_sspBidAdapter.js
index 114bb86b4d6..86b28021bab 100644
--- a/modules/zeta_global_sspBidAdapter.js
+++ b/modules/zeta_global_sspBidAdapter.js
@@ -2,6 +2,7 @@ import {deepAccess, deepSetValue, isArray, isBoolean, isNumber, isStr, logWarn}
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
+import {parseDomain} from '../src/refererDetection.js';
const BIDDER_CODE = 'zeta_global_ssp';
const ENDPOINT_URL = 'https://ssp.disqus.com/bid';
@@ -89,13 +90,12 @@ export const spec = {
if (!impData.banner && !impData.video) {
impData.banner = buildBanner(request);
}
- const fpd = config.getLegacyFpd(config.getConfig('ortb2')) || {};
let payload = {
id: bidderRequest.auctionId,
cur: [DEFAULT_CUR],
imp: [impData],
site: params.site ? params.site : {},
- device: {...fpd.device, ...params.device},
+ device: {...(bidderRequest.ortb2?.device || {}), ...params.device},
user: params.user ? params.user : {},
app: params.app ? params.app : {},
ext: {
@@ -104,8 +104,9 @@ export const spec = {
}
};
const rInfo = bidderRequest.refererInfo;
- payload.site.page = config.getConfig('pageUrl') || ((rInfo && rInfo.referer) ? rInfo.referer.trim() : window.location.href);
- payload.site.domain = config.getConfig('publisherDomain') || getDomainFromURL(payload.site.page);
+ // TODO: do the fallbacks make sense here?
+ payload.site.page = rInfo.page || rInfo.topmostLocation;
+ payload.site.domain = parseDomain(payload.site.page, {noLeadingWww: true});
payload.device.ua = navigator.userAgent;
payload.device.language = navigator.language;
@@ -269,16 +270,6 @@ function provideEids(request, payload) {
}
}
-function getDomainFromURL(url) {
- let anchor = document.createElement('a');
- anchor.href = url;
- let hostname = anchor.hostname;
- if (hostname.indexOf('www.') === 0) {
- return hostname.substring(4);
- }
- return hostname;
-}
-
function provideMediaType(zetaBid, bid) {
if (zetaBid.ext && zetaBid.ext.bidtype) {
if (zetaBid.ext.bidtype === VIDEO) {
diff --git a/package-lock.json b/package-lock.json
index f2e39fe52c0..4fef6dae305 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
"packages": {
"": {
"name": "prebid.js",
- "version": "6.25.0-pre",
+ "version": "6.28.0-pre",
"license": "Apache-2.0",
"dependencies": {
"@babel/core": "^7.16.7",
@@ -58,8 +58,6 @@
"gulp-concat": "^2.6.0",
"gulp-connect": "^5.7.0",
"gulp-eslint": "^4.0.0",
- "gulp-footer": "^2.0.2",
- "gulp-header": "^2.0.9",
"gulp-if": "^3.0.0",
"gulp-js-escape": "^1.0.1",
"gulp-replace": "^1.0.0",
@@ -9227,6 +9225,18 @@
"node": ">=4"
}
},
+ "node_modules/external-editor/node_modules/tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "dependencies": {
+ "os-tmpdir": "~1.0.2"
+ },
+ "engines": {
+ "node": ">=0.6.0"
+ }
+ },
"node_modules/extglob": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
@@ -12134,6 +12144,18 @@
"string-width": "^2.1.1"
}
},
+ "node_modules/gulp-eslint/node_modules/tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "dependencies": {
+ "os-tmpdir": "~1.0.2"
+ },
+ "engines": {
+ "node": ">=0.6.0"
+ }
+ },
"node_modules/gulp-eslint/node_modules/type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
@@ -12164,38 +12186,6 @@
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true
},
- "node_modules/gulp-footer": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/gulp-footer/-/gulp-footer-2.1.0.tgz",
- "integrity": "sha512-CK3nRBP3PG59XN2L1rDLkBHA7goYsW+tJuVQccLP9jq3mpBT2kuRq0ImgNjrUkDbF948aCVQH4J7uIEqiZ2MHA==",
- "dev": true,
- "dependencies": {
- "lodash": "^4.17.21",
- "map-stream": "^0.0.7"
- }
- },
- "node_modules/gulp-header": {
- "version": "2.0.9",
- "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.9.tgz",
- "integrity": "sha512-LMGiBx+qH8giwrOuuZXSGvswcIUh0OiioNkUpLhNyvaC6/Ga8X6cfAeme2L5PqsbXMhL8o8b/OmVqIQdxprhcQ==",
- "dev": true,
- "dependencies": {
- "concat-with-sourcemaps": "^1.1.0",
- "lodash.template": "^4.5.0",
- "map-stream": "0.0.7",
- "through2": "^2.0.0"
- }
- },
- "node_modules/gulp-header/node_modules/through2": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
- "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
- "dev": true,
- "dependencies": {
- "readable-stream": "~2.3.6",
- "xtend": "~4.0.1"
- }
- },
"node_modules/gulp-if": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
@@ -15109,18 +15099,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/karma/node_modules/tmp": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
- "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
- "dev": true,
- "dependencies": {
- "rimraf": "^3.0.0"
- },
- "engines": {
- "node": ">=8.17.0"
- }
- },
"node_modules/karma/node_modules/yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
@@ -21524,15 +21502,15 @@
}
},
"node_modules/tmp": {
- "version": "0.0.33",
- "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
- "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dev": true,
"dependencies": {
- "os-tmpdir": "~1.0.2"
+ "rimraf": "^3.0.0"
},
"engines": {
- "node": ">=0.6.0"
+ "node": ">=8.17.0"
}
},
"node_modules/to-absolute-glob": {
@@ -30610,6 +30588,17 @@
"chardet": "^0.7.0",
"iconv-lite": "^0.4.24",
"tmp": "^0.0.33"
+ },
+ "dependencies": {
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ }
}
},
"extglob": {
@@ -32959,6 +32948,15 @@
"string-width": "^2.1.1"
}
},
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
"type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
@@ -32985,40 +32983,6 @@
}
}
},
- "gulp-footer": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/gulp-footer/-/gulp-footer-2.1.0.tgz",
- "integrity": "sha512-CK3nRBP3PG59XN2L1rDLkBHA7goYsW+tJuVQccLP9jq3mpBT2kuRq0ImgNjrUkDbF948aCVQH4J7uIEqiZ2MHA==",
- "dev": true,
- "requires": {
- "lodash": "^4.17.21",
- "map-stream": "^0.0.7"
- }
- },
- "gulp-header": {
- "version": "2.0.9",
- "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.9.tgz",
- "integrity": "sha512-LMGiBx+qH8giwrOuuZXSGvswcIUh0OiioNkUpLhNyvaC6/Ga8X6cfAeme2L5PqsbXMhL8o8b/OmVqIQdxprhcQ==",
- "dev": true,
- "requires": {
- "concat-with-sourcemaps": "^1.1.0",
- "lodash.template": "^4.5.0",
- "map-stream": "0.0.7",
- "through2": "^2.0.0"
- },
- "dependencies": {
- "through2": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
- "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
- "dev": true,
- "requires": {
- "readable-stream": "~2.3.6",
- "xtend": "~4.0.1"
- }
- }
- }
- },
"gulp-if": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
@@ -34981,15 +34945,6 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
- "tmp": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
- "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
- "dev": true,
- "requires": {
- "rimraf": "^3.0.0"
- }
- },
"yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
@@ -40390,12 +40345,12 @@
}
},
"tmp": {
- "version": "0.0.33",
- "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
- "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dev": true,
"requires": {
- "os-tmpdir": "~1.0.2"
+ "rimraf": "^3.0.0"
}
},
"to-absolute-glob": {
diff --git a/package.json b/package.json
index 9ed99684105..0a8d26e5012 100644
--- a/package.json
+++ b/package.json
@@ -68,8 +68,6 @@
"gulp-concat": "^2.6.0",
"gulp-connect": "^5.7.0",
"gulp-eslint": "^4.0.0",
- "gulp-footer": "^2.0.2",
- "gulp-header": "^2.0.9",
"gulp-if": "^3.0.0",
"gulp-js-escape": "^1.0.1",
"gulp-replace": "^1.0.0",
diff --git a/src/adapterManager.js b/src/adapterManager.js
index 8ddffcd24e7..311e936688a 100644
--- a/src/adapterManager.js
+++ b/src/adapterManager.js
@@ -17,7 +17,7 @@ import {
logError,
logInfo,
logMessage,
- logWarn,
+ logWarn, mergeDeep,
shuffle,
timestamp,
} from './utils.js';
@@ -68,8 +68,7 @@ function getBids({bidderCode, auctionId, bidderRequestId, adUnits, src}) {
'nativeParams',
'ortb2Imp',
'mediaType',
- 'renderer',
- 'storedAuctionResponse'
+ 'renderer'
]));
const mediaTypes = bid.mediaTypes == null ? adUnit.mediaTypes : bid.mediaTypes
@@ -206,7 +205,7 @@ export function _partitionBidders (adUnits, s2sConfigs, {getS2SBidders = getS2SB
export const partitionBidders = hook('sync', _partitionBidders, 'partitionBidders');
-adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels) {
+adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}) {
/**
* emit and pass adunits for external modification
* @see {@link https://github.com/prebid/Prebid.js/issues/4149|Issue}
@@ -224,6 +223,16 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
let bidRequests = [];
+ const ortb2 = ortb2Fragments.global || {};
+ const bidderOrtb2 = ortb2Fragments.bidder || {};
+
+ function addOrtb2(bidderRequest) {
+ const fpd = Object.freeze(mergeDeep({}, ortb2, bidderOrtb2[bidderRequest.bidderCode]));
+ bidderRequest.ortb2 = fpd;
+ bidderRequest.bids.forEach((bid) => bid.ortb2 = fpd);
+ return bidderRequest;
+ }
+
_s2sConfigs.forEach(s2sConfig => {
if (s2sConfig && s2sConfig.enabled) {
let adUnitsS2SCopy = getAdUnitCopyForPrebidServer(adUnits, s2sConfig);
@@ -232,7 +241,7 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
let uniquePbsTid = generateUUID();
serverBidders.forEach(bidderCode => {
const bidderRequestId = getUniqueIdentifierStr();
- const bidderRequest = {
+ const bidderRequest = addOrtb2({
bidderCode,
auctionId,
bidderRequestId,
@@ -241,8 +250,8 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
auctionStart: auctionStart,
timeout: s2sConfig.timeout,
src: CONSTANTS.S2S.SRC,
- refererInfo
- };
+ refererInfo,
+ });
if (bidderRequest.bids.length !== 0) {
bidRequests.push(bidderRequest);
}
@@ -269,15 +278,15 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
let adUnitsClientCopy = getAdUnitCopyForClientAdapters(adUnits);
clientBidders.forEach(bidderCode => {
const bidderRequestId = getUniqueIdentifierStr();
- const bidderRequest = {
+ const bidderRequest = addOrtb2({
bidderCode,
auctionId,
bidderRequestId,
bids: hookedGetBids({bidderCode, auctionId, bidderRequestId, 'adUnits': deepClone(adUnitsClientCopy), labels, src: 'client'}),
auctionStart: auctionStart,
timeout: cbTimeout,
- refererInfo
- };
+ refererInfo,
+ });
const adapter = _bidderRegistry[bidderCode];
if (!adapter) {
logError(`Trying to make a request for bidder that does not exist: ${bidderCode}`);
@@ -302,7 +311,7 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
return bidRequests;
}, 'makeBidRequests');
-adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, requestCallbacks, requestBidsTimeout, onTimelyResponse) => {
+adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, requestCallbacks, requestBidsTimeout, onTimelyResponse, ortb2Fragments = {}) => {
if (!bidRequests.length) {
logWarn('callBids executed with no bidRequests. Were they filtered by labels or sizing?');
return;
@@ -346,7 +355,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
let uniqueServerRequests = serverBidRequests.filter(serverBidRequest => serverBidRequest.uniquePbsTid === uniquePbsTid);
if (s2sAdapter) {
- let s2sBidRequest = {tid: sourceTid, 'ad_units': adUnitsS2SCopy, s2sConfig};
+ let s2sBidRequest = {tid: sourceTid, 'ad_units': adUnitsS2SCopy, s2sConfig, ortb2Fragments};
if (s2sBidRequest.ad_units.length) {
let doneCbs = uniqueServerRequests.map(bidRequest => {
bidRequest.start = timestamp();
diff --git a/src/adapters/bidderFactory.js b/src/adapters/bidderFactory.js
index 382c93b0d25..20e7c11c28f 100644
--- a/src/adapters/bidderFactory.js
+++ b/src/adapters/bidderFactory.js
@@ -257,10 +257,10 @@ export function newBidder(spec) {
});
function isInvalidAlternateBidder(responseBidder, requestBidder) {
- let allowAlternateBidderCodes = bidderSettings.get(requestBidder, 'allowAlternateBidderCodes');
+ let allowAlternateBidderCodes = bidderSettings.get(requestBidder, 'allowAlternateBidderCodes') || false;
let alternateBiddersList = bidderSettings.get(requestBidder, 'allowedAlternateBidderCodes');
if (!!responseBidder && !!requestBidder && requestBidder !== responseBidder) {
- if ((allowAlternateBidderCodes !== undefined && !allowAlternateBidderCodes) || (isArray(alternateBiddersList) && (alternateBiddersList[0] !== '*' && !alternateBiddersList.includes(responseBidder)))) {
+ if (!allowAlternateBidderCodes || (isArray(alternateBiddersList) && (alternateBiddersList[0] !== '*' && !alternateBiddersList.includes(responseBidder)))) {
return true;
}
}
diff --git a/src/auction.js b/src/auction.js
index 03ddd25c048..c22e336d7ab 100644
--- a/src/auction.js
+++ b/src/auction.js
@@ -103,10 +103,11 @@ const queuedCalls = [];
* @param {number} requestConfig.cbTimeout
* @param {Array.} requestConfig.labels
* @param {string} requestConfig.auctionId
- *
+ * @param {{global: {}, bidder: {}}} ortb2Fragments first party data, separated into global
+ * (from getConfig('ortb2') + requestBids({ortb2})) and bidder (a map from bidderCode to ortb2)
* @returns {Auction} auction instance
*/
-export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, auctionId}) {
+export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, auctionId, ortb2Fragments}) {
let _adUnits = adUnits;
let _labels = labels;
let _adUnitCodes = adUnitCodes;
@@ -215,7 +216,7 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, a
_auctionStatus = AUCTION_STARTED;
_auctionStart = Date.now();
- let bidRequests = adapterManager.makeBidRequests(_adUnits, _auctionStart, _auctionId, _timeout, _labels);
+ let bidRequests = adapterManager.makeBidRequests(_adUnits, _auctionStart, _auctionId, _timeout, _labels, ortb2Fragments);
logInfo(`Bids Requested for Auction with id: ${_auctionId}`, bidRequests);
if (bidRequests.length < 1) {
@@ -272,7 +273,7 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, a
}
}
}
- }, _timeout, onTimelyResponse);
+ }, _timeout, onTimelyResponse, ortb2Fragments);
}
};
@@ -348,7 +349,7 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, a
getBidRequests: () => _bidderRequests,
getBidsReceived: () => _bidsReceived,
getNoBids: () => _noBids,
-
+ getFPD: () => ortb2Fragments
}
}
diff --git a/src/auctionManager.js b/src/auctionManager.js
index 5abcf0f9129..6d60f28946c 100644
--- a/src/auctionManager.js
+++ b/src/auctionManager.js
@@ -87,8 +87,8 @@ export function newAuctionManager() {
.filter(uniques);
};
- auctionManager.createAuction = function({ adUnits, adUnitCodes, callback, cbTimeout, labels, auctionId }) {
- const auction = newAuction({ adUnits, adUnitCodes, callback, cbTimeout, labels, auctionId });
+ auctionManager.createAuction = function(opts) {
+ const auction = newAuction(opts);
_addAuction(auction);
return auction;
};
diff --git a/src/config.js b/src/config.js
index 484051b2362..2403719557f 100644
--- a/src/config.js
+++ b/src/config.js
@@ -22,7 +22,6 @@ import CONSTANTS from './constants.json';
const DEFAULT_DEBUG = getParameterByName(CONSTANTS.DEBUG_MODE).toUpperCase() === 'TRUE';
const DEFAULT_BIDDER_TIMEOUT = 3000;
-const DEFAULT_PUBLISHER_DOMAIN = window.location.origin;
const DEFAULT_ENABLE_SEND_ALL_BIDS = true;
const DEFAULT_DISABLE_AJAX_TIMEOUT = false;
const DEFAULT_BID_CACHE = false;
@@ -86,12 +85,12 @@ export function newConfig() {
this._bidderTimeout = val;
},
- // domain where prebid is running for cross domain iframe communication
- _publisherDomain: DEFAULT_PUBLISHER_DOMAIN,
+ _publisherDomain: null,
get publisherDomain() {
return this._publisherDomain;
},
set publisherDomain(val) {
+ logWarn('publisherDomain is deprecated and has no effect since v7 - use pageUrl instead')
this._publisherDomain = val;
},
@@ -313,42 +312,52 @@ export function newConfig() {
return Object.assign({}, config);
}
- /*
- * Returns the configuration object if called without parameters,
- * or single configuration property if given a string matching a configuration
- * property name. Allows deep access e.g. getConfig('currency.adServerCurrency')
- *
- * If called with callback parameter, or a string and a callback parameter,
- * subscribes to configuration updates. See `subscribe` function for usage.
- *
- * The object returned is a deepClone of the `config` property.
- */
- function readConfig(...args) {
- if (args.length <= 1 && typeof args[0] !== 'function') {
- const option = args[0];
- const configClone = deepClone(_getConfig());
- return option ? deepAccess(configClone, option) : configClone;
- }
-
- return subscribe(...args);
+ function _getRestrictedConfig() {
+ // This causes reading 'ortb2' to throw an error; with prebid 7, that will almost
+ // always be the incorrect way to access FPD configuration (https://github.com/prebid/Prebid.js/issues/7651)
+ // code that needs the ortb2 config should explicitly use `getAnyConfig`
+ // TODO: this is meant as a temporary tripwire to catch inadvertent use of `getConfig('ortb')` as we transition.
+ // It should be removed once the risk of that happening is low enough.
+ const conf = _getConfig();
+ Object.defineProperty(conf, 'ortb2', {
+ get: function () {
+ throw new Error('invalid access to \'orbt2\' config - use request parameters instead');
+ }
+ });
+ return conf;
}
- /*
- * Returns configuration object if called without parameters,
- * or single configuration property if given a string matching a configuration
- * property name. Allows deep access e.g. getConfig('currency.adServerCurrency')
- *
- * If called with callback parameter, or a string and a callback parameter,
- * subscribes to configuration updates. See `subscribe` function for usage.
- */
- function getConfig(...args) {
- if (args.length <= 1 && typeof args[0] !== 'function') {
- const option = args[0];
- return option ? deepAccess(_getConfig(), option) : _getConfig();
- }
+ const [getAnyConfig, getConfig] = [_getConfig, _getRestrictedConfig].map(accessor => {
+ /*
+ * Returns configuration object if called without parameters,
+ * or single configuration property if given a string matching a configuration
+ * property name. Allows deep access e.g. getConfig('currency.adServerCurrency')
+ *
+ * If called with callback parameter, or a string and a callback parameter,
+ * subscribes to configuration updates. See `subscribe` function for usage.
+ */
+ return function getConfig(...args) {
+ if (args.length <= 1 && typeof args[0] !== 'function') {
+ const option = args[0];
+ return option ? deepAccess(accessor(), option) : _getConfig();
+ }
- return subscribe(...args);
- }
+ return subscribe(...args);
+ }
+ })
+
+ const [readConfig, readAnyConfig] = [getConfig, getAnyConfig].map(wrapee => {
+ /*
+ * Like getConfig, except that it returns a deepClone of the result.
+ */
+ return function readConfig(...args) {
+ let res = wrapee(...args);
+ if (res && typeof res === 'object') {
+ res = deepClone(res);
+ }
+ return res;
+ }
+ })
/**
* Internal API for modules (such as prebid-server) that might need access to all bidder config
@@ -357,119 +366,6 @@ export function newConfig() {
return bidderConfig;
}
- /**
- * Returns backwards compatible FPD data for modules
- */
- function getLegacyFpd(obj) {
- if (typeof obj !== 'object') return;
-
- let duplicate = {};
-
- Object.keys(obj).forEach((type) => {
- let prop = (type === 'site') ? 'context' : type;
- duplicate[prop] = (prop === 'context' || prop === 'user') ? Object.keys(obj[type]).filter(key => key !== 'data').reduce((result, key) => {
- if (key === 'ext') {
- mergeDeep(result, obj[type][key]);
- } else {
- mergeDeep(result, {[key]: obj[type][key]});
- }
-
- return result;
- }, {}) : obj[type];
- });
-
- return duplicate;
- }
-
- /**
- * Returns backwards compatible FPD data for modules
- */
- function getLegacyImpFpd(obj) {
- if (typeof obj !== 'object') return;
-
- let duplicate = {};
-
- if (deepAccess(obj, 'ext.data')) {
- Object.keys(obj.ext.data).forEach((key) => {
- if (key === 'pbadslot') {
- mergeDeep(duplicate, {context: {pbAdSlot: obj.ext.data[key]}});
- } else if (key === 'adserver') {
- mergeDeep(duplicate, {context: {adServer: obj.ext.data[key]}});
- } else {
- mergeDeep(duplicate, {context: {data: {[key]: obj.ext.data[key]}}});
- }
- });
- }
-
- return duplicate;
- }
-
- /**
- * Copy FPD over to OpenRTB standard format in config
- */
- function convertFpd(opt) {
- let duplicate = {};
-
- Object.keys(opt).forEach((type) => {
- let prop = (type === 'context') ? 'site' : type;
- duplicate[prop] = (prop === 'site' || prop === 'user') ? Object.keys(opt[type]).reduce((result, key) => {
- if (key === 'data') {
- mergeDeep(result, {ext: {data: opt[type][key]}});
- } else {
- mergeDeep(result, {[key]: opt[type][key]});
- }
-
- return result;
- }, {}) : opt[type];
- });
-
- return duplicate;
- }
-
- /**
- * Copy Impression FPD over to OpenRTB standard format in config
- * Only accepts bid level context.data values with pbAdSlot and adServer exceptions
- */
- function convertImpFpd(opt) {
- let duplicate = {};
-
- Object.keys(opt).filter(prop => prop === 'context').forEach((type) => {
- Object.keys(opt[type]).forEach((key) => {
- if (key === 'data') {
- mergeDeep(duplicate, {ext: {data: opt[type][key]}});
- } else {
- if (typeof opt[type][key] === 'object' && !Array.isArray(opt[type][key])) {
- Object.keys(opt[type][key]).forEach(data => {
- mergeDeep(duplicate, {ext: {data: {[key.toLowerCase()]: {[data.toLowerCase()]: opt[type][key][data]}}}});
- });
- } else {
- mergeDeep(duplicate, {ext: {data: {[key.toLowerCase()]: opt[type][key]}}});
- }
- }
- });
- });
-
- return duplicate;
- }
-
- /**
- * Copy FPD over to OpenRTB standard format in each adunit
- */
- function convertAdUnitFpd(arr) {
- let convert = [];
-
- arr.forEach((adunit) => {
- if (adunit.fpd) {
- (adunit['ortb2Imp']) ? mergeDeep(adunit['ortb2Imp'], convertImpFpd(adunit.fpd)) : adunit['ortb2Imp'] = convertImpFpd(adunit.fpd);
- convert.push((({ fpd, ...duplicate }) => duplicate)(adunit));
- } else {
- convert.push(adunit);
- }
- });
-
- return convert;
- }
-
/*
* Sets configuration given an object containing key-value pairs and calls
* listeners that were added by the `subscribe` function
@@ -484,14 +380,13 @@ export function newConfig() {
let topicalConfig = {};
topics.forEach(topic => {
- let prop = (topic === 'fpd') ? 'ortb2' : topic;
- let option = (topic === 'fpd') ? convertFpd(options[topic]) : options[topic];
+ let option = options[topic];
- if (isPlainObject(defaults[prop]) && isPlainObject(option)) {
- option = Object.assign({}, defaults[prop], option);
+ if (isPlainObject(defaults[topic]) && isPlainObject(option)) {
+ option = Object.assign({}, defaults[topic], option);
}
- topicalConfig[prop] = config[prop] = option;
+ topicalConfig[topic] = config[topic] = option;
});
callSubscribers(topicalConfig);
@@ -584,14 +479,13 @@ export function newConfig() {
bidderConfig[bidder] = {};
}
Object.keys(config.config).forEach(topic => {
- let prop = (topic === 'fpd') ? 'ortb2' : topic;
- let option = (topic === 'fpd') ? convertFpd(config.config[topic]) : config.config[topic];
+ let option = config.config[topic];
if (isPlainObject(option)) {
const func = mergeFlag ? mergeDeep : Object.assign;
- bidderConfig[bidder][prop] = func({}, bidderConfig[bidder][prop] || {}, option);
+ bidderConfig[bidder][topic] = func({}, bidderConfig[bidder][topic] || {}, option);
} else {
- bidderConfig[bidder][prop] = option;
+ bidderConfig[bidder][topic] = option;
}
});
});
@@ -669,7 +563,9 @@ export function newConfig() {
getCurrentBidder,
resetBidder,
getConfig,
+ getAnyConfig,
readConfig,
+ readAnyConfig,
setConfig,
mergeConfig,
setDefaults,
@@ -679,9 +575,6 @@ export function newConfig() {
setBidderConfig,
getBidderConfig,
mergeBidderConfig,
- convertAdUnitFpd,
- getLegacyFpd,
- getLegacyImpFpd
};
}
diff --git a/src/prebid.js b/src/prebid.js
index 83b3b4580ef..367695ccf9f 100644
--- a/src/prebid.js
+++ b/src/prebid.js
@@ -5,7 +5,7 @@ import {
adUnitsFilter, flatten, getHighestCpm, isArrayOfNums, isGptPubadsDefined, uniques, logInfo,
contains, logError, isArray, deepClone, deepAccess, isNumber, logWarn, logMessage, isFn,
transformAdServerTargetingObj, bind, replaceAuctionPrice, replaceClickThrough, insertElement,
- inIframe, callBurl, createInvisibleIframe, generateUUID, unsupportedBidderMessage, isEmpty
+ inIframe, callBurl, createInvisibleIframe, generateUUID, unsupportedBidderMessage, isEmpty, mergeDeep
} from './utils.js';
import { listenMessagesFromCreative } from './secureCreatives.js';
import { userSync } from './userSync.js';
@@ -570,15 +570,21 @@ $$PREBID_GLOBAL$$.removeAdUnit = function (adUnitCode) {
* @param {String} requestOptions.auctionId
* @alias module:pbjs.requestBids
*/
-$$PREBID_GLOBAL$$.requestBids = hook('async', function ({ bidsBackHandler, timeout, adUnits, adUnitCodes, labels, auctionId } = {}) {
+$$PREBID_GLOBAL$$.requestBids = hook('async', function ({ bidsBackHandler, timeout, adUnits, adUnitCodes, labels, auctionId, ortb2 } = {}) {
events.emit(REQUEST_BIDS);
const cbTimeout = timeout || config.getConfig('bidderTimeout');
- adUnits = (adUnits && config.convertAdUnitFpd(isArray(adUnits) ? adUnits : [adUnits])) || $$PREBID_GLOBAL$$.adUnits;
-
+ adUnits = adUnits || $$PREBID_GLOBAL$$.adUnits;
+ adUnits = (isArray(adUnits) ? adUnits : [adUnits]);
logInfo('Invoking $$PREBID_GLOBAL$$.requestBids', arguments);
+ const ortb2Fragments = {
+ global: mergeDeep({}, config.getAnyConfig('ortb2') || {}, ortb2 || {}),
+ bidder: Object.fromEntries(Object.entries(config.getBidderConfig()).map(([bidder, cfg]) => [bidder, cfg.ortb2]).filter(([_, ortb2]) => ortb2 != null))
+ }
+ return startAuction({bidsBackHandler, timeout: cbTimeout, adUnits, adUnitCodes, labels, auctionId, ortb2Fragments});
+});
+export const startAuction = hook('async', function ({ bidsBackHandler, timeout: cbTimeout, adUnits, adUnitCodes, labels, auctionId, ortb2Fragments } = {}) {
const s2sBidders = getS2SBidderSet(config.getConfig('s2sConfig') || []);
-
adUnits = checkAdUnitSetup(adUnits);
if (adUnitCodes && adUnitCodes.length) {
@@ -639,7 +645,15 @@ $$PREBID_GLOBAL$$.requestBids = hook('async', function ({ bidsBackHandler, timeo
return;
}
- const auction = auctionManager.createAuction({ adUnits, adUnitCodes, callback: bidsBackHandler, cbTimeout, labels, auctionId });
+ const auction = auctionManager.createAuction({
+ adUnits,
+ adUnitCodes,
+ callback: bidsBackHandler,
+ cbTimeout,
+ labels,
+ auctionId,
+ ortb2Fragments
+ });
let adUnitsLen = adUnits.length;
if (adUnitsLen > 15) {
@@ -648,7 +662,7 @@ $$PREBID_GLOBAL$$.requestBids = hook('async', function ({ bidsBackHandler, timeo
adUnitCodes.forEach(code => targeting.setLatestAuctionForAdUnit(code, auction.getAuctionId()));
auction.callBids();
-});
+}, 'startAuction');
export function executeCallbacks(fn, reqBidsConfigObj) {
runAll(storageCallbacks);
@@ -674,7 +688,7 @@ $$PREBID_GLOBAL$$.requestBids.before(executeCallbacks, 49);
*/
$$PREBID_GLOBAL$$.addAdUnits = function (adUnitArr) {
logInfo('Invoking $$PREBID_GLOBAL$$.addAdUnits', arguments);
- $$PREBID_GLOBAL$$.adUnits.push.apply($$PREBID_GLOBAL$$.adUnits, config.convertAdUnitFpd(isArray(adUnitArr) ? adUnitArr : [adUnitArr]));
+ $$PREBID_GLOBAL$$.adUnits.push.apply($$PREBID_GLOBAL$$.adUnits, isArray(adUnitArr) ? adUnitArr : [adUnitArr]);
// emit event
events.emit(ADD_AD_UNITS);
};
@@ -913,56 +927,16 @@ $$PREBID_GLOBAL$$.markWinningBidAsUsed = function (markBidRequest) {
* @param {Object} options
* @alias module:pbjs.getConfig
*/
-$$PREBID_GLOBAL$$.getConfig = config.getConfig;
-$$PREBID_GLOBAL$$.readConfig = config.readConfig;
+$$PREBID_GLOBAL$$.getConfig = config.getAnyConfig;
+$$PREBID_GLOBAL$$.readConfig = config.readAnyConfig;
$$PREBID_GLOBAL$$.mergeConfig = config.mergeConfig;
$$PREBID_GLOBAL$$.mergeBidderConfig = config.mergeBidderConfig;
/**
* Set Prebid config options.
- * (Added in version 0.27.0).
- *
- * `setConfig` is designed to allow for advanced configuration while
- * reducing the surface area of the public API. For more information
- * about the move to `setConfig` (and the resulting deprecations of
- * some other public methods), see [the Prebid 1.0 public API
- * proposal](https://gist.github.com/mkendall07/51ee5f6b9f2df01a89162cf6de7fe5b6).
- *
- * #### Troubleshooting your configuration
- *
- * If you call `pbjs.setConfig` without an object, e.g.,
- *
- * `pbjs.setConfig('debug', 'true'))`
- *
- * then Prebid.js will print an error to the console that says:
- *
- * ```
- * ERROR: setConfig options must be an object
- * ```
- *
- * If you don't see that message, you can assume the config object is valid.
+ * See https://docs.prebid.org/dev-docs/publisher-api-reference/setConfig.html
*
* @param {Object} options Global Prebid configuration object. Must be JSON - no JavaScript functions are allowed.
- * @param {string} options.bidderSequence The order in which bidders are called. Example: `pbjs.setConfig({ bidderSequence: "fixed" })`. Allowed values: `"fixed"` (order defined in `adUnit.bids` array on page), `"random"`.
- * @param {boolean} options.debug Turn debug logging on/off. Example: `pbjs.setConfig({ debug: true })`.
- * @param {string} options.priceGranularity The bid price granularity to use. Example: `pbjs.setConfig({ priceGranularity: "medium" })`. Allowed values: `"low"` ($0.50), `"medium"` ($0.10), `"high"` ($0.01), `"auto"` (sliding scale), `"dense"` (like `"auto"`, with smaller increments at lower CPMs), or a custom price bucket object, e.g., `{ "buckets" : [{"min" : 0,"max" : 20,"increment" : 0.1,"cap" : true}]}`.
- * @param {boolean} options.enableSendAllBids Turn "send all bids" mode on/off. Example: `pbjs.setConfig({ enableSendAllBids: true })`.
- * @param {number} options.bidderTimeout Set a global bidder timeout, in milliseconds. Example: `pbjs.setConfig({ bidderTimeout: 3000 })`. Note that it's still possible for a bid to get into the auction that responds after this timeout. This is due to how [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout) works in JS: it queues the callback in the event loop in an approximate location that should execute after this time but it is not guaranteed. For more information about the asynchronous event loop and `setTimeout`, see [How JavaScript Timers Work](https://johnresig.com/blog/how-javascript-timers-work/).
- * @param {string} options.publisherDomain The publisher's domain where Prebid is running, for cross-domain iFrame communication. Example: `pbjs.setConfig({ publisherDomain: "https://www.theverge.com" })`.
- * @param {Object} options.s2sConfig The configuration object for [server-to-server header bidding](http://prebid.org/dev-docs/get-started-with-prebid-server.html). Example:
- * @alias module:pbjs.setConfig
- * ```
- * pbjs.setConfig({
- * s2sConfig: {
- * accountId: '1',
- * enabled: true,
- * bidders: ['appnexus', 'pubmatic'],
- * timeout: 1000,
- * adapter: 'prebidServer',
- * endpoint: 'https://prebid.adnxs.com/pbs/v1/auction'
- * }
- * })
- * ```
*/
$$PREBID_GLOBAL$$.setConfig = config.setConfig;
$$PREBID_GLOBAL$$.setBidderConfig = config.setBidderConfig;
diff --git a/src/refererDetection.js b/src/refererDetection.js
index 7e9f2a7e6c7..15c080f5c69 100644
--- a/src/refererDetection.js
+++ b/src/refererDetection.js
@@ -9,7 +9,47 @@
*/
import { config } from './config.js';
-import { logWarn } from './utils.js';
+import {logWarn} from './utils.js';
+
+/**
+ * Prepend a URL with the page's protocol (http/https), if necessary.
+ */
+export function ensureProtocol(url, win = window) {
+ if (!url) return url;
+ if (/\w+:\/\//.exec(url)) {
+ // url already has protocol
+ return url;
+ }
+ let windowProto = win.location.protocol;
+ try {
+ windowProto = win.top.location.protocol;
+ } catch (e) {}
+ if (/^\/\//.exec(url)) {
+ // url uses relative protocol ("//example.com")
+ return windowProto + url;
+ } else {
+ return `${windowProto}//${url}`;
+ }
+}
+
+/**
+ * Extract the domain portion from a URL.
+ * @param url
+ * @param noLeadingWww: if true, remove 'www.' appearing at the beginning of the domain.
+ * @param noPort: if true, do not include the ':[port]' portion
+ */
+export function parseDomain(url, {noLeadingWww = false, noPort = false} = {}) {
+ try {
+ url = new URL(ensureProtocol(url));
+ } catch (e) {
+ return;
+ }
+ url = noPort ? url.hostname : url.host;
+ if (noLeadingWww && url.startsWith('www.')) {
+ url = url.substring(4);
+ }
+ return url;
+}
/**
* @param {Window} win Window
@@ -42,10 +82,6 @@ export function detectReferer(win) {
* @returns {string|null}
*/
function getCanonicalUrl(doc) {
- let pageURL = config.getConfig('pageUrl');
-
- if (pageURL) return pageURL;
-
try {
const element = doc.querySelector("link[rel='canonical']");
@@ -59,14 +95,20 @@ export function detectReferer(win) {
return null;
}
+ // TODO: the meaning of "reachedTop" seems to be intentionally ambiguous - best to leave them out of
+ // the typedef for now. (for example, unit tests enforce that "reachedTop" should be false in some situations where we
+ // happily provide a location for the top).
+
/**
- * Referer info
* @typedef {Object} refererInfo
- * @property {string} referer detected top url
- * @property {boolean} reachedTop whether prebid was able to walk upto top window or not
- * @property {number} numIframes number of iframes
- * @property {string} stack comma separated urls of all origins
- * @property {string} canonicalUrl canonical URL refers to an HTML link element, with the attribute of rel="canonical", found in the element of your webpage
+ * @property {string|null} location the browser's location, or null if not available (due to cross-origin restrictions)
+ * @property {string|null} canonicalUrl the site's canonical URL as set by the publisher, through setConfig({pageUrl}) or
+ * @property {string|null} page the best candidate for the current page URL: `canonicalUrl`, falling back to `location`
+ * @property {string|null} domain the domain portion of `page`
+ * @property {string|null} ref the referrer (document.referrer) to the current page, or null if not available (due to cross-origin restrictions)
+ * @property {string} topmostLocation of the top-most frame for which we could guess the location. Outside of cross-origin scenarios, this is equivalent to `location`.
+ * @property {number} numIframes number of steps between window.self and window.top
+ * @property {Array[string|null]} stack our best guess at the location for each frame, in the direction top -> self.
*/
/**
@@ -79,19 +121,20 @@ export function detectReferer(win) {
const ancestors = getAncestorOrigins(win);
const maxNestedIframes = config.getConfig('maxNestedIframes');
let currentWindow;
- let bestReferrer;
+ let bestLocation;
let bestCanonicalUrl;
let reachedTop = false;
let level = 0;
let valuesFromAmp = false;
let inAmpFrame = false;
+ let hasTopLocation = false;
do {
const previousWindow = currentWindow;
const wasInAmpFrame = inAmpFrame;
let currentLocation;
let crossOrigin = false;
- let foundReferrer = null;
+ let foundLocation = null;
inAmpFrame = false;
currentWindow = currentWindow ? currentWindow.parent : win;
@@ -107,8 +150,9 @@ export function detectReferer(win) {
const context = previousWindow.context;
try {
- foundReferrer = context.sourceUrl;
- bestReferrer = foundReferrer;
+ foundLocation = context.sourceUrl;
+ bestLocation = foundLocation;
+ hasTopLocation = true;
valuesFromAmp = true;
@@ -124,10 +168,11 @@ export function detectReferer(win) {
logWarn('Trying to access cross domain iframe. Continuing without referrer and location');
try {
+ // the referrer to an iframe is the parent window
const referrer = previousWindow.document.referrer;
if (referrer) {
- foundReferrer = referrer;
+ foundLocation = referrer;
if (currentWindow === win.top) {
reachedTop = true;
@@ -135,18 +180,21 @@ export function detectReferer(win) {
}
} catch (e) { /* Do nothing */ }
- if (!foundReferrer && ancestors && ancestors[level - 1]) {
- foundReferrer = ancestors[level - 1];
+ if (!foundLocation && ancestors && ancestors[level - 1]) {
+ foundLocation = ancestors[level - 1];
+ if (currentWindow === win.top) {
+ hasTopLocation = true;
+ }
}
- if (foundReferrer && !valuesFromAmp) {
- bestReferrer = foundReferrer;
+ if (foundLocation && !valuesFromAmp) {
+ bestLocation = foundLocation;
}
}
} else {
if (currentLocation) {
- foundReferrer = currentLocation;
- bestReferrer = foundReferrer;
+ foundLocation = currentLocation;
+ bestLocation = foundLocation;
valuesFromAmp = false;
if (currentWindow === win.top) {
@@ -165,23 +213,49 @@ export function detectReferer(win) {
}
}
- stack.push(foundReferrer);
+ stack.push(foundLocation);
level++;
} while (currentWindow !== win.top && level < maxNestedIframes);
stack.reverse();
+ let ref;
+ try {
+ ref = win.top.document.referrer;
+ } catch (e) {}
+
+ const location = reachedTop || hasTopLocation ? bestLocation : null;
+ const canonicalUrl = config.getConfig('pageUrl') || bestCanonicalUrl || null;
+ const page = ensureProtocol(canonicalUrl, win) || location;
+
return {
- referer: bestReferrer || null,
reachedTop,
isAmp: valuesFromAmp,
numIframes: level - 1,
stack,
- canonicalUrl: bestCanonicalUrl || null
+ topmostLocation: bestLocation || null,
+ location,
+ canonicalUrl,
+ page,
+ domain: parseDomain(page) || null,
+ ref: ref || null,
+ // TODO: the "legacy" refererInfo object is provided here, for now, to accomodate
+ // adapters that decided to just send it verbatim to their backend.
+ legacy: {
+ reachedTop,
+ isAmp: valuesFromAmp,
+ numIframes: level - 1,
+ stack,
+ referer: bestLocation || null,
+ canonicalUrl
+ }
};
}
return refererInfo;
}
+/**
+ * @type {function(): refererInfo}
+ */
export const getRefererInfo = detectReferer(window);
diff --git a/src/storageManager.js b/src/storageManager.js
index f13a462eae7..c194ea49109 100644
--- a/src/storageManager.js
+++ b/src/storageManager.js
@@ -26,12 +26,12 @@ export let storageCallbacks = [];
* @param {storageOptions} options
*/
export function newStorageManager({gvlid, moduleName, bidderCode, moduleType} = {}, {bidderSettings = defaultBidderSettings} = {}) {
- function isBidderDisallowed() {
+ function isBidderAllowed() {
if (bidderCode == null) {
- return false;
+ return true;
}
const storageAllowed = bidderSettings.get(bidderCode, 'storageAllowed');
- return storageAllowed == null ? false : !storageAllowed;
+ return storageAllowed == null ? false : storageAllowed;
}
function isValid(cb) {
if (includes(moduleTypeWhiteList, moduleType)) {
@@ -39,7 +39,7 @@ export function newStorageManager({gvlid, moduleName, bidderCode, moduleType} =
valid: true
}
return cb(result);
- } else if (isBidderDisallowed()) {
+ } else if (!isBidderAllowed()) {
logInfo(`bidderSettings denied access to device storage for bidder '${bidderCode}'`);
const result = {valid: false};
return cb(result);
diff --git a/src/utils/gpdr.js b/src/utils/gpdr.js
new file mode 100644
index 00000000000..19c7126b7d7
--- /dev/null
+++ b/src/utils/gpdr.js
@@ -0,0 +1,14 @@
+import {deepAccess} from '../utils.js';
+
+/**
+ * Check if GDPR purpose 1 consent was given.
+ *
+ * @param gdprConsent GDPR consent data
+ * @returns {boolean} true if the gdprConsent is null-y; or GDPR does not apply; or if purpose 1 consent was given.
+ */
+export function hasPurpose1Consent(gdprConsent) {
+ if (gdprConsent?.gdprApplies) {
+ return deepAccess(gdprConsent, 'vendorData.purpose.consents.1') === true;
+ }
+ return true;
+}
diff --git a/test/spec/adUnits_spec.js b/test/spec/adUnits_spec.js
index baa5b4ac8c4..089aabf22a5 100644
--- a/test/spec/adUnits_spec.js
+++ b/test/spec/adUnits_spec.js
@@ -1,3 +1,5 @@
+import 'src/prebid.js';
+
describe('Publisher API _ AdUnits', function () {
var assert = require('chai').assert;
var expect = require('chai').expect;
@@ -23,10 +25,10 @@ describe('Publisher API _ AdUnits', function () {
}
]
}, {
- fpd: {
- context: {
- pbAdSlot: 'adSlotTest',
+ ortb2Imp: {
+ ext: {
data: {
+ pbadslot: 'adSlotTest',
inventory: [4],
keywords: 'foo,bar',
visitor: [1, 2, 3],
diff --git a/test/spec/auctionmanager_spec.js b/test/spec/auctionmanager_spec.js
index b5a4789366a..2618d1d9c10 100644
--- a/test/spec/auctionmanager_spec.js
+++ b/test/spec/auctionmanager_spec.js
@@ -682,6 +682,46 @@ describe('auctionmanager.js', function () {
});
});
+ describe('createAuction', () => {
+ let adUnits, stubMakeBidRequests, stubCallAdapters
+
+ beforeEach(() => {
+ stubMakeBidRequests = sinon.stub(adapterManager, 'makeBidRequests').returns([{
+ bidderCode: BIDDER_CODE,
+ bids: [{
+ bidder: BIDDER_CODE
+ }]
+ }]);
+ stubCallAdapters = sinon.stub(adapterManager, 'callBids').callsFake((au, reqs, addBid, done) => {
+ reqs.forEach(r => done.apply(r));
+ });
+ adUnits = [{
+ code: ADUNIT_CODE,
+ transactionId: ADUNIT_CODE,
+ bids: [
+ {bidder: BIDDER_CODE},
+ ]
+ }];
+ });
+
+ afterEach(() => {
+ stubMakeBidRequests.restore();
+ stubCallAdapters.restore();
+ });
+
+ it('passes global and bidder ortb2 to the auction', () => {
+ const ortb2Fragments = {
+ global: {},
+ bidder: {}
+ }
+ const auction = auctionManager.createAuction({adUnits, ortb2Fragments});
+ auction.callBids();
+ const anyArgs = [...Array(7).keys()].map(() => sinon.match.any);
+ sinon.assert.calledWith(stubMakeBidRequests, ...anyArgs.slice(0, 5).concat([sinon.match.same(ortb2Fragments)]));
+ sinon.assert.calledWith(stubCallAdapters, ...anyArgs.slice(0, 7).concat([sinon.match.same(ortb2Fragments)]));
+ });
+ });
+
describe('addBidResponse #1', function () {
let createAuctionStub;
let adUnits;
@@ -1154,8 +1194,7 @@ describe('auctionmanager.js', function () {
enabled: true,
bidRequests: [{
bidderCode: BIDDER_CODE,
- adUnitCode: ADUNIT_CODE,
- storedAuctionResponse: '11111'
+ adUnitCode: ADUNIT_CODE
}]
}
});
@@ -1213,8 +1252,6 @@ describe('auctionmanager.js', function () {
const bid = find(auctionBidRequests[0].bids, bid => bid.adUnitCode === ADUNIT_CODE);
assert.equal(typeof bid !== 'undefined', true);
- assert.equal(bid.hasOwnProperty('storedAuctionResponse'), true);
- assert.equal(bid.storedAuctionResponse, '11111');
});
});
diff --git a/test/spec/config_spec.js b/test/spec/config_spec.js
index 88d6e61c706..5fead2d97e8 100644
--- a/test/spec/config_spec.js
+++ b/test/spec/config_spec.js
@@ -20,9 +20,9 @@ describe('config API', function () {
beforeEach(function () {
config = newConfig();
- getConfig = config.getConfig;
+ getConfig = config.getAnyConfig;
setConfig = config.setConfig;
- readConfig = config.readConfig;
+ readConfig = config.readAnyConfig;
mergeConfig = config.mergeConfig;
getBidderConfig = config.getBidderConfig;
setBidderConfig = config.setBidderConfig;
@@ -130,17 +130,6 @@ describe('config API', function () {
expect(getConfig('foo')).to.eql({baz: 'qux'});
});
- it('moves fpd config into ortb2 properties', function () {
- setConfig({fpd: {context: {keywords: 'foo,bar', data: {inventory: [1]}}}});
- expect(getConfig('ortb2')).to.eql({site: {keywords: 'foo,bar', ext: {data: {inventory: [1]}}}});
- expect(getConfig('fpd')).to.eql(undefined);
- });
-
- it('moves fpd bidderconfig into ortb2 properties', function () {
- setBidderConfig({bidders: ['bidderA'], config: {fpd: {context: {keywords: 'foo,bar', data: {inventory: [1]}}}}});
- expect(getBidderConfig()).to.eql({'bidderA': {ortb2: {site: {keywords: 'foo,bar', ext: {data: {inventory: [1]}}}}}});
- });
-
it('sets debugging', function () {
setConfig({ debug: true });
expect(getConfig('debug')).to.be.true;
diff --git a/test/spec/modules/33acrossBidAdapter_spec.js b/test/spec/modules/33acrossBidAdapter_spec.js
index 141edc1e61c..94e4f50edd7 100644
--- a/test/spec/modules/33acrossBidAdapter_spec.js
+++ b/test/spec/modules/33acrossBidAdapter_spec.js
@@ -919,7 +919,7 @@ describe('33acrossBidAdapter:', function () {
it('returns corresponding server requests with site.page set', function() {
const bidderRequest = {
refererInfo: {
- referer: 'http://foo.com/bar'
+ page: 'http://foo.com/bar'
}
};
diff --git a/test/spec/modules/adagioBidAdapter_spec.js b/test/spec/modules/adagioBidAdapter_spec.js
index a28b6b9be00..15f79b407d1 100644
--- a/test/spec/modules/adagioBidAdapter_spec.js
+++ b/test/spec/modules/adagioBidAdapter_spec.js
@@ -16,7 +16,6 @@ import { loadExternalScript } from '../../../src/adloader.js';
import * as utils from '../../../src/utils.js';
import { config } from '../../../src/config.js';
import { NATIVE } from '../../../src/mediaTypes.js';
-import * as prebidGlobal from 'src/prebidGlobal.js';
import { executeRenderer } from '../../../src/Renderer.js';
const BidRequestBuilder = function BidRequestBuilder(options) {
@@ -124,11 +123,18 @@ describe('Adagio bid adapter', () => {
adagioMock = sinon.mock(adagio);
utilsMock = sinon.mock(utils);
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ adagio: {
+ storageAllowed: true
+ }
+ };
+
sandbox = sinon.createSandbox();
});
afterEach(() => {
window.ADAGIO = undefined;
+ $$PREBID_GLOBAL$$.bidderSettings = {};
adagioMock.restore();
utilsMock.restore();
@@ -137,24 +143,24 @@ describe('Adagio bid adapter', () => {
});
describe('get and set params at adUnit level from global Prebid configuration', function() {
- it('should set params get from ortb2 config or bidderSettings. Priority to bidderSetting', function() {
+ it('should set params get from bid.ortb2', function() {
const bid = new BidRequestBuilder().build();
+ bid.ortb2 = {
+ site: {
+ ext: {
+ data: {
+ environment: 'desktop',
+ pagetype: 'abc'
+ }
+ }
+ }
+ };
sandbox.stub(config, 'getConfig').callsFake(key => {
const config = {
adagio: {
pagetype: 'article'
},
- ortb2: {
- site: {
- ext: {
- data: {
- environment: 'desktop',
- pagetype: 'abc'
- }
- }
- }
- }
};
return utils.deepAccess(config, key);
});
@@ -1381,21 +1387,13 @@ describe('Adagio bid adapter', () => {
describe('site information using refererDetection or window.top', function() {
it('should returns domain, page and window.referrer in a window.top context', function() {
- sandbox.stub(utils, 'getWindowTop').returns({
- location: {
- hostname: 'test.io',
- href: 'https://test.io/article/a.html'
- },
- document: {
- referrer: 'https://google.com'
- }
- });
-
const bidderRequest = new BidderRequestBuilder({
refererInfo: {
numIframes: 0,
reachedTop: true,
- referer: 'https://test.io/article/a.html'
+ page: 'https://test.io/article/a.html',
+ domain: 'test.io',
+ ref: 'https://google.com'
}
}).build();
@@ -1418,13 +1416,15 @@ describe('Adagio bid adapter', () => {
const info = {
numIframes: 0,
reachedTop: true,
- referer: 'http://level.io/',
+ page: 'http://level.io/',
stack: [
'http://level.io/',
'http://example.com/iframe1.html',
'http://example.com/iframe2.html'
],
- canonicalUrl: ''
+ canonicalUrl: '',
+ domain: 'level.io',
+ ref: null,
};
const bidderRequest = new BidderRequestBuilder({
@@ -1445,13 +1445,16 @@ describe('Adagio bid adapter', () => {
const info = {
numIframes: 2,
reachedTop: false,
- referer: 'http://example.com/iframe1.html',
+ topmostLocation: 'http://example.com/iframe1.html',
stack: [
null,
'http://example.com/iframe1.html',
'http://example.com/iframe2.html'
],
- canonicalUrl: ''
+ canonicalUrl: '',
+ page: null,
+ domain: null,
+ ref: null
};
const bidderRequest = new BidderRequestBuilder({
diff --git a/test/spec/modules/adbookpspBidAdapter_spec.js b/test/spec/modules/adbookpspBidAdapter_spec.js
index 3a49f25edb6..f7e401fefbd 100755
--- a/test/spec/modules/adbookpspBidAdapter_spec.js
+++ b/test/spec/modules/adbookpspBidAdapter_spec.js
@@ -951,7 +951,9 @@ const bidderRequest = {
bidderRequestId: '999ccceeee11',
timeout: 200,
refererInfo: {
- referer: 'http://example-domain.com/foo',
+ page: 'http://mock-page.com',
+ domain: 'mock-page.com',
+ ref: 'http://example-domain.com/foo',
},
gdprConsent: {
gdprApplies: 1,
@@ -999,8 +1001,8 @@ const bannerExchangeRequest = {
},
},
site: {
- domain: location.hostname,
- page: location.href,
+ domain: 'mock-page.com',
+ page: 'http://mock-page.com',
ref: 'http://example-domain.com/foo',
},
source: {
@@ -1089,8 +1091,8 @@ const videoExchangeRequest = {
},
},
site: {
- domain: location.hostname,
- page: location.href,
+ domain: 'mock-page.com',
+ page: 'http://mock-page.com',
ref: 'http://example-domain.com/foo',
},
source: {
@@ -1171,8 +1173,8 @@ const mixedExchangeRequest = {
},
},
site: {
- domain: location.hostname,
- page: location.href,
+ domain: 'mock-page.com',
+ page: 'http://mock-page.com',
ref: 'http://example-domain.com/foo',
},
source: {
diff --git a/test/spec/modules/addefendBidAdapter_spec.js b/test/spec/modules/addefendBidAdapter_spec.js
index ac01750e98f..b3b6b2d417a 100644
--- a/test/spec/modules/addefendBidAdapter_spec.js
+++ b/test/spec/modules/addefendBidAdapter_spec.js
@@ -25,7 +25,7 @@ describe('addefendBidAdapter', () => {
return spec.buildRequests(buildRequest, {
...bidderRequest || {},
refererInfo: {
- referer: 'https://referer.example.com'
+ page: 'https://referer.example.com'
}
})[0];
};
diff --git a/test/spec/modules/adfBidAdapter_spec.js b/test/spec/modules/adfBidAdapter_spec.js
index 4317fd3258b..b1c2d0b4ad2 100644
--- a/test/spec/modules/adfBidAdapter_spec.js
+++ b/test/spec/modules/adfBidAdapter_spec.js
@@ -71,7 +71,7 @@ describe('Adf adapter', function () {
adxDomain: '10.8.57.207'
}
}];
- let request = spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } });
+ let request = spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } });
assert.equal(request.method, 'POST');
assert.equal(request.url, 'https://10.8.57.207/adx/openrtb');
@@ -82,7 +82,7 @@ describe('Adf adapter', function () {
describe('user privacy', function () {
it('should send GDPR Consent data to adform if gdprApplies', function () {
let validBidRequests = [{ bidId: 'bidId', params: { test: 1 } }];
- let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { referer: 'page' } };
+ let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(request.user.ext.consent, bidderRequest.gdprConsent.consentString);
@@ -92,7 +92,7 @@ describe('Adf adapter', function () {
it('should send gdpr as number', function () {
let validBidRequests = [{ bidId: 'bidId', params: { test: 1 } }];
- let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { referer: 'page' } };
+ let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(typeof request.regs.ext.gdpr, 'number');
@@ -101,12 +101,12 @@ describe('Adf adapter', function () {
it('should send CCPA Consent data to adform', function () {
let validBidRequests = [{ bidId: 'bidId', params: { test: 1 } }];
- let bidderRequest = { uspConsent: '1YA-', refererInfo: { referer: 'page' } };
+ let bidderRequest = { uspConsent: '1YA-', refererInfo: { page: 'page' } };
let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(request.regs.ext.us_privacy, '1YA-');
- bidderRequest = { uspConsent: '1YA-', gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { referer: 'page' } };
+ bidderRequest = { uspConsent: '1YA-', gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(request.regs.ext.us_privacy, '1YA-');
@@ -119,13 +119,13 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { siteId: 'siteId' }
}];
- let bidderRequest = {gdprConsent: {gdprApplies: false, consentString: 'consentDataString'}, refererInfo: { referer: 'page' }};
+ let bidderRequest = { gdprConsent: {gdprApplies: false, consentString: 'consentDataString'}, refererInfo: { page: 'page' } };
let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(request.user.ext.consent, 'consentDataString');
assert.equal(request.regs.ext.gdpr, 0);
- bidderRequest = {gdprConsent: {consentString: 'consentDataString'}, refererInfo: { referer: 'page' }};
+ bidderRequest = {gdprConsent: {consentString: 'consentDataString'}, refererInfo: { page: 'page' }};
request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(request.user, undefined);
@@ -136,7 +136,7 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { siteId: 'siteId' }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.user, undefined);
assert.equal(request.regs, undefined);
@@ -148,7 +148,7 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { test: 1 }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.ok(request.is_debug);
assert.equal(request.test, 1);
@@ -160,7 +160,7 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { siteId: 'siteId' }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
let data = Object.keys(request);
assert.deepEqual(keys, data);
@@ -172,7 +172,7 @@ describe('Adf adapter', function () {
params: { siteId: 'siteId' },
transactionId: 'transactionId'
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.source.tid, validBidRequests[0].transactionId);
assert.equal(request.source.fd, 1);
@@ -182,7 +182,7 @@ describe('Adf adapter', function () {
config.setConfig({
});
let validBidRequests = [{ bidId: 'bidId', params: { test: 1 } }];
- let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { referer: 'page' } };
+ let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
assert.equal(request.regs.coppa, undefined);
@@ -200,7 +200,7 @@ describe('Adf adapter', function () {
coppa: true
});
let validBidRequests = [{ bidId: 'bidId', params: { test: 1 } }];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.regs.coppa, 1);
});
@@ -213,7 +213,7 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { mid: '1000' }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.device.ua, navigator.userAgent);
assert.equal(request.device.w, 100);
@@ -223,13 +223,14 @@ describe('Adf adapter', function () {
it('should send app info', function () {
config.setConfig({
app: { id: 'appid' },
- ortb2: { app: { name: 'appname' } }
});
+ const ortb2 = { app: { name: 'appname' } };
let validBidRequests = [{
bidId: 'bidId',
- params: { mid: '1000' }
+ params: { mid: '1000' },
+ ortb2
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' }, ortb2 }).data);
assert.equal(request.app.id, 'appid');
assert.equal(request.app.name, 'appname');
@@ -244,23 +245,24 @@ describe('Adf adapter', function () {
domain: 'publisher.domain.com'
}
},
- ortb2: {
- site: {
- publisher: {
- name: 'publisher\'s name'
- }
+ });
+ const ortb2 = {
+ site: {
+ publisher: {
+ name: 'publisher\'s name'
}
}
- });
+ };
let validBidRequests = [{
bidId: 'bidId',
- params: { mid: '1000' }
+ params: { mid: '1000' },
+ ortb2
}];
- let refererInfo = { referer: 'page' };
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo }).data);
+ let refererInfo = { page: 'page' };
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo, ortb2 }).data);
assert.deepEqual(request.site, {
- page: refererInfo.referer,
+ page: refererInfo.page,
publisher: {
domain: 'publisher.domain.com',
name: 'publisher\'s name'
@@ -279,7 +281,7 @@ describe('Adf adapter', function () {
})
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.deepEqual(request.user.ext.eids, [
{ source: 'adserver.org', uids: [ { id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: { rtiPartner: 'TDID' } } ] },
{ source: 'pubcid.org', uids: [ { id: 'pubCommonId_FROM_USER_ID_MODULE', atype: 1 } ] }
@@ -289,7 +291,7 @@ describe('Adf adapter', function () {
it('should send currency if defined', function () {
config.setConfig({ currency: { adServerCurrency: 'EUR' } });
let validBidRequests = [{ params: {} }];
- let refererInfo = { referer: 'page' };
+ let refererInfo = { page: 'page' };
let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo }).data);
assert.deepEqual(request.cur, [ 'EUR' ]);
@@ -307,7 +309,7 @@ describe('Adf adapter', function () {
}
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.deepEqual(request.source.ext.schain, {
validation: 'strict',
config: {
@@ -322,7 +324,7 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { siteId: 'siteId' }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.ext.pt, 'net');
});
@@ -331,7 +333,7 @@ describe('Adf adapter', function () {
bidId: 'bidId',
params: { priceType: 'net' }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.ext.pt, 'net');
});
@@ -346,7 +348,7 @@ describe('Adf adapter', function () {
bidId: 'bidId2',
params: { siteId: 'siteId' }
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data);
assert.equal(request.imp.length, 2);
});
@@ -364,7 +366,7 @@ describe('Adf adapter', function () {
params: { mid: '1000' },
mediaTypes: {video: {}}
}];
- let imps = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp;
+ let imps = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp;
for (let i = 0; i < 3; i++) {
assert.equal(imps[i].id, i + 1);
@@ -375,7 +377,7 @@ describe('Adf adapter', function () {
let validBidRequests = [{ bidId: 'bidId', params: {mid: 1000}, mediaTypes: {video: {}} },
{ bidId: 'bidId2', params: {mid: 1001}, mediaTypes: {video: {}} },
{ bidId: 'bidId3', params: {mid: 1002}, mediaTypes: {video: {}} }];
- let imps = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp;
+ let imps = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp;
for (let i = 0; i < 3; i++) {
assert.equal(imps[i].tagid, validBidRequests[i].params.mid);
}
@@ -488,7 +490,7 @@ describe('Adf adapter', function () {
video: {}
}
}];
- let [ first, second, third ] = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp;
+ let [ first, second, third ] = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp;
assert.ok(first.banner);
assert.ok(first.video);
@@ -515,7 +517,7 @@ describe('Adf adapter', function () {
}
}
}];
- let { banner } = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0];
+ let { banner } = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0];
assert.deepEqual(banner, {
format: [ { w: 100, h: 100 }, { w: 200, h: 300 } ]
});
@@ -535,7 +537,7 @@ describe('Adf adapter', function () {
}
}
}];
- let { video } = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0];
+ let { video } = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0];
assert.deepEqual(video, {
playerSize: [640, 480],
context: 'outstream',
@@ -556,7 +558,7 @@ describe('Adf adapter', function () {
body: { len: 140 }
}
}];
- let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets;
+ let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0].native.request.assets;
assert.equal(assets[0].id, 0);
assert.equal(assets[1].id, 3);
@@ -574,7 +576,7 @@ describe('Adf adapter', function () {
}
}];
- let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets;
+ let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0].native.request.assets;
assert.equal(assets[0].required, 1);
assert.ok(!assets[1].required);
@@ -597,7 +599,7 @@ describe('Adf adapter', function () {
}
}];
- let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets;
+ let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0].native.request.assets;
assert.ok(assets[0].title);
assert.equal(assets[0].title.len, 140);
assert.deepEqual(assets[1].img, { type: 3, w: 150, h: 50 });
@@ -620,7 +622,7 @@ describe('Adf adapter', function () {
}
}];
- let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets;
+ let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0].native.request.assets;
assert.ok(assets[0].img);
assert.equal(assets[0].img.w, 200);
assert.equal(assets[0].img.h, 300);
@@ -649,7 +651,7 @@ describe('Adf adapter', function () {
}
}];
- let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets;
+ let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0].native.request.assets;
assert.ok(assets[0].img);
assert.equal(assets[0].img.wmin, 100);
assert.equal(assets[0].img.hmin, 300);
@@ -673,7 +675,7 @@ describe('Adf adapter', function () {
}
}];
- assert.doesNotThrow(() => spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }));
+ assert.doesNotThrow(() => spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }));
});
});
@@ -691,7 +693,7 @@ describe('Adf adapter', function () {
}
}];
- let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets;
+ let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp[0].native.request.assets;
assert.ok(assets[0].img);
assert.equal(assets[0].img.wmin, 0);
assert.equal(assets[0].img.hmin, 0);
@@ -701,7 +703,7 @@ describe('Adf adapter', function () {
});
function getRequestImps(validBidRequests) {
- return JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp;
+ return JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } }).data).imp;
}
});
diff --git a/test/spec/modules/adgenerationBidAdapter_spec.js b/test/spec/modules/adgenerationBidAdapter_spec.js
index 030aa448c19..ac5ab220880 100644
--- a/test/spec/modules/adgenerationBidAdapter_spec.js
+++ b/test/spec/modules/adgenerationBidAdapter_spec.js
@@ -105,7 +105,7 @@ describe('AdgenerationAdapter', function () {
];
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com'
+ page: 'https://example.com'
}
};
const data = {
diff --git a/test/spec/modules/adheseBidAdapter_spec.js b/test/spec/modules/adheseBidAdapter_spec.js
index 3fe0a62b2a0..a2e2691c8ba 100644
--- a/test/spec/modules/adheseBidAdapter_spec.js
+++ b/test/spec/modules/adheseBidAdapter_spec.js
@@ -67,7 +67,7 @@ describe('AdheseAdapter', function () {
consentString: 'CONSENT_STRING'
},
refererInfo: {
- referer: 'http://prebid.org/dev-docs/subjects?_d=1'
+ page: 'http://prebid.org/dev-docs/subjects?_d=1'
}
};
diff --git a/test/spec/modules/adkernelAdnBidAdapter_spec.js b/test/spec/modules/adkernelAdnBidAdapter_spec.js
index c4ad134711a..67c168f5063 100644
--- a/test/spec/modules/adkernelAdnBidAdapter_spec.js
+++ b/test/spec/modules/adkernelAdnBidAdapter_spec.js
@@ -144,7 +144,7 @@ describe('AdkernelAdn adapter', function () {
auctionStart: 1545836987704,
timeout: 3000,
refererInfo: {
- referer: 'https://example.com/index.html',
+ page: 'https://example.com/index.html',
reachedTop: true,
numIframes: 0,
stack: ['https://example.com/index.html']
diff --git a/test/spec/modules/adkernelBidAdapter_spec.js b/test/spec/modules/adkernelBidAdapter_spec.js
index ab1c5501bd9..4b0eebdf519 100644
--- a/test/spec/modules/adkernelBidAdapter_spec.js
+++ b/test/spec/modules/adkernelBidAdapter_spec.js
@@ -3,6 +3,7 @@ import {spec} from 'modules/adkernelBidAdapter';
import * as utils from 'src/utils';
import {NATIVE, BANNER, VIDEO} from 'src/mediaTypes';
import {config} from 'src/config';
+import {parseDomain} from '../../../src/refererDetection.js';
describe('Adkernel adapter', function () {
const bid1_zone1 = {
@@ -253,7 +254,7 @@ describe('Adkernel adapter', function () {
});
function buildBidderRequest(url = 'https://example.com/index.html', params = {}) {
- return Object.assign({}, params, {refererInfo: {referer: url, reachedTop: true}, timeout: 3000, bidderCode: 'adkernel'});
+ return Object.assign({}, params, {refererInfo: {page: url, domain: parseDomain(url), reachedTop: true}, timeout: 3000, bidderCode: 'adkernel'});
}
const DEFAULT_BIDDER_REQUEST = buildBidderRequest();
diff --git a/test/spec/modules/adlooxRtdProvider_spec.js b/test/spec/modules/adlooxRtdProvider_spec.js
index b576ffb9f3b..236e053e58c 100644
--- a/test/spec/modules/adlooxRtdProvider_spec.js
+++ b/test/spec/modules/adlooxRtdProvider_spec.js
@@ -171,6 +171,7 @@ describe('Adloox RTD Provider', function () {
});
it('should fetch segments', function (done) {
+ const req = {};
const adUnitWithSegments = utils.deepClone(adUnit);
const getGlobalStub = sinon.stub(prebidGlobal, 'getGlobal').returns({
adUnits: [ adUnitWithSegments ]
@@ -180,10 +181,11 @@ describe('Adloox RTD Provider', function () {
expect(ret).is.true;
const callback = function () {
- expect(__config.ortb2.site.ext.data.adloox_rtd.ok).is.true;
- expect(__config.ortb2.site.ext.data.adloox_rtd.nope).is.undefined;
- expect(__config.ortb2.user.ext.data.adloox_rtd.unused).is.false;
- expect(__config.ortb2.user.ext.data.adloox_rtd.nope).is.undefined;
+ const ortb2 = req.ortb2Fragments.global;
+ expect(ortb2.site.ext.data.adloox_rtd.ok).is.true;
+ expect(ortb2.site.ext.data.adloox_rtd.nope).is.undefined;
+ expect(ortb2.user.ext.data.adloox_rtd.unused).is.false;
+ expect(ortb2.user.ext.data.adloox_rtd.nope).is.undefined;
expect(adUnitWithSegments.ortb2Imp.ext.data.adloox_rtd.dis.length).is.equal(3);
expect(adUnitWithSegments.ortb2Imp.ext.data.adloox_rtd.nope).is.undefined;
@@ -191,7 +193,7 @@ describe('Adloox RTD Provider', function () {
done();
};
- rtdProvider.getBidRequestData({}, callback, CONFIG, null);
+ rtdProvider.getBidRequestData(req, callback, CONFIG, null);
const request = server.requests[0];
const response = { unused: false, _: [ { d: 77 } ] };
@@ -207,7 +209,11 @@ describe('Adloox RTD Provider', function () {
adUnits: [ adUnitWithSegments ]
});
- const targetingData = rtdProvider.getTargetingData([ adUnitWithSegments.code ], CONFIG);
+ const targetingData = rtdProvider.getTargetingData([ adUnitWithSegments.code ], CONFIG, null, {
+ getFPD: () => ({
+ global: __config.ortb2
+ })
+ });
expect(Object.keys(targetingData).length).is.equal(1);
expect(Object.keys(targetingData[adUnit.code]).length).is.equal(2);
expect(targetingData[adUnit.code].adl_ok).is.equal(1);
diff --git a/test/spec/modules/admixerBidAdapter_spec.js b/test/spec/modules/admixerBidAdapter_spec.js
index 6dfde0d0652..228b87ae4d5 100644
--- a/test/spec/modules/admixerBidAdapter_spec.js
+++ b/test/spec/modules/admixerBidAdapter_spec.js
@@ -61,7 +61,7 @@ describe('AdmixerAdapter', function () {
let bidderRequest = {
bidderCode: BIDDER_CODE,
refererInfo: {
- referer: 'https://example.com'
+ page: 'https://example.com'
}
};
diff --git a/test/spec/modules/adnuntiusBidAdapter_spec.js b/test/spec/modules/adnuntiusBidAdapter_spec.js
index 25b72216395..817229cd381 100644
--- a/test/spec/modules/adnuntiusBidAdapter_spec.js
+++ b/test/spec/modules/adnuntiusBidAdapter_spec.js
@@ -14,9 +14,19 @@ describe('adnuntiusBidAdapter', function () {
const storage = getStorageManager({gvlid: GVLID, moduleName: 'adnuntius'})
storage.setDataInLocalStorage('adn.metaData', JSON.stringify(meta))
+ beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ adnuntius: {
+ storageAllowed: true
+ }
+ };
+ });
+
afterEach(function () {
config.resetConfig();
+ $$PREBID_GLOBAL$$.bidderSettings = {};
});
+
const tzo = new Date().getTimezoneOffset();
const ENDPOINT_URL = `${URL}${tzo}&format=json&userId=${usi}`;
const ENDPOINT_URL_NOCOOKIE = `${URL}${tzo}&format=json&userId=${usi}&noCookies=true`;
@@ -122,7 +132,7 @@ describe('adnuntiusBidAdapter', function () {
describe('buildRequests', function () {
it('Test requests', function () {
- const request = spec.buildRequests(bidRequests);
+ const request = spec.buildRequests(bidRequests, {});
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('bid');
const bid = request[0].bid[0]
@@ -134,52 +144,42 @@ describe('adnuntiusBidAdapter', function () {
});
it('should pass segments if available in config', function () {
- config.setBidderConfig({
- bidders: ['adnuntius', 'other'],
- config: {
- ortb2: {
- user: {
- data: [{
- name: 'adnuntius',
- segment: [{ id: 'segment1' }, { id: 'segment2' }]
- },
- {
- name: 'other',
- segment: ['segment3']
- }],
- }
- }
+ const ortb2 = {
+ user: {
+ data: [{
+ name: 'adnuntius',
+ segment: [{ id: 'segment1' }, { id: 'segment2' }]
+ },
+ {
+ name: 'other',
+ segment: ['segment3']
+ }],
}
- });
+ };
- const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
+ const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests, {ortb2}));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
});
it('should skip segments in config if not either id or array of strings', function () {
- config.setBidderConfig({
- bidders: ['adnuntius', 'other'],
- config: {
- ortb2: {
- user: {
- data: [{
- name: 'adnuntius',
- segment: [{ id: 'segment1' }, { id: 'segment2' }, { id: 'segment3' }]
- },
- {
- name: 'other',
- segment: [{
- notright: 'segment4'
- }]
- }],
- }
- }
+ const ortb2 = {
+ user: {
+ data: [{
+ name: 'adnuntius',
+ segment: [{ id: 'segment1' }, { id: 'segment2' }, { id: 'segment3' }]
+ },
+ {
+ name: 'other',
+ segment: [{
+ notright: 'segment4'
+ }]
+ }],
}
- });
+ };
- const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
+ const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests, {ortb2}));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
@@ -202,70 +202,55 @@ describe('adnuntiusBidAdapter', function () {
});
it('should pass segments if available in config', function () {
- config.setBidderConfig({
- bidders: ['adnuntius', 'other'],
- config: {
- ortb2: {
- user: {
- data: [{
- name: 'adnuntius',
- segment: [{ id: 'segment1' }, { id: 'segment2' }]
- },
- {
- name: 'other',
- segment: ['segment3']
- }],
- }
- }
+ const ortb2 = {
+ user: {
+ data: [{
+ name: 'adnuntius',
+ segment: [{ id: 'segment1' }, { id: 'segment2' }]
+ },
+ {
+ name: 'other',
+ segment: ['segment3']
+ }],
}
- });
+ }
- const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
+ const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests, {ortb2}));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
});
it('should skip segments in config if not either id or array of strings', function () {
- config.setBidderConfig({
- bidders: ['adnuntius', 'other'],
- config: {
- ortb2: {
- user: {
- data: [{
- name: 'adnuntius',
- segment: [{ id: 'segment1' }, { id: 'segment2' }, { id: 'segment3' }]
- },
- {
- name: 'other',
- segment: [{
- notright: 'segment4'
- }]
- }],
- }
- }
+ const ortb2 = {
+ user: {
+ data: [{
+ name: 'adnuntius',
+ segment: [{ id: 'segment1' }, { id: 'segment2' }, { id: 'segment3' }]
+ },
+ {
+ name: 'other',
+ segment: [{
+ notright: 'segment4'
+ }]
+ }],
}
- });
+ };
- const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
+ const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests, {ortb2}));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
});
it('should user user ID if present in ortb2.user.id field', function () {
- config.setBidderConfig({
- bidders: ['adnuntius', 'other'],
- config: {
- ortb2: {
- user: {
- id: usi
- }
- }
+ const ortb2 = {
+ user: {
+ id: usi
}
- });
+ };
- const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
+ const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests, {ortb2}));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL);
@@ -297,7 +282,7 @@ describe('adnuntiusBidAdapter', function () {
}
});
- const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
+ const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests, {}));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_NOCOOKIE);
diff --git a/test/spec/modules/adotBidAdapter_spec.js b/test/spec/modules/adotBidAdapter_spec.js
index 81b9c5e15e9..8851df37d34 100644
--- a/test/spec/modules/adotBidAdapter_spec.js
+++ b/test/spec/modules/adotBidAdapter_spec.js
@@ -28,7 +28,7 @@ describe('Adot Adapter', function () {
it('should build request (banner)', function () {
const bidderRequestId = 'bidderRequestId';
const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { banner: { sizes: [[300, 250]] } }, params: { placementId: 'placementId', adUnitCode: 200 } }];
- const bidderRequest = { position: 2, refererInfo: { referer: 'http://localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
+ const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
@@ -48,7 +48,7 @@ describe('Adot Adapter', function () {
bidfloor: 0
}],
site: {
- page: bidderRequest.refererInfo.referer,
+ page: bidderRequest.refererInfo.page,
domain: 'localhost.com',
name: 'localhost.com',
publisher: {
@@ -76,7 +76,7 @@ describe('Adot Adapter', function () {
it('should build request (native)', function () {
const bidderRequestId = 'bidderRequestId';
const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { native: { title: { required: true, len: 50, sizes: [[300, 250]] }, wrong: {}, image: {} } }, params: { placementId: 'placementId', adUnitCode: 200 } }];
- const bidderRequest = { position: 2, refererInfo: { referer: 'http://localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
+ const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
@@ -95,7 +95,7 @@ describe('Adot Adapter', function () {
bidfloor: 0
}],
site: {
- page: bidderRequest.refererInfo.referer,
+ page: bidderRequest.refererInfo.page,
domain: 'localhost.com',
name: 'localhost.com',
publisher: {
@@ -123,7 +123,7 @@ describe('Adot Adapter', function () {
it('should build request (video)', function () {
const bidderRequestId = 'bidderRequestId';
const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { video: { playerSize: [[300, 250]], minduration: 1, maxduration: 2, api: 'api', linearity: 'linearity', mimes: [], placement: 'placement', playbackmethod: 'playbackmethod', protocols: 'protocol', startdelay: 'startdelay' } }, params: { placementId: 'placementId', adUnitCode: 200 } }];
- const bidderRequest = { position: 2, refererInfo: { referer: 'http://localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
+ const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
@@ -154,7 +154,7 @@ describe('Adot Adapter', function () {
bidfloor: 0
}],
site: {
- page: bidderRequest.refererInfo.referer,
+ page: bidderRequest.refererInfo.page,
domain: 'localhost.com',
name: 'localhost.com',
publisher: {
diff --git a/test/spec/modules/adpartnerBidAdapter_spec.js b/test/spec/modules/adpartnerBidAdapter_spec.js
index 94b56f7735b..d9f9b0d0074 100644
--- a/test/spec/modules/adpartnerBidAdapter_spec.js
+++ b/test/spec/modules/adpartnerBidAdapter_spec.js
@@ -86,7 +86,7 @@ describe('AdpartnerAdapter', function () {
let bidderRequest = {
refererInfo: {
- referer: 'https://test.domain'
+ page: 'https://test.domain'
}
};
diff --git a/test/spec/modules/adrelevantisBidAdapter_spec.js b/test/spec/modules/adrelevantisBidAdapter_spec.js
index d25fdaf86d7..2612800aa56 100644
--- a/test/spec/modules/adrelevantisBidAdapter_spec.js
+++ b/test/spec/modules/adrelevantisBidAdapter_spec.js
@@ -69,7 +69,7 @@ describe('AdrelevantisAdapter', function () {
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].private_sizes).to.exist;
@@ -77,7 +77,7 @@ describe('AdrelevantisAdapter', function () {
});
it('should add source and verison to the tag', function () {
- const request = spec.buildRequests(bidRequests);
+ const request = spec.buildRequests(bidRequests, {});
const payload = JSON.parse(request.data);
expect(payload.sdk).to.exist;
expect(payload.sdk).to.deep.equal({
@@ -92,7 +92,7 @@ describe('AdrelevantisAdapter', function () {
bidRequest.mediaTypes = {};
bidRequest.mediaTypes[type] = {};
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].ad_types).to.deep.equal([type]);
@@ -104,14 +104,14 @@ describe('AdrelevantisAdapter', function () {
bidRequest.mediaTypes = {};
bidRequest.mediaTypes.video = {context: 'outstream'};
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].ad_types).to.deep.equal(['video']);
});
it('sends bid request to ENDPOINT via POST', function () {
- const request = spec.buildRequests(bidRequests);
+ const request = spec.buildRequests(bidRequests, {});
expect(request.url).to.equal(ENDPOINT);
expect(request.method).to.equal('POST');
});
@@ -131,7 +131,7 @@ describe('AdrelevantisAdapter', function () {
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].video).to.deep.equal({
id: 123,
@@ -168,7 +168,7 @@ describe('AdrelevantisAdapter', function () {
bidRequest2.adUnitCode = 'adUnit_code_2';
bidRequest2 = Object.assign({}, bidRequest2, videoData);
- const request = spec.buildRequests([bidRequest1, bidRequest2]);
+ const request = spec.buildRequests([bidRequest1, bidRequest2], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].video).to.deep.equal({
skippable: true,
@@ -195,7 +195,7 @@ describe('AdrelevantisAdapter', function () {
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.user).to.exist;
@@ -215,32 +215,27 @@ describe('AdrelevantisAdapter', function () {
}
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].hb_source).to.deep.equal(1);
});
it('adds context data (category and keywords) to request when set', function() {
let bidRequest = Object.assign({}, bidRequests[0]);
- sinon
- .stub(config, 'getConfig')
- .withArgs('ortb2')
- .returns({
- site: {
- keywords: 'US Open',
- ext: {
- data: {category: 'sports/tennis'}
- }
+ const ortb2 = {
+ site: {
+ keywords: 'US Open',
+ ext: {
+ data: {category: 'sports/tennis'}
}
- });
+ }
+ };
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {ortb2});
const payload = JSON.parse(request.data);
expect(payload.fpd.keywords).to.equal('US Open');
expect(payload.fpd.category).to.equal('sports/tennis');
-
- config.getConfig.restore();
});
it('should attach native params to the request', function () {
@@ -269,7 +264,7 @@ describe('AdrelevantisAdapter', function () {
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].native.layouts[0]).to.deep.equal({
@@ -306,13 +301,13 @@ describe('AdrelevantisAdapter', function () {
);
bidRequest.sizes = [[150, 100], [300, 250]];
- let request = spec.buildRequests([bidRequest]);
+ let request = spec.buildRequests([bidRequest], {});
let payload = JSON.parse(request.data);
expect(payload.tags[0].sizes).to.deep.equal([{width: 150, height: 100}, {width: 300, height: 250}]);
delete bidRequest.sizes;
- request = spec.buildRequests([bidRequest]);
+ request = spec.buildRequests([bidRequest], {});
payload = JSON.parse(request.data);
expect(payload.tags[0].sizes).to.deep.equal([{width: 1, height: 1}]);
@@ -338,7 +333,7 @@ describe('AdrelevantisAdapter', function () {
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].keywords).to.deep.equal([{
@@ -374,7 +369,7 @@ describe('AdrelevantisAdapter', function () {
}
);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.tags[0].use_pmt_rule).to.equal(true);
@@ -425,7 +420,7 @@ describe('AdrelevantisAdapter', function () {
}
}
);
- const request = spec.buildRequests([appRequest]);
+ const request = spec.buildRequests([appRequest], {});
const payload = JSON.parse(request.data);
expect(payload.app).to.exist;
expect(payload.app).to.deep.equal({
@@ -450,7 +445,7 @@ describe('AdrelevantisAdapter', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
- referer: 'http://example.com/page.html',
+ topmostLocation: 'http://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
@@ -478,7 +473,7 @@ describe('AdrelevantisAdapter', function () {
.withArgs('coppa')
.returns(true);
- const request = spec.buildRequests([bidRequest]);
+ const request = spec.buildRequests([bidRequest], {});
const payload = JSON.parse(request.data);
expect(payload.user.coppa).to.equal(true);
diff --git a/test/spec/modules/adrinoBidAdapter_spec.js b/test/spec/modules/adrinoBidAdapter_spec.js
index 52b2796e6db..a7b7007dcf8 100644
--- a/test/spec/modules/adrinoBidAdapter_spec.js
+++ b/test/spec/modules/adrinoBidAdapter_spec.js
@@ -75,7 +75,7 @@ describe('adrinoBidAdapter', function () {
it('should build the request correctly with gdpr', function () {
const result = spec.buildRequests(
[ bidRequest ],
- { gdprConsent: { gdprApplies: true, consentString: 'abc123' }, refererInfo: { referer: 'http://example.com/' } }
+ { gdprConsent: { gdprApplies: true, consentString: 'abc123' }, refererInfo: { page: 'http://example.com/' } }
);
expect(result.length).to.equal(1);
expect(result[0].method).to.equal('POST');
@@ -91,7 +91,7 @@ describe('adrinoBidAdapter', function () {
it('should build the request correctly without gdpr', function () {
const result = spec.buildRequests(
[ bidRequest ],
- { refererInfo: { referer: 'http://example.com/' } }
+ { refererInfo: { page: 'http://example.com/' } }
);
expect(result.length).to.equal(1);
expect(result[0].method).to.equal('POST');
diff --git a/test/spec/modules/aduptechBidAdapter_spec.js b/test/spec/modules/aduptechBidAdapter_spec.js
index 362cd3e506a..f76851861a3 100644
--- a/test/spec/modules/aduptechBidAdapter_spec.js
+++ b/test/spec/modules/aduptechBidAdapter_spec.js
@@ -77,59 +77,41 @@ describe('AduptechBidAdapter', () => {
});
it('should handle empty or missing data', () => {
- expect(internal.extractPageUrl(null)).to.equal(utils.getWindowTop().location.href);
- expect(internal.extractPageUrl({})).to.equal(utils.getWindowTop().location.href);
- expect(internal.extractPageUrl({ refererInfo: {} })).to.equal(utils.getWindowTop().location.href);
- expect(internal.extractPageUrl({ refererInfo: { canonicalUrl: null } })).to.equal(utils.getWindowTop().location.href);
- expect(internal.extractPageUrl({ refererInfo: { canonicalUrl: '' } })).to.equal(utils.getWindowTop().location.href);
+ expect(internal.extractPageUrl(null)).to.equal(utils.getWindowSelf().location.href);
+ expect(internal.extractPageUrl({})).to.equal(utils.getWindowSelf().location.href);
+ expect(internal.extractPageUrl({ refererInfo: {} })).to.equal(utils.getWindowSelf().location.href);
+ expect(internal.extractPageUrl({ refererInfo: { canonicalUrl: null } })).to.equal(utils.getWindowSelf().location.href);
+ expect(internal.extractPageUrl({ refererInfo: { canonicalUrl: '' } })).to.equal(utils.getWindowSelf().location.href);
});
- it('should use "pageUrl" from config', () => {
- config.setConfig({ pageUrl: 'http://page.url' });
-
- expect(internal.extractPageUrl({})).to.equal(config.getConfig('pageUrl'));
- });
-
- it('should use bidderRequest.refererInfo.canonicalUrl', () => {
+ it('should use bidderRequest.refererInfo.page', () => {
const bidderRequest = {
refererInfo: {
- canonicalUrl: 'http://canonical.url'
+ page: 'http://canonical.url'
}
};
- expect(internal.extractPageUrl(bidderRequest)).to.equal(bidderRequest.refererInfo.canonicalUrl);
- });
-
- it('should prefer bidderRequest.refererInfo.canonicalUrl over "pageUrl" from config', () => {
- const bidderRequest = {
- refererInfo: {
- canonicalUrl: 'http://canonical.url'
- }
- };
-
- config.setConfig({ pageUrl: 'http://page.url' });
-
- expect(internal.extractPageUrl(bidderRequest)).to.equal(bidderRequest.refererInfo.canonicalUrl);
+ expect(internal.extractPageUrl(bidderRequest)).to.equal(bidderRequest.refererInfo.page);
});
});
describe('extractReferrer', () => {
it('should handle empty or missing data', () => {
- expect(internal.extractReferrer(null)).to.equal(utils.getWindowTop().document.referrer);
- expect(internal.extractReferrer({})).to.equal(utils.getWindowTop().document.referrer);
- expect(internal.extractReferrer({ refererInfo: {} })).to.equal(utils.getWindowTop().document.referrer);
- expect(internal.extractReferrer({ refererInfo: { referer: null } })).to.equal(utils.getWindowTop().document.referrer);
- expect(internal.extractReferrer({ refererInfo: { referer: '' } })).to.equal(utils.getWindowTop().document.referrer);
+ expect(internal.extractReferrer(null)).to.equal(utils.getWindowSelf().document.referrer);
+ expect(internal.extractReferrer({})).to.equal(utils.getWindowSelf().document.referrer);
+ expect(internal.extractReferrer({ refererInfo: {} })).to.equal(utils.getWindowSelf().document.referrer);
+ expect(internal.extractReferrer({ refererInfo: { referer: null } })).to.equal(utils.getWindowSelf().document.referrer);
+ expect(internal.extractReferrer({ refererInfo: { referer: '' } })).to.equal(utils.getWindowSelf().document.referrer);
});
- it('hould use bidderRequest.refererInfo.referer', () => {
+ it('hould use bidderRequest.refererInfo.ref', () => {
const bidderRequest = {
refererInfo: {
- referer: 'foobar'
+ ref: 'foobar'
}
};
- expect(internal.extractReferrer(bidderRequest)).to.equal(bidderRequest.refererInfo.referer);
+ expect(internal.extractReferrer(bidderRequest)).to.equal(bidderRequest.refererInfo.ref);
});
});
@@ -426,8 +408,8 @@ describe('AduptechBidAdapter', () => {
const bidderRequest = {
auctionId: 'auctionId123',
refererInfo: {
- canonicalUrl: 'http://crazy.canonical.url',
- referer: 'http://crazy.referer.url'
+ page: 'http://crazy.canonical.url',
+ ref: 'http://crazy.referer.url'
},
gdprConsent: {
consentString: 'consentString123',
@@ -497,8 +479,8 @@ describe('AduptechBidAdapter', () => {
method: ENDPOINT_METHOD,
data: {
auctionId: bidderRequest.auctionId,
- pageUrl: bidderRequest.refererInfo.canonicalUrl,
- referrer: bidderRequest.refererInfo.referer,
+ pageUrl: bidderRequest.refererInfo.page,
+ referrer: bidderRequest.refererInfo.ref,
gdpr: {
consentString: bidderRequest.gdprConsent.consentString,
consentRequired: bidderRequest.gdprConsent.gdprApplies
@@ -526,8 +508,8 @@ describe('AduptechBidAdapter', () => {
method: ENDPOINT_METHOD,
data: {
auctionId: bidderRequest.auctionId,
- pageUrl: bidderRequest.refererInfo.canonicalUrl,
- referrer: bidderRequest.refererInfo.referer,
+ pageUrl: bidderRequest.refererInfo.page,
+ referrer: bidderRequest.refererInfo.ref,
gdpr: {
consentString: bidderRequest.gdprConsent.consentString,
consentRequired: bidderRequest.gdprConsent.gdprApplies
diff --git a/test/spec/modules/adxcgBidAdapter_spec.js b/test/spec/modules/adxcgBidAdapter_spec.js
index 7721295572c..32e9921f0ae 100644
--- a/test/spec/modules/adxcgBidAdapter_spec.js
+++ b/test/spec/modules/adxcgBidAdapter_spec.js
@@ -52,7 +52,7 @@ describe('Adxcg adapter', function () {
adzoneid: '19910113'
}
}];
- let request = spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}});
+ let request = spec.buildRequests(validBidRequests, {refererInfo: {page: 'page', domain: 'localhost'}});
assert.equal(request.method, 'POST');
assert.equal(request.url, 'https://pbc.adxcg.net/rtb/ortb/pbc?adExchangeId=1');
@@ -180,7 +180,7 @@ describe('Adxcg adapter', function () {
bidId: 'bidId',
params: {adzoneid: '1000'}
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}}).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, {refererInfo: {page: 'page', domain: 'localhost'}}).data);
assert.equal(request.device.ua, navigator.userAgent);
assert.equal(request.device.w, 100);
@@ -190,13 +190,14 @@ describe('Adxcg adapter', function () {
it('should send app info', function () {
config.setConfig({
app: {id: 'appid'},
- ortb2: {app: {name: 'appname'}}
});
+ const ortb2 = {app: {name: 'appname'}}
let validBidRequests = [{
bidId: 'bidId',
- params: {adzoneid: '1000'}
+ params: {adzoneid: '1000'},
+ ortb2
}];
- let request = JSON.parse(spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}}).data);
+ let request = JSON.parse(spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}, ortb2}).data);
assert.equal(request.app.id, 'appid');
assert.equal(request.app.name, 'appname');
@@ -211,26 +212,28 @@ describe('Adxcg adapter', function () {
domain: 'publisher.domain.com'
}
},
- ortb2: {
- site: {
- publisher: {
- id: 4441,
- name: 'publisher\'s name'
- }
+ });
+ const ortb2 = {
+ site: {
+ publisher: {
+ id: 4441,
+ name: 'publisher\'s name'
}
}
- });
+ };
+
let validBidRequests = [{
bidId: 'bidId',
- params: {adzoneid: '1000'}
+ params: {adzoneid: '1000'},
+ ortb2
}];
- let refererInfo = {referer: 'page'};
- let request = JSON.parse(spec.buildRequests(validBidRequests, {refererInfo}).data);
+ let refererInfo = {page: 'page', domain: 'localhost'};
+ let request = JSON.parse(spec.buildRequests(validBidRequests, {refererInfo, ortb2}).data);
assert.deepEqual(request.site, {
domain: 'localhost',
id: '123123',
- page: refererInfo.referer,
+ page: refererInfo.page,
publisher: {
domain: 'publisher.domain.com',
id: 4441,
diff --git a/test/spec/modules/adxpremiumAnalyticsAdapter_spec.js b/test/spec/modules/adxpremiumAnalyticsAdapter_spec.js
index e4a8fa9dccd..fd698e9e1fd 100644
--- a/test/spec/modules/adxpremiumAnalyticsAdapter_spec.js
+++ b/test/spec/modules/adxpremiumAnalyticsAdapter_spec.js
@@ -122,7 +122,7 @@ describe('AdxPremium analytics adapter', function () {
'auctionStart': 1589707613899,
'timeout': 2000,
'refererInfo': {
- 'referer': 'https://test.com/article/176067',
+ 'page': 'https://test.com/article/176067',
'reachedTop': true,
'numIframes': 0,
'stack': [
@@ -222,7 +222,7 @@ describe('AdxPremium analytics adapter', function () {
'auctionStart': 1589707613899,
'timeout': 2000,
'refererInfo': {
- 'referer': 'https://test.com/article/176067',
+ 'page': 'https://test.com/article/176067',
'reachedTop': true,
'numIframes': 0,
'stack': [
diff --git a/test/spec/modules/adyoulikeBidAdapter_spec.js b/test/spec/modules/adyoulikeBidAdapter_spec.js
index b5365e8d21a..12278900ab0 100644
--- a/test/spec/modules/adyoulikeBidAdapter_spec.js
+++ b/test/spec/modules/adyoulikeBidAdapter_spec.js
@@ -6,6 +6,7 @@ import { newBidder } from 'src/adapters/bidderFactory.js';
describe('Adyoulike Adapter', function () {
const canonicalUrl = 'https://canonical.url/?t=%26';
const referrerUrl = 'http://referrer.url/?param=value';
+ const domain = 'domain:123';
const defaultDC = 'hb-api';
const consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
const bidderRequest = {
@@ -16,7 +17,7 @@ describe('Adyoulike Adapter', function () {
consentString: consentString,
gdprApplies: true
},
- refererInfo: {referer: referrerUrl}
+ refererInfo: {location: referrerUrl, canonicalUrl, domain}
};
const bidRequestWithEmptyPlacement = [
{
@@ -592,20 +593,6 @@ describe('Adyoulike Adapter', function () {
});
describe('buildRequests', function () {
- let canonicalQuery;
-
- beforeEach(function () {
- let canonical = document.createElement('link');
- canonical.rel = 'canonical';
- canonical.href = canonicalUrl;
- canonicalQuery = sinon.stub(window.top.document.head, 'querySelector');
- canonicalQuery.withArgs('link[rel="canonical"][href]').returns(canonical);
- });
-
- afterEach(function () {
- canonicalQuery.restore();
- });
-
it('Should expand short native image config type', function() {
const request = spec.buildRequests(bidRequestWithNativeImageType, bidderRequest);
const payload = JSON.parse(request.data);
@@ -614,7 +601,7 @@ describe('Adyoulike Adapter', function () {
expect(request.method).to.equal('POST');
expect(request.url).to.contains('CanonicalUrl=' + encodeURIComponent(canonicalUrl));
expect(request.url).to.contains('RefererUrl=' + encodeURIComponent(referrerUrl));
- expect(request.url).to.contains('PublisherDomain=http%3A%2F%2Flocalhost%3A9876');
+ expect(request.url).to.contains('PublisherDomain=' + encodeURIComponent(domain));
expect(payload.Version).to.equal('1.0');
expect(payload.Bids['bid_id_0'].PlacementID).to.be.equal('placement_0');
@@ -711,7 +698,7 @@ describe('Adyoulike Adapter', function () {
expect(request.method).to.equal('POST');
expect(request.url).to.contains('CanonicalUrl=' + encodeURIComponent(canonicalUrl));
expect(request.url).to.contains('RefererUrl=' + encodeURIComponent(referrerUrl));
- expect(request.url).to.contains('PublisherDomain=http%3A%2F%2Flocalhost%3A9876');
+ expect(request.url).to.contains('PublisherDomain=' + encodeURIComponent(domain));
expect(payload.Version).to.equal('1.0');
expect(payload.Bids['bid_id_0'].PlacementID).to.be.equal('placement_0');
@@ -720,8 +707,7 @@ describe('Adyoulike Adapter', function () {
});
it('sends bid request to endpoint with single placement without canonical', function () {
- canonicalQuery.restore();
- const request = spec.buildRequests(bidRequestWithSinglePlacement, bidderRequest);
+ const request = spec.buildRequests(bidRequestWithSinglePlacement, {...bidderRequest, refererInfo: {...bidderRequest.refererInfo, canonicalUrl: null}});
const payload = JSON.parse(request.data);
expect(request.url).to.contain(getEndpoint());
@@ -735,8 +721,7 @@ describe('Adyoulike Adapter', function () {
});
it('sends bid request to endpoint with single placement multiple mediatype', function () {
- canonicalQuery.restore();
- const request = spec.buildRequests(bidRequestWithMultipleMediatype, bidderRequest);
+ const request = spec.buildRequests(bidRequestWithSinglePlacement, {...bidderRequest, refererInfo: {...bidderRequest.refererInfo, canonicalUrl: null}});
const payload = JSON.parse(request.data);
expect(request.url).to.contain(getEndpoint());
diff --git a/test/spec/modules/airgridRtdProvider_spec.js b/test/spec/modules/airgridRtdProvider_spec.js
index a54f6f40e2f..5b1df6f9d4c 100644
--- a/test/spec/modules/airgridRtdProvider_spec.js
+++ b/test/spec/modules/airgridRtdProvider_spec.js
@@ -110,18 +110,12 @@ describe('airgrid RTD Submodule', function () {
.withArgs(agRTD.AG_AUDIENCE_IDS_KEY)
.returns(JSON.stringify(MATCHED_AUDIENCES));
const audiences = agRTD.getMatchedAudiencesFromStorage();
- agRTD.setAudiencesUsingBidderOrtb2(
- RTD_CONFIG.dataProviders[0],
- audiences
- );
+ const bidderOrtb2 = agRTD.getAudiencesAsBidderOrtb2(RTD_CONFIG.dataProviders[0], audiences);
- const allBiddersConfig = config.getBidderConfig();
const bidders = RTD_CONFIG.dataProviders[0].params.bidders;
- Object.keys(allBiddersConfig).forEach((bidder) => {
+ Object.keys(bidderOrtb2).forEach((bidder) => {
if (bidders.indexOf(bidder) === -1) return;
- expect(
- deepAccess(allBiddersConfig[bidder], 'ortb2.user.ext.data.airgrid')
- ).to.eql(MATCHED_AUDIENCES);
+ expect(deepAccess(bidderOrtb2[bidder], 'ortb2.user.ext.data.airgrid')).to.eql(MATCHED_AUDIENCES);
});
});
diff --git a/test/spec/modules/ajaBidAdapter_spec.js b/test/spec/modules/ajaBidAdapter_spec.js
index 9bb77520212..a2095d52857 100644
--- a/test/spec/modules/ajaBidAdapter_spec.js
+++ b/test/spec/modules/ajaBidAdapter_spec.js
@@ -50,7 +50,7 @@ describe('AjaAdapter', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://hoge.com'
+ page: 'https://hoge.com'
}
};
@@ -88,7 +88,7 @@ describe('AjaAdapter', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://hoge.com'
+ page: 'https://hoge.com'
}
};
diff --git a/test/spec/modules/akamaiDAPIdSystem_spec.js b/test/spec/modules/akamaiDAPIdSystem_spec.js
deleted file mode 100644
index e44285eda34..00000000000
--- a/test/spec/modules/akamaiDAPIdSystem_spec.js
+++ /dev/null
@@ -1,117 +0,0 @@
-import {akamaiDAPIdSubmodule} from 'modules/akamaiDAPIdSystem.js';
-import * as utils from 'src/utils.js';
-import {server} from 'test/mocks/xhr.js';
-import {getStorageManager} from '../../../src/storageManager.js';
-
-export const storage = getStorageManager();
-
-const signatureConfigParams = {params: {
- apiHostname: 'prebid.dap.akadns.net',
- domain: 'prebid.org',
- type: 'dap-signature:1.0.0',
- apiVersion: 'v1'
-}};
-
-const tokenizeConfigParams = {params: {
- apiHostname: 'prebid.dap.akadns.net',
- domain: 'prebid.org',
- type: 'email',
- identity: 'amishra@xyz.com',
- apiVersion: 'v1'
-}};
-
-const x1TokenizeConfigParams = {params: {
- apiHostname: 'prebid.dap.akadns.net',
- domain: 'prebid.org',
- type: 'email',
- identity: 'amishra@xyz.com',
- apiVersion: 'x1',
- attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "Ace","last_name": "McCool" }'
-}};
-
-const consentData = {
- gdprApplies: true,
- consentString: 'BOkIpDSOkIpDSADABAENCc-AAAApOAFAAMAAsAMIAcAA_g'
-};
-
-const responseHeader = {'Content-Type': 'application/json'}
-
-const TEST_ID = '51sd61e3-sd82-4vea-8387-093dffca4a3a';
-
-describe('akamaiDAPId getId', function () {
- let logErrorStub;
-
- beforeEach(function () {
- logErrorStub = sinon.stub(utils, 'logError');
- });
-
- afterEach(function () {
- logErrorStub.restore();
- });
-
- describe('decode', function () {
- it('should respond with an object with dapId containing the value', () => {
- expect(akamaiDAPIdSubmodule.decode(TEST_ID)).to.deep.equal({
- dapId: TEST_ID
- });
- });
- });
-
- describe('getId', function () {
- it('should log an error if no configParams were passed when getId', function () {
- akamaiDAPIdSubmodule.getId(null);
- expect(logErrorStub.calledOnce).to.be.true;
- });
-
- it('should log an error if configParams were passed without apihostname', function () {
- akamaiDAPIdSubmodule.getId({ params: {
- domain: 'prebid.org',
- type: 'dap-signature:1.0.0'
- } });
- expect(logErrorStub.calledOnce).to.be.true;
- });
-
- it('should log an error if configParams were passed without domain', function () {
- akamaiDAPIdSubmodule.getId({ params: {
- apiHostname: 'prebid.dap.akadns.net',
- type: 'dap-signature:1.0.0'
- } });
- expect(logErrorStub.calledOnce).to.be.true;
- });
-
- it('should log an error if configParams were passed without type', function () {
- akamaiDAPIdSubmodule.getId({ params: {
- apiHostname: 'prebid.dap.akadns.net',
- domain: 'prebid.org'
- } });
- expect(logErrorStub.calledOnce).to.be.true;
- });
-
- it('akamaiDAPId submobile requires consent string to call API', function () {
- let consentData = {
- gdprApplies: true,
- consentString: ''
- };
- let submoduleCallback = akamaiDAPIdSubmodule.getId(signatureConfigParams, consentData);
- expect(submoduleCallback).to.be.undefined;
- });
-
- it('should call the signature v1 API and store token in Local storage', function () {
- let submoduleCallback1 = akamaiDAPIdSubmodule.getId(signatureConfigParams, consentData).id;
- expect(submoduleCallback1).to.be.eq(storage.getDataFromLocalStorage('akamai_dap_token'))
- storage.removeDataFromLocalStorage('akamai_dap_token');
- });
-
- it('should call the tokenize v1 API and store token in Local storage', function () {
- let submoduleCallback = akamaiDAPIdSubmodule.getId(tokenizeConfigParams, consentData).id;
- expect(submoduleCallback).to.be.eq(storage.getDataFromLocalStorage('akamai_dap_token'))
- storage.removeDataFromLocalStorage('akamai_dap_token');
- });
-
- it('should call the tokenize x1 API and store token in Local storage', function () {
- let submoduleCallback = akamaiDAPIdSubmodule.getId(x1TokenizeConfigParams, consentData).id;
- expect(submoduleCallback).to.be.eq(storage.getDataFromLocalStorage('akamai_dap_token'))
- storage.removeDataFromLocalStorage('akamai_dap_token');
- });
- });
-});
diff --git a/test/spec/modules/akamaiDapRtdProvider_spec.js b/test/spec/modules/akamaiDapRtdProvider_spec.js
index d7fd3d34099..337fcf57a33 100644
--- a/test/spec/modules/akamaiDapRtdProvider_spec.js
+++ b/test/spec/modules/akamaiDapRtdProvider_spec.js
@@ -6,6 +6,7 @@ import {
storage, DAP_MAX_RETRY_TOKENIZE, DAP_SS_ID, DAP_TOKEN, DAP_MEMBERSHIP, DAP_ENCRYPTED_MEMBERSHIP
} from 'modules/akamaiDapRtdProvider.js';
import {server} from 'test/mocks/xhr.js';
+import {hook} from '../../../src/hook.js';
const responseHeader = {'Content-Type': 'application/json'};
describe('akamaiDapRtdProvider', function() {
@@ -131,7 +132,15 @@ describe('akamaiDapRtdProvider', function() {
}
};
+ before(() => {
+ hook.ready();
+ });
+
+ let ortb2, bidConfig;
+
beforeEach(function() {
+ bidConfig = {ortb2Fragments: {}};
+ ortb2 = bidConfig.ortb2Fragments.global = {};
config.resetConfig();
storage.removeDataFromLocalStorage(DAP_TOKEN);
storage.removeDataFromLocalStorage(DAP_MEMBERSHIP);
@@ -156,14 +165,13 @@ describe('akamaiDapRtdProvider', function() {
let dapGetEncryptedRtdObjStub = sinon.stub(dapUtils, 'dapGetEncryptedRtdObj').returns(cachedEncRtd)
let callDapApisStub = sinon.stub(dapUtils, 'callDapAPIs')
try {
- const bidConfig = {};
storage.setDataInLocalStorage(DAP_TOKEN, JSON.stringify(sampleCachedToken));
- expect(config.getConfig().ortb2).to.be.undefined;
+ expect(ortb2).to.eql({});
generateRealTimeData(bidConfig, () => {}, emoduleConfig, {});
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([encRtdUserObj]);
+ expect(ortb2.user.data).to.deep.include.members([encRtdUserObj]);
generateRealTimeData(bidConfig, () => {}, cmoduleConfig, {});
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj]);
+ expect(ortb2.user.data).to.deep.include.members([rtdUserObj]);
} finally {
dapGetRtdObjStub.restore()
dapGetMembershipFromLocalStorageStub.restore()
@@ -176,11 +184,10 @@ describe('akamaiDapRtdProvider', function() {
describe('calling DAP APIs', function() {
it('Calls callDapAPIs for unencrypted segments flow', function() {
- const bidConfig = {};
storage.setDataInLocalStorage(DAP_TOKEN, JSON.stringify(sampleCachedToken));
let dapExtractExpiryFromTokenStub = sinon.stub(dapUtils, 'dapExtractExpiryFromToken').returns(cacheExpiry)
try {
- expect(config.getConfig().ortb2).to.be.undefined;
+ expect(ortb2).to.eql({});
dapUtils.callDapAPIs(bidConfig, () => {}, cmoduleConfig, {});
let membership = {'cohorts': ['9', '11', '13'], 'said': 'sample-said'}
let membershipRequest = server.requests[0];
@@ -190,18 +197,17 @@ describe('akamaiDapRtdProvider', function() {
responseHeader['Akamai-DAP-Token'] = tokenWithExpiry;
tokenizeRequest.respond(200, responseHeader, JSON.stringify(tokenWithExpiry));
let data = dapUtils.dapGetRtdObj(membership, cmoduleConfig.params.segtax);
- expect(config.getConfig().ortb2.user.data).to.deep.include.members(data.rtd.ortb2.user.data);
+ expect(ortb2.user.data).to.deep.include.members(data.rtd.ortb2.user.data);
} finally {
dapExtractExpiryFromTokenStub.restore();
}
});
it('Calls callDapAPIs for encrypted segments flow', function() {
- const bidConfig = {};
storage.setDataInLocalStorage(DAP_TOKEN, JSON.stringify(sampleCachedToken));
let dapExtractExpiryFromTokenStub = sinon.stub(dapUtils, 'dapExtractExpiryFromToken').returns(cacheExpiry)
try {
- expect(config.getConfig().ortb2).to.be.undefined;
+ expect(ortb2).to.eql({});
dapUtils.callDapAPIs(bidConfig, () => {}, emoduleConfig, {});
let encMembership = 'Sample-enc-token';
let membershipRequest = server.requests[0];
@@ -212,7 +218,7 @@ describe('akamaiDapRtdProvider', function() {
responseHeader['Akamai-DAP-Token'] = tokenWithExpiry;
tokenizeRequest.respond(200, responseHeader, JSON.stringify(tokenWithExpiry));
let data = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, emoduleConfig.params.segtax);
- expect(config.getConfig().ortb2.user.data).to.deep.include.members(data.rtd.ortb2.user.data);
+ expect(ortb2.user.data).to.deep.include.members(data.rtd.ortb2.user.data);
} finally {
dapExtractExpiryFromTokenStub.restore();
}
@@ -392,7 +398,7 @@ describe('akamaiDapRtdProvider', function() {
domain: 'prebid.org',
segtax: 503
};
- expect(dapUtils.dapRefreshMembership(config, 'token', onDone)).to.equal(undefined)
+ expect(dapUtils.dapRefreshMembership(ortb2, config, 'token', onDone)).to.equal(undefined)
const membership = {cohorts: ['1', '5', '7']}
expect(dapUtils.dapGetRtdObj(membership, config.segtax)).to.not.equal(undefined);
});
@@ -400,11 +406,11 @@ describe('akamaiDapRtdProvider', function() {
describe('checkAndAddRealtimeData test', function () {
it('add realtime data for segtax 503 and 504', function () {
- dapUtils.checkAndAddRealtimeData(cachedEncRtd, 504);
- dapUtils.checkAndAddRealtimeData(cachedEncRtd, 504);
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([encRtdUserObj]);
- dapUtils.checkAndAddRealtimeData(cachedRtd, 503);
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj]);
+ dapUtils.checkAndAddRealtimeData(ortb2, cachedEncRtd, 504);
+ dapUtils.checkAndAddRealtimeData(ortb2, cachedEncRtd, 504);
+ expect(ortb2.user.data).to.deep.include.members([encRtdUserObj]);
+ dapUtils.checkAndAddRealtimeData(ortb2, cachedRtd, 503);
+ expect(ortb2.user.data).to.deep.include.members([rtdUserObj]);
});
});
@@ -419,7 +425,7 @@ describe('akamaiDapRtdProvider', function() {
describe('dapRefreshToken test', function () {
it('test dapRefreshToken success response', function () {
- dapUtils.dapRefreshToken(sampleConfig, true, onDone)
+ dapUtils.dapRefreshToken(ortb2, sampleConfig, true, onDone)
let request = server.requests[0];
responseHeader['Akamai-DAP-Token'] = sampleCachedToken.token;
request.respond(200, responseHeader, JSON.stringify(sampleCachedToken.token));
@@ -427,7 +433,7 @@ describe('akamaiDapRtdProvider', function() {
});
it('test dapRefreshToken success response with deviceid 100', function () {
- dapUtils.dapRefreshToken(esampleConfig, true, onDone)
+ dapUtils.dapRefreshToken(ortb2, esampleConfig, true, onDone)
let request = server.requests[0];
responseHeader['Akamai-DAP-100'] = sampleCachedToken.token;
request.respond(200, responseHeader, '');
@@ -435,7 +441,7 @@ describe('akamaiDapRtdProvider', function() {
});
it('test dapRefreshToken success response with exp claim', function () {
- dapUtils.dapRefreshToken(sampleConfig, true, onDone)
+ dapUtils.dapRefreshToken(ortb2, sampleConfig, true, onDone)
let request = server.requests[0];
let tokenWithExpiry = 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoicGFzc3dvcmQxIiwiZXhwIjoxNjQzODMwMzY5fQ..hTbcSQgmmO0HUJJrQ5fRHw.7zjrQXNNVkb-GD0ZhIVhEPcWbyaDBilHTWv-bp1lFZ9mdkSC0QbcAvUbYteiTD7ya23GUwcL2WOW8WgRSHaWHOJe0B5NDqfdUGTzElWfu7fFodRxRgGmwG8Rq5xxteFKLLGHLf1mFYRJKDtjtgajGNUKIDfn9AEt-c5Qz4KU8VolG_KzrLROx-f6Z7MnoPTcwRCj0WjXD6j2D6RAZ80-mKTNIsMIELdj6xiabHcjDJ1WzwtwCZSE2y2nMs451pSYp8W-bFPfZmDDwrkjN4s9ASLlIXcXgxK-H0GsiEbckQOZ49zsIKyFtasBvZW8339rrXi1js-aBh99M7aS5w9DmXPpUDmppSPpwkeTfKiqF0cQiAUq8tpeEQrGDJuw3Qt2.XI8h9Xw-VZj_NOmKtV19wLM63S4snos7rzkoHf9FXCw'
responseHeader['Akamai-DAP-Token'] = tokenWithExpiry;
@@ -445,7 +451,7 @@ describe('akamaiDapRtdProvider', function() {
it('test dapRefreshToken error response', function () {
storage.setDataInLocalStorage(DAP_TOKEN, JSON.stringify(sampleCachedToken));
- dapUtils.dapRefreshToken(sampleConfig, false, onDone)
+ dapUtils.dapRefreshToken(ortb2, sampleConfig, false, onDone)
let request = server.requests[0];
request.respond(400, responseHeader, 'error');
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_TOKEN)).expires_at).to.be.equal(cacheExpiry);// Since the expiry is same, the token is not updated in the cache
@@ -456,35 +462,35 @@ describe('akamaiDapRtdProvider', function() {
it('test dapRefreshEncryptedMembership success response', function () {
let expiry = Math.round(Date.now() / 1000.0) + 3600; // in seconds
let encMembership = 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoic29tZXNlY3JldGludmF1bHQifQ..f8_At4OqeQXyQcSwThOJ_w.69ImVQ3bEZ6QP7ROCRpAJjNcKY49SEPYR6qTp_8l7L8kQdPbpi4wmuOzt78j7iBrX64k2wltzmQFjDmVKSxDhrEguxpgx6t-L1tT8ZA0UosMWpVsgmKEZxOn2e9ES3jw8RNCS4WSWocSPQX33xSb51evXjm9E1s0tGoLnwXl0GsUvzRsSU86wQG6RZnAQTi7s-r-M2TKibdDjUqgIt62vJ-aBZ7RWw91MINgOdmDNs1bFfbBX5Cy1kd4-kjvRDz_aJ6zHX4sK_7EmQhGEY3tW-A3_l2I88mw-RSJaPkb_IWg0QpVwXDaE2F2g8NpY1PzCRvG_NIE8r28eK5q44OMVitykHmKmBXGDj7z2JVgoXkfo5u0I-dypZARn4GP_7niK932avB-9JD7Mz3TrlU4GZ7IpYfJ91PMsRhrs5xNPQwLZbpuhF76A7Dp7iss71UjkGCiPTU6udfRb4foyf_7xEF66m1eQVcVaMdxEbMuu9GBfdr-d04TbtJhPfUV8JfxTenvRYoi13n0j5kH0M5OgaSQD9kQ3Mrd9u-Cms-BGtT0vf-N8AaFZY_wn0Y4rkpv5HEaH7z3iT4RCHINWrXb_D0WtjLTKQi2YmF8zMlzUOewNJGwZRwbRwxc7JoDIKEc5RZkJYevfJXOEEOPGXZ7AGZxOEsJawPqFqd_nOUosCZS4akHhcDPcVowoecVAV0hhhoS6JEY66PhPp1snbt6yqA-fQhch7z8Y-DZT3Scibvffww3Scg_KFANWp0KeEvHG0vyv9R2F4o66viSS8y21MDnM7Yjk8C-j7aNMldUQbjN_7Yq1nkfe0jiBX_hsINBRPgJHUY4zCaXuyXs-JZZfU92nwG0RT3A_3RP2rpY8-fXp9d3C2QJjEpnmHvTMsuAZCQSBe5DVrJwN_UKedxcJEoOt0wLz6MaCMyYZPd8tnQeqYK1cd3RgQDXtzKC0HDw1En489DqJXEst4eSSkaaW1lImLeaF8XCOaIqPqoyGk4_6KVLw5Q7OnpczuXqYKMd9UTMovGeuTuo1k0ddfEqTq9QwxkwZL51AiDRnwTCAeYBU1krV8FCJQx-mH_WPB5ftZj-o_3pbvANeRk27QBVmjcS-tgDllJkWBxX-4axRXzLw8pUUUZUT_NOL0OiqUCWVm0qMBEpgRQ57Se42-hkLMTzLhhGJOnVcaXU1j4ep-N7faNvbgREBjf_LgzvaWS90a2NJ9bB_J9FyXelhCN_AMLfdOS3fHkeWlZ0u0PMbn5DxXRMe0l9jB-2VJZhcPQRlWoYyoCO3l4F5ZmuQP5Xh9CU4tvSWih6jlwMDgdVWuTpdfPD5bx8ccog3JDq87enx-QtPzLU3gMgouNARJGgNwKS_GJSE1uPrt2oiqgZ3Z0u_I5MKvPdQPV3o-4rsaE730eB4OwAOF-mkGWpzy8Pbl-Qe5PR9mHBhuyJgZ-WDSCHl5yvet2kfO9mPXZlqBQ26fzTcUYH94MULAZn36og6w.3iKGv-Le-AvRmi26W1v6ibRLGbwKbCR92vs-a9t55hw';
- dapUtils.dapRefreshEncryptedMembership(esampleConfig, sampleCachedToken.token, onDone)
+ dapUtils.dapRefreshEncryptedMembership(ortb2, esampleConfig, sampleCachedToken.token, onDone)
let request = server.requests[0];
responseHeader['Akamai-DAP-Token'] = encMembership;
request.respond(200, responseHeader, encMembership);
let rtdObj = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, 504)
- expect(config.getConfig().ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
+ expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_ENCRYPTED_MEMBERSHIP)).expires_at).to.equal(expiry);
});
it('test dapRefreshEncryptedMembership success response with exp claim', function () {
let encMembership = 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoic29tZXNlY3JldGludmF1bHQiLCJleHAiOjE2NDM4MzA2NDB9..inYoxwht_aqTIWqGhEm_Gw.wDcCUOCwtqgnNUouaD723gKfm7X7bgkHgtiX4mr07P3tWk25PUQunmwTLhWBB5CYzzGIfIvveG_u4glNRLi_eRSQV4ihKKk1AN-BSSJ3d0CLAdY9I1WG5vX1VmopXyKnV90bl9SLNqnhg4Vxe6YU4ogTYxsKHuIN1EeIH4hpl-HbCQWQ1DQt4mB-MQF8V9AWTfU0D7sFMSK8f9qj6NGmf1__oHdHUlws0t5V2UAn_dhJexsuREK_gh65pczCuly5eEcziZ82LeP-nOhKWSRHB_tS_mKXrRU6_At_EVDgtfA3PSBJ6eQylCii6bTL42vZzz4jZhJv_3eLfRdKqpVT5CWNBzcDoQ2VcQgKgIBtPJ45KFfAYTQ6kdl21QMSjqtu8GTsv1lEZtrqHY6zRiG8_Mu28-PmjEw4LDdZmBDOeroue_MJD6wuE_jlE7J2iVdo8CkVnoRgzFwNbKBo7CK4z0WahV9rhuOm0LKAN5H0jF_gj696U-3fVTDTIb8ndNKNI2_xAhvWs00BFGtUtWgr8QGDGRTDCNGsDgnb_Vva9xCqVOyAE9O3Fq1QYl-tMA-KkBt3zzvmFFpOxpOyH-lUubKLKlsrxKc3GSyVEQ9DDLhrXXJgR5H5BSE4tjlK7p3ODF5qz0FHtIj7oDcgLazFO7z2MuFy2LjJmd3hKl6ujcfYEDiQ4D3pMIo7oiU33aFBD1YpzI4-WzNfJlUt1FoK0-DAXpbbV95s8p08GOD4q81rPw5hRADKJEr0QzrbDwplTWCzT2fKXMg_dIIc5AGqGKnVRUS6UyF1DnHpudNIJWxyWZjWIEw_QNjU0cDFmyPSyKxNrnfq9w8WE2bfbS5KTicxei5QHnC-cnL7Nh7IXp7WOW6R1YHbNPT7Ad4OhnlV-jjrXwkSv4wMAbfwAWoSCchGh7uvENNAeJymuponlJbOgw_GcYM73hMs8Z8W9qxRfbyF4WX5fDKXg61mMlaieHkc0EnoC5q7uKyXuZUehHZ76JLDFmewslLkQq5SkVCttzJePBnY1ouPEHw5ZTzUnG5f01QQOVcjIN-AqXNDbG5IOwq0heyS6vVfq7lZKJdLDVQ21qRjazGPaqYwLzugkWkzCOzPTgyFdbXzgjfmJwylHSOM5Jpnul84GzxEQF-1mHP2A8wtIT-M7_iX24It2wwWvc8qLA6GEqruWCtNyoug8CXo44mKdSSCGeEZHtfMbzXdLIBHCy2jSHz5i8S7DU_R7rE_5Ssrb81CqIYbgsAQBHtOYoyvzduTOruWcci4De0QcULloqImIEHUuIe2lnYO889_LIx5p7nE3UlSvLBo0sPexavFUtHqI6jdG6ye9tdseUEoNBDXW0aWD4D-KXX1JLtAgToPVUtEaXCJI7QavwO9ZG6UZM6jbfuJ5co0fvUXp6qYrFxPQo2dYHkar0nT6s1Zg5l2g8yWlLUJrHdHAzAw_NScUp71OpM4TmNsLnYaPVPcOxMvtJXTanbNWr0VKc8gy9q3k_1XxAnQwiduNs7f5bA-6qCVpayHv5dE7mUhFEwyh1_w95jEaURsQF_hnnd2OqRkADfiok4ZiPU2b38kFW1LXjpI39XXES3JU0e08Rq2uuelyLbCLWuJWq_axuKSZbZvpYeqWtIAde8FjCiO7RPlEc0nyzWBst8RBxQ-Bekg9UXPhxBRcm0HwA.Q2cBSFOQAC-QKDwmjrQXnVQd3jNOppMl9oZfd2yuKeY';
- dapUtils.dapRefreshEncryptedMembership(esampleConfig, sampleCachedToken.token, onDone)
+ dapUtils.dapRefreshEncryptedMembership(ortb2, esampleConfig, sampleCachedToken.token, onDone)
let request = server.requests[0];
responseHeader['Akamai-DAP-Token'] = encMembership;
request.respond(200, responseHeader, encMembership);
let rtdObj = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, 504)
- expect(config.getConfig().ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
+ expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_ENCRYPTED_MEMBERSHIP)).expires_at).to.equal(1643830630);
});
it('test dapRefreshEncryptedMembership error response', function () {
- dapUtils.dapRefreshEncryptedMembership(esampleConfig, sampleCachedToken.token, onDone)
+ dapUtils.dapRefreshEncryptedMembership(ortb2, esampleConfig, sampleCachedToken.token, onDone)
let request = server.requests[0];
request.respond(400, responseHeader, 'error');
- expect(config.getConfig().ortb2).to.be.equal(undefined);
+ expect(ortb2).to.eql({});
});
it('test dapRefreshEncryptedMembership 403 error response', function () {
- dapUtils.dapRefreshEncryptedMembership(esampleConfig, sampleCachedToken.token, onDone)
+ dapUtils.dapRefreshEncryptedMembership(ortb2, esampleConfig, sampleCachedToken.token, onDone)
let request = server.requests[0];
request.respond(403, responseHeader, 'error');
let requestTokenize = server.requests[1];
@@ -499,32 +505,32 @@ describe('akamaiDapRtdProvider', function() {
describe('dapRefreshMembership test', function () {
it('test dapRefreshMembership success response', function () {
let membership = {'cohorts': ['9', '11', '13'], 'said': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoicGFzc3dvcmQxIn0..17wnrhz6FbWx0Cf6LXpm1A.m9PKVCradk3CZokNKzVHzE06TOqiXYeijgxTQUiQy5Syx-yicnO8DyYX6zQ6rgPcNgUNRt4R4XE5MXuK0laUVQJr9yc9g3vUfQfw69OMYGW_vRlLMPzoNOhF2c4gSyfkRrLr7C0qgALmZO1D11sPflaCTNmO7pmZtRaCOB5buHoWcQhp1bUSJ09DNDb31dX3llimPwjNGSrUhyq_EZl4HopnnjxbM4qVNMY2G_43C_idlVOvbFoTxcDRATd-6MplJoIOIHQLDZEetpIOVcbEYN9gQ_ndBISITwuu5YEgs5C_WPHA25nm6e4BT5R-tawSA8yPyQAupqE8gk4ZWq_2-T0cqyTstIHrMQnZ_vysYN7h6bkzE-KeZRk7GMtySN87_fiu904hLD9QentGegamX6UAbVqQh7Htj7SnMHXkEenjxXAM5mRqQvNCTlw8k-9-VPXs-vTcKLYP8VFf8gMOmuYykgWac1gX-svyAg-24mo8cUbqcsj9relx4Qj5HiXUVyDMBZxK-mHZi-Xz6uv9GlggcsjE13DSszar-j2OetigpdibnJIxRZ-4ew3-vlvZ0Dul3j0LjeWURVBWYWfMjuZ193G7lwR3ohh_NzlNfwOPBK_SYurdAnLh7jJgTW-lVLjH2Dipmi9JwX9s03IQq9opexAn7hlM9oBI6x5asByH8JF8WwZ5GhzDjpDwpSmHPQNGFRSyrx_Sh2CPWNK6C1NJmLkyqAtJ5iw0_al7vPDQyZrKXaLTjBCUnbpJhUZ8dUKtWLzGPjzFXp10muoDIutd1NfyKxk1aWGhx5aerYuLdywv6cT_M8RZTi8924NGj5VA30V5OvEwLLyX93eDhntXZSCbkPHpAfiRZNGXrPY.GhCbWGQz11mIRD4uPKmoAuFXDH7hGnils54zg7N7-TU'}
- dapUtils.dapRefreshMembership(sampleConfig, sampleCachedToken.token, onDone);
+ dapUtils.dapRefreshMembership(ortb2, sampleConfig, sampleCachedToken.token, onDone);
let request = server.requests[0];
request.respond(200, responseHeader, JSON.stringify(membership));
let rtdObj = dapUtils.dapGetRtdObj(membership, 503);
- expect(config.getConfig().ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
+ expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
});
it('test dapRefreshMembership success response with exp claim', function () {
let membership = {'cohorts': ['9', '11', '13'], 'said': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoicGFzc3dvcmQxIiwiZXhwIjoxNjQ3OTcxNTU4fQ..ptdM5WO-62ypXlKxFXD4FQ.waEo9MHS2NYQCi-zh_p6HgT9BdqGyQbBq4GfGLfsay4nRBgICsTS-VkV6e7xx5U1T8BgpKkRJIZBwTOY5Pkxk9FpK5nnffDSEljRrp1LXLCkNP4qwrlqHInFbZsonNWW4_mW-7aUPlTwIsTbfjTuyHdXHeQa1ALrwFFFWE7QUmPNd2RsHjDwUsxlJPEb5TnHn5W0Mgo_PQZaxvhJInMbxPgtJLoqnJvOqCBEoQY7au7ALZL_nWK8XIwPMF19J7Z3cBg9vQInhr_E3rMdQcAFHEzYfgoNcIYCCR0t1UOqUE3HNtX-E64kZAYKWdlsBb9eW5Gj9hHYyPNL_4Hntjg5eLXGpsocMg0An-qQKGC6hkrxKzeM-GrjpvSaQLNs4iqDpHUtzA02LW_vkLkMNRUiyXVJ3FUZwfyq6uHSRKWZ6UFdAfL0rfJ8q8x8Ll-qJO2Jfyvidlsi9FIs7x1WJrvDCKepfAQM1UXRTonrQljFBAk83PcL2bmWuJDgJZ0lWS4VnZbIf6A7fDourmkDxdVRptvQq5nSjtzCA6whRw0-wGz8ehNJsaJw9H_nG9k4lRKs7A5Lqsyy7TVFrAPjnA_Q1a2H6xF2ULxrtIqoNqdX7k9RjowEZSQlZgZUOAmI4wzjckdcSyC_pUlYBMcBwmlld34mmOJe9EBHAxjdci7Q_9lvj1HTcwGDcQITXnkW9Ux5Jkt9Naw-IGGrnEIADaT2guUAto8W_Gb05TmwHSd6DCmh4zepQCbqeVe6AvPILtVkTgsTTo27Q-NvS7h-XtthJy8425j5kqwxxpZFJ0l0ytc6DUyNCLJXuxi0JFU6-LoSXcROEMVrHa_Achufr9vHIELwacSAIHuwseEvg_OOu1c1WYEwZH8ynBLSjqzy8AnDj24hYgA0YanPAvDqacrYrTUFqURbHmvcQqLBTcYa_gs7uDx4a1EjtP_NvHRlvCgGAaASrjGMhTX8oJxlTqahhQ.pXm-7KqnNK8sbyyczwkVYhcjgiwkpO8LjBBVw4lcyZE'};
- dapUtils.dapRefreshMembership(sampleConfig, sampleCachedToken.token, onDone);
+ dapUtils.dapRefreshMembership(ortb2, sampleConfig, sampleCachedToken.token, onDone);
let request = server.requests[0];
request.respond(200, responseHeader, JSON.stringify(membership));
let rtdObj = dapUtils.dapGetRtdObj(membership, 503)
- expect(config.getConfig().ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
+ expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_MEMBERSHIP)).expires_at).to.be.equal(1647971548);
});
it('test dapRefreshMembership 400 error response', function () {
- dapUtils.dapRefreshMembership(sampleConfig, sampleCachedToken.token, onDone)
+ dapUtils.dapRefreshMembership(ortb2, sampleConfig, sampleCachedToken.token, onDone)
let request = server.requests[0];
request.respond(400, responseHeader, 'error');
- expect(config.getConfig().ortb2).to.be.equal(undefined);
+ expect(ortb2).to.eql({});
});
it('test dapRefreshMembership 403 error response', function () {
- dapUtils.dapRefreshMembership(sampleConfig, sampleCachedToken.token, onDone)
+ dapUtils.dapRefreshMembership(ortb2, sampleConfig, sampleCachedToken.token, onDone)
let request = server.requests[0];
request.respond(403, responseHeader, 'error');
expect(server.requests.length).to.be.equal(DAP_MAX_RETRY_TOKENIZE);
@@ -548,7 +554,7 @@ describe('akamaiDapRtdProvider', function() {
describe('Akamai-DAP-SS-ID test', function () {
it('Akamai-DAP-SS-ID present in response header', function () {
let expiry = Math.round(Date.now() / 1000.0) + 300; // in seconds
- dapUtils.dapRefreshToken(sampleConfig, false, onDone)
+ dapUtils.dapRefreshToken(ortb2, sampleConfig, false, onDone)
let request = server.requests[0];
let sampleSSID = 'Test_SSID_Spec';
responseHeader['Akamai-DAP-Token'] = sampleCachedToken.token;
@@ -560,7 +566,7 @@ describe('akamaiDapRtdProvider', function() {
it('Test if Akamai-DAP-SS-ID is present in request header', function () {
let expiry = Math.round(Date.now() / 1000.0) + 100; // in seconds
storage.setDataInLocalStorage(DAP_SS_ID, JSON.stringify('Test_SSID_Spec'))
- dapUtils.dapRefreshToken(sampleConfig, false, onDone)
+ dapUtils.dapRefreshToken(ortb2, sampleConfig, false, onDone)
let request = server.requests[0];
let ssidHeader = request.requestHeaders['Akamai-DAP-SS-ID'];
responseHeader['Akamai-DAP-Token'] = sampleCachedToken.token;
diff --git a/test/spec/modules/alkimiBidAdapter_spec.js b/test/spec/modules/alkimiBidAdapter_spec.js
index 58a5a3b54ab..9147f4548bd 100644
--- a/test/spec/modules/alkimiBidAdapter_spec.js
+++ b/test/spec/modules/alkimiBidAdapter_spec.js
@@ -88,7 +88,7 @@ describe('alkimiBidAdapter', function () {
const bidderRequest = spec.buildRequests(bidRequests, {
auctionId: '123',
refererInfo: {
- referer: 'http://test.com/path.html'
+ page: 'http://test.com/path.html'
}
})
diff --git a/test/spec/modules/amxBidAdapter_spec.js b/test/spec/modules/amxBidAdapter_spec.js
index f502d631c17..e6a87d6035e 100644
--- a/test/spec/modules/amxBidAdapter_spec.js
+++ b/test/spec/modules/amxBidAdapter_spec.js
@@ -31,15 +31,6 @@ const sampleFPD = {
}
};
-const stubConfig = (withStub) => {
- const stub = sinon.stub(config, 'getConfig').callsFake(
- (arg) => arg === 'ortb2' ? sampleFPD : null
- )
-
- withStub();
- stub.restore();
-};
-
const sampleBidderRequest = {
gdprConsent: {
gdprApplies: true,
@@ -49,9 +40,11 @@ const sampleBidderRequest = {
auctionId: utils.getUniqueIdentifierStr(),
uspConsent: '1YYY',
refererInfo: {
- referer: 'https://www.prebid.org',
+ location: 'https://www.prebid.org',
+ topmostLocation: 'https://www.prebid.org',
canonicalUrl: 'https://www.prebid.org/the/link/to/the/page'
- }
+ },
+ ortb2: sampleFPD
};
const sampleBidRequestBase = {
@@ -235,35 +228,22 @@ describe('AmxBidAdapter', () => {
const { data } = spec.buildRequests([sampleBidRequestBase], {
...sampleBidderRequest,
refererInfo: {
- numIframes: 1,
- referer: 'http://search-traffic-source.com',
- stack: []
+ location: null,
+ topmostLocation: null,
+ ref: 'http://search-traffic-source.com',
}
});
expect(data.do).to.equal('localhost')
expect(data.re).to.equal('http://search-traffic-source.com');
});
- it('if we are in AMP, make sure we use the canonical URL or the referrer (which is sourceUrl)', () => {
- const { data } = spec.buildRequests([sampleBidRequestBase], {
- ...sampleBidderRequest,
- refererInfo: {
- isAmp: true,
- referer: 'http://real-publisher-site.com/content',
- stack: []
- }
- });
- expect(data.do).to.equal('real-publisher-site.com')
- expect(data.re).to.equal('http://real-publisher-site.com/content');
- })
-
it('if prebid is in an iframe, will use the topmost url as domain', () => {
const { data } = spec.buildRequests([sampleBidRequestBase], {
...sampleBidderRequest,
refererInfo: {
- numIframes: 1,
- referer: 'http://search-traffic-source.com',
- stack: ['http://top-site.com', 'http://iframe.com']
+ location: null,
+ topmostLocation: 'http://top-site.com',
+ ref: 'http://search-traffic-source.com',
}
});
expect(data.do).to.equal('top-site.com');
@@ -293,10 +273,8 @@ describe('AmxBidAdapter', () => {
expect(data.trc).to.equal(0)
});
it('will forward first-party data', () => {
- stubConfig(() => {
- const { data } = spec.buildRequests([sampleBidRequestBase], sampleBidderRequest);
- expect(data.fpd2).to.deep.equal(sampleFPD)
- });
+ const { data } = spec.buildRequests([sampleBidRequestBase], sampleBidderRequest);
+ expect(data.fpd2).to.deep.equal(sampleFPD)
});
it('will collect & forward RTI user IDs', () => {
diff --git a/test/spec/modules/apacdexBidAdapter_spec.js b/test/spec/modules/apacdexBidAdapter_spec.js
index ff1d3b813ce..773c9925d58 100644
--- a/test/spec/modules/apacdexBidAdapter_spec.js
+++ b/test/spec/modules/apacdexBidAdapter_spec.js
@@ -730,22 +730,4 @@ describe('ApacdexBidAdapter', function () {
expect(validateGeoObject(geoObject)).to.equal(false);
});
});
-
- describe('getDomain', function () {
- it('should return valid domain from publisherDomain config', () => {
- let pageUrl = 'https://www.example.com/page/prebid/exam.html';
- config.setConfig({ publisherDomain: pageUrl });
- expect(getDomain(pageUrl)).to.equal('example.com');
- });
- it('should return valid domain from pageUrl argument', () => {
- let pageUrl = 'https://www.example.com/page/prebid/exam.html';
- config.setConfig({ publisherDomain: '' });
- expect(getDomain(pageUrl)).to.equal('example.com');
- });
- it('should return undefined if pageUrl and publisherDomain not config', () => {
- let pageUrl;
- config.setConfig({ publisherDomain: '' });
- expect(getDomain(pageUrl)).to.equal(pageUrl);
- });
- });
});
diff --git a/test/spec/modules/appierBidAdapter_spec.js b/test/spec/modules/appierBidAdapter_spec.js
index 5b6ccf14162..8b6ad5c2f6f 100644
--- a/test/spec/modules/appierBidAdapter_spec.js
+++ b/test/spec/modules/appierBidAdapter_spec.js
@@ -64,12 +64,16 @@ describe('AppierAdapter', function () {
'auctionId': '1d1a030790a475',
};
const fakeBidRequests = [bid];
- const fakeBidderRequest = {refererInfo: {
- 'referer': 'fakeReferer',
- 'reachedTop': true,
- 'numIframes': 1,
- 'stack': []
- }};
+ const fakeBidderRequest = {
+ refererInfo: {
+ legacy: {
+ 'referer': 'fakeReferer',
+ 'reachedTop': true,
+ 'numIframes': 1,
+ 'stack': []
+ }
+ }
+ };
const builtRequests = spec.buildRequests(fakeBidRequests, fakeBidderRequest);
expect(builtRequests.length).to.equal(1);
@@ -77,7 +81,7 @@ describe('AppierAdapter', function () {
expect(builtRequests[0].url).match(/v1\/prebid\/bid/);
expect(builtRequests[0].data).deep.equal({
'bids': fakeBidRequests,
- 'refererInfo': fakeBidderRequest.refererInfo,
+ 'refererInfo': fakeBidderRequest.refererInfo.legacy,
'version': ADAPTER_VERSION
});
});
diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js
index 6c72501be9c..15fa61d8766 100644
--- a/test/spec/modules/appnexusBidAdapter_spec.js
+++ b/test/spec/modules/appnexusBidAdapter_spec.js
@@ -871,7 +871,7 @@ describe('AppNexusAdapter', function () {
const bidRequest = Object.assign({}, bidRequests[0]);
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
@@ -895,14 +895,11 @@ describe('AppNexusAdapter', function () {
it('if defined, should include publisher pageUrl to normal referer info in payload', function () {
const bidRequest = Object.assign({}, bidRequests[0]);
- sinon
- .stub(config, 'getConfig')
- .withArgs('pageUrl')
- .returns('https://mypub.override.com/test/page.html');
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ canonicalUrl: 'https://mypub.override.com/test/page.html',
+ topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
@@ -923,8 +920,6 @@ describe('AppNexusAdapter', function () {
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(','),
rd_can: 'https://mypub.override.com/test/page.html'
});
-
- config.getConfig.restore();
});
it('should populate schain if available', function () {
@@ -1023,10 +1018,6 @@ describe('AppNexusAdapter', function () {
criteoId: 'sample-criteo-userid',
netId: 'sample-netId-userid',
idl_env: 'sample-idl-userid',
- flocId: {
- id: 'sample-flocid-value',
- version: 'chrome.1.0'
- },
pubProvidedId: [{
source: 'puburl.com',
uids: [{
@@ -1058,11 +1049,6 @@ describe('AppNexusAdapter', function () {
id: 'sample-criteo-userid',
});
- expect(payload.eids).to.deep.include({
- source: 'chrome.com',
- id: 'sample-flocid-value'
- });
-
expect(payload.eids).to.deep.include({
source: 'netid.de',
id: 'sample-netId-userid',
diff --git a/test/spec/modules/apstreamBidAdapter_spec.js b/test/spec/modules/apstreamBidAdapter_spec.js
index e640c009989..3efb5fd38d5 100644
--- a/test/spec/modules/apstreamBidAdapter_spec.js
+++ b/test/spec/modules/apstreamBidAdapter_spec.js
@@ -33,6 +33,11 @@ describe('AP Stream adapter', function() {
let mockConfig;
beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ apstream: {
+ storageAllowed: true
+ }
+ };
mockConfig = {
apstream: {
publisherId: '4321'
@@ -44,6 +49,7 @@ describe('AP Stream adapter', function() {
});
afterEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
config.getConfig.restore();
});
@@ -194,29 +200,6 @@ describe('AP Stream adapter', function() {
describe('dsu', function() {
it('should pass DSU from local storage if set', function() {
- let dsu = 'some_dsu';
- localStorage.setItem('apr_dsu', dsu);
-
- const bidderRequest = {
- gdprConsent: {
- gdprApplies: true,
- consentString: 'consentDataString',
- vendorData: {
- vendorConsents: {
- '394': true
- }
- }
- }
- };
-
- const request = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
-
- assert.equal(request.dsu, dsu);
- });
-
- it('should generate new DSU if nothing in local storage', function() {
- localStorage.removeItem('apr_dsu');
-
const bidderRequest = {
gdprConsent: {
gdprApplies: true,
@@ -230,10 +213,7 @@ describe('AP Stream adapter', function() {
};
const request = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- let dsu = localStorage.getItem('apr_dsu');
-
- assert.isNotEmpty(dsu);
- assert.equal(request.dsu, dsu);
+ assert.isNotEmpty(request.dsu);
});
});
});
diff --git a/test/spec/modules/asoBidAdapter_spec.js b/test/spec/modules/asoBidAdapter_spec.js
index 0dc779a300d..5ac44cb1db4 100644
--- a/test/spec/modules/asoBidAdapter_spec.js
+++ b/test/spec/modules/asoBidAdapter_spec.js
@@ -62,7 +62,8 @@ describe('Adserver.Online bidding adapter', function () {
refererInfo: {
numIframes: 0,
reachedTop: true,
- referer: 'https://example.com'
+ page: 'https://example.com',
+ domain: 'example.com'
}
};
diff --git a/test/spec/modules/audiencerunBidAdapter_spec.js b/test/spec/modules/audiencerunBidAdapter_spec.js
index 7f1e059fa2a..57de8bdb0df 100644
--- a/test/spec/modules/audiencerunBidAdapter_spec.js
+++ b/test/spec/modules/audiencerunBidAdapter_spec.js
@@ -114,7 +114,8 @@ describe('AudienceRun bid adapter tests', function () {
},
refererInfo: {
canonicalUrl: undefined,
- referer: 'https://example.com',
+ page: 'https://example.com',
+ topmostLocation: 'https://example.com',
numIframes: 0,
reachedTop: true,
},
diff --git a/test/spec/modules/axonixBidAdapter_spec.js b/test/spec/modules/axonixBidAdapter_spec.js
index a952d527600..37f409e5769 100644
--- a/test/spec/modules/axonixBidAdapter_spec.js
+++ b/test/spec/modules/axonixBidAdapter_spec.js
@@ -65,7 +65,7 @@ describe('AxonixBidAdapter', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://www.prebid.org',
+ page: 'https://www.prebid.org',
canonicalUrl: 'https://www.prebid.org/the/link/to/the/page'
}
};
diff --git a/test/spec/modules/beachfrontBidAdapter_spec.js b/test/spec/modules/beachfrontBidAdapter_spec.js
index d9b8cac10b4..addd4304c7d 100644
--- a/test/spec/modules/beachfrontBidAdapter_spec.js
+++ b/test/spec/modules/beachfrontBidAdapter_spec.js
@@ -129,7 +129,7 @@ describe('BeachfrontAdapter', function () {
it('should attach the bid request object', function () {
bidRequests[0].mediaTypes = { video: {} };
bidRequests[1].mediaTypes = { video: {} };
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
expect(requests[0].bidRequest).to.equal(bidRequests[0]);
expect(requests[1].bidRequest).to.equal(bidRequests[1]);
});
@@ -137,7 +137,7 @@ describe('BeachfrontAdapter', function () {
it('should create a POST request for each bid', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { video: {} };
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
expect(requests[0].method).to.equal('POST');
expect(requests[0].url).to.equal(VIDEO_ENDPOINT + bidRequest.params.appId);
});
@@ -155,7 +155,7 @@ describe('BeachfrontAdapter', function () {
const topLocation = parseUrl('http://www.example.com?foo=bar', { decodeSearchAsString: true });
const bidderRequest = {
refererInfo: {
- referer: topLocation.href
+ page: topLocation.href
}
};
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
@@ -176,7 +176,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { video: {} };
bidRequest.getFloor = () => ({ currency: 'USD', floor: 1.16 });
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].bidfloor).to.equal(1.16);
});
@@ -185,7 +185,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { video: {} };
bidRequest.getFloor = () => ({});
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor);
});
@@ -199,7 +199,7 @@ describe('BeachfrontAdapter', function () {
playerSize: [[ width, height ]]
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].video).to.deep.contain({ w: width, h: height });
});
@@ -213,7 +213,7 @@ describe('BeachfrontAdapter', function () {
playerSize: `${width}x${height}`
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].video).to.deep.contain({ w: width, h: height });
});
@@ -225,7 +225,7 @@ describe('BeachfrontAdapter', function () {
playerSize: []
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].video).to.deep.contain({ w: undefined, h: undefined });
});
@@ -236,7 +236,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.sizes = [ width, height ];
bidRequest.mediaTypes = { video: {} };
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].video).to.deep.contain({ w: width, h: height });
});
@@ -251,7 +251,7 @@ describe('BeachfrontAdapter', function () {
bidRequest.mediaTypes = {
video: { mimes, playbackmethod, maxduration, placement, skip }
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].video).to.deep.contain({ mimes, playbackmethod, maxduration, placement, skip });
});
@@ -265,7 +265,7 @@ describe('BeachfrontAdapter', function () {
const skip = 1;
bidRequest.mediaTypes = { video: { placement: 3, skip: 0 } };
bidRequest.params.video = { mimes, playbackmethod, maxduration, placement, skip };
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.imp[0].video).to.deep.contain({ mimes, playbackmethod, maxduration, placement, skip });
});
@@ -312,7 +312,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { video: {} };
bidRequest.schain = schain;
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.source.ext.schain).to.deep.equal(schain);
});
@@ -322,12 +322,12 @@ describe('BeachfrontAdapter', function () {
tdid: '54017816',
idl_env: '13024996',
uid2: { id: '45843401' },
- haloId: { haloId: '60314917', auSeg: ['segment1', 'segment2'] }
+ hadronId: { hadronId: '60314917', auSeg: ['segment1', 'segment2'] }
};
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { video: {} };
bidRequest.userId = userId;
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.user.ext.eids).to.deep.equal([
{
@@ -360,7 +360,7 @@ describe('BeachfrontAdapter', function () {
{
source: 'audigent.com',
uids: [{
- id: userId.haloId,
+ id: userId.hadronId,
atype: 1,
}]
}
@@ -372,14 +372,14 @@ describe('BeachfrontAdapter', function () {
it('should attach the bid requests array', function () {
bidRequests[0].mediaTypes = { banner: {} };
bidRequests[1].mediaTypes = { banner: {} };
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
expect(requests[0].bidRequest).to.deep.equal(bidRequests);
});
it('should create a single POST request for all bids', function () {
bidRequests[0].mediaTypes = { banner: {} };
bidRequests[1].mediaTypes = { banner: {} };
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
expect(requests.length).to.equal(1);
expect(requests[0].method).to.equal('POST');
expect(requests[0].url).to.equal(BANNER_ENDPOINT);
@@ -398,7 +398,7 @@ describe('BeachfrontAdapter', function () {
const topLocation = parseUrl('http://www.example.com?foo=bar', { decodeSearchAsString: true });
const bidderRequest = {
refererInfo: {
- referer: topLocation.href
+ page: topLocation.href
}
};
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
@@ -422,7 +422,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { banner: {} };
bidRequest.getFloor = () => ({ currency: 'USD', floor: 1.16 });
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.slots[0].bidfloor).to.equal(1.16);
});
@@ -431,7 +431,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { banner: {} };
bidRequest.getFloor = () => ({});
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.slots[0].bidfloor).to.equal(bidRequest.params.bidfloor);
});
@@ -445,7 +445,7 @@ describe('BeachfrontAdapter', function () {
sizes: [[ width, height ]]
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.slots[0].sizes).to.deep.equal([
{ w: width, h: height }
@@ -461,7 +461,7 @@ describe('BeachfrontAdapter', function () {
sizes: `${width}x${height}`
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.slots[0].sizes).to.deep.equal([
{ w: width, h: height }
@@ -475,7 +475,7 @@ describe('BeachfrontAdapter', function () {
sizes: []
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.slots[0].sizes).to.deep.equal([]);
});
@@ -486,7 +486,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.sizes = [ width, height ];
bidRequest.mediaTypes = { banner: {} };
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.slots[0].sizes).to.deep.contain({ w: width, h: height });
});
@@ -533,7 +533,7 @@ describe('BeachfrontAdapter', function () {
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { banner: {} };
bidRequest.schain = schain;
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.schain).to.deep.equal(schain);
});
@@ -543,51 +543,38 @@ describe('BeachfrontAdapter', function () {
tdid: '54017816',
idl_env: '13024996',
uid2: { id: '45843401' },
- haloId: { haloId: '60314917', auSeg: ['segment1', 'segment2'] }
+ hadronId: { hadronId: '60314917', auSeg: ['segment1', 'segment2'] }
};
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { banner: {} };
bidRequest.userId = userId;
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
const data = requests[0].data;
expect(data.tdid).to.equal(userId.tdid);
expect(data.idl).to.equal(userId.idl_env);
expect(data.uid2).to.equal(userId.uid2.id);
- expect(data.haloid).to.equal(userId.haloId);
+ expect(data.hadronid).to.equal(userId.hadronId);
});
});
describe('with first-party data', function () {
- let sandbox
-
- beforeEach(function () {
- sandbox = sinon.sandbox.create();
- });
-
- afterEach(function () {
- sandbox.restore();
- });
-
it('must add first-party data to the video bid request', function () {
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const cfg = {
- ortb2: {
- site: {
- keywords: 'test keyword'
- },
- user: {
- data: 'some user data'
- }
- }
- };
- return deepAccess(cfg, key);
- });
+ const ortb2 = {
+ site: {
+ keywords: 'test keyword'
+ },
+ user: {
+ data: 'some user data'
+ }
+ };
+
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { video: {} };
const bidderRequest = {
refererInfo: {
- referer: 'http://example.com/page.html'
- }
+ page: 'http://example.com/page.html'
+ },
+ ortb2
};
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
@@ -598,22 +585,17 @@ describe('BeachfrontAdapter', function () {
});
it('must add first-party data to the banner bid request', function () {
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const cfg = {
- ortb2: {
- site: {
- keywords: 'test keyword'
- },
- user: {
- data: 'some user data'
- }
- }
- };
- return deepAccess(cfg, key);
- });
+ const ortb2 = {
+ site: {
+ keywords: 'test keyword'
+ },
+ user: {
+ data: 'some user data'
+ }
+ };
const bidRequest = bidRequests[0];
bidRequest.mediaTypes = { banner: {} };
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {ortb2});
const data = requests[0].data;
expect(data.ortb2.user.data).to.equal('some user data');
expect(data.ortb2.site.keywords).to.equal('test keyword');
@@ -643,7 +625,7 @@ describe('BeachfrontAdapter', function () {
appId: '3b16770b-17af-4d22-daff-9606bdf2c9c3'
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
expect(requests.length).to.equal(2);
expect(requests[0].url).to.contain(VIDEO_ENDPOINT);
expect(requests[1].url).to.contain(BANNER_ENDPOINT);
@@ -669,7 +651,7 @@ describe('BeachfrontAdapter', function () {
appId: '3b16770b-17af-4d22-daff-9606bdf2c9c3'
}
};
- const requests = spec.buildRequests([ bidRequest ]);
+ const requests = spec.buildRequests([ bidRequest ], {});
expect(requests[0].data.imp[0].video).to.deep.contain({ w: 640, h: 360 });
expect(requests[1].data.slots[0].sizes).to.deep.equal([{ w: 300, h: 250 }]);
});
diff --git a/test/spec/modules/bliinkBidAdapter_spec.js b/test/spec/modules/bliinkBidAdapter_spec.js
index 729605f7db8..748ed2c8279 100644
--- a/test/spec/modules/bliinkBidAdapter_spec.js
+++ b/test/spec/modules/bliinkBidAdapter_spec.js
@@ -120,11 +120,14 @@ const getConfigBuildRequest = (placement) => {
bidderCode: 'bliink',
bids: [getConfigBid(placement)],
refererInfo: {
- canonicalUrl: null,
- isAmp: false,
- numIframes: 0,
- reachedTop: true,
- referer: 'http://localhost:9999/integrationExamples/gpt/bliink-adapter.html?pbjs_debug=true',
+ page: 'http://localhost:9999/integrationExamples/gpt/bliink-adapter.html?pbjs_debug=true',
+ legacy: {
+ canonicalUrl: null,
+ isAmp: false,
+ numIframes: 0,
+ reachedTop: true,
+ referer: 'http://localhost:9999/integrationExamples/gpt/bliink-adapter.html?pbjs_debug=true',
+ }
},
}
@@ -474,7 +477,7 @@ const testsBuildRequests = [
bidderRequestId: getConfigBuildRequest('banner').bidderRequestId,
bidderCode: getConfigBuildRequest('banner').bidderCode,
bids: getConfigBuildRequest('banner').bids,
- refererInfo: getConfigBuildRequest('banner').refererInfo
+ refererInfo: getConfigBuildRequest('banner').refererInfo.legacy
},
data: {
gdpr: false,
@@ -505,7 +508,7 @@ const testsBuildRequests = [
bidderRequestId: getConfigBuildRequest('banner').bidderRequestId,
bidderCode: getConfigBuildRequest('banner').bidderCode,
bids: getConfigBuildRequest('banner').bids,
- refererInfo: getConfigBuildRequest('banner').refererInfo
+ refererInfo: getConfigBuildRequest('banner').refererInfo.legacy
},
data: {
gdpr: true,
diff --git a/test/spec/modules/bluebillywigBidAdapter_spec.js b/test/spec/modules/bluebillywigBidAdapter_spec.js
index c831ddf6ddf..0a9c6b30c94 100644
--- a/test/spec/modules/bluebillywigBidAdapter_spec.js
+++ b/test/spec/modules/bluebillywigBidAdapter_spec.js
@@ -439,7 +439,7 @@ describe('BlueBillywigAdapter', () => {
it('should add referrerInfo as site when no app is set', () => {
const newValidBidderRequest = deepClone(validBidderRequest);
- newValidBidderRequest.refererInfo = { referer: 'https://www.bluebillywig.com' };
+ newValidBidderRequest.refererInfo = { page: 'https://www.bluebillywig.com' };
const request = spec.buildRequests(baseValidBidRequests, newValidBidderRequest);
const payload = JSON.parse(request.data);
diff --git a/test/spec/modules/brandmetricsRtdProvider_spec.js b/test/spec/modules/brandmetricsRtdProvider_spec.js
index 3cac5a3d559..879ec7e1c7a 100644
--- a/test/spec/modules/brandmetricsRtdProvider_spec.js
+++ b/test/spec/modules/brandmetricsRtdProvider_spec.js
@@ -124,12 +124,12 @@ describe('getBidRequestData', () => {
})
it('should set targeting keys for specified bidders', () => {
- brandmetricsRTD.brandmetricsSubmodule.getBidRequestData({}, () => {
- const bidderConfig = config.getBidderConfig()
+ const bidderOrtb2 = {};
+ brandmetricsRTD.brandmetricsSubmodule.getBidRequestData({ortb2Fragments: {bidder: bidderOrtb2}}, () => {
const expected = VALID_CONFIG.params.bidders
expected.forEach(exp => {
- expect(bidderConfig[exp].ortb2.user.ext.data.mockTargetKey).to.equal('mockMeasurementId')
+ expect(bidderOrtb2[exp].user.ext.data.mockTargetKey).to.equal('mockMeasurementId')
})
}, VALID_CONFIG);
@@ -161,9 +161,9 @@ describe('getBidRequestData', () => {
}
});
- brandmetricsRTD.brandmetricsSubmodule.getBidRequestData({}, () => {}, VALID_CONFIG);
- const bidderConfig = config.getBidderConfig()
- expect(Object.keys(bidderConfig).length).to.equal(0)
+ const bidderOrtb2 = {};
+ brandmetricsRTD.brandmetricsSubmodule.getBidRequestData({ortb2Fragments: {bidder: bidderOrtb2}}, () => {}, VALID_CONFIG);
+ expect(Object.keys(bidderOrtb2).length).to.equal(0)
});
it('should use a default targeting key name if the brandmetrics- configuration does not include one', () => {
@@ -179,13 +179,13 @@ describe('getBidRequestData', () => {
}
});
- brandmetricsRTD.brandmetricsSubmodule.getBidRequestData({}, () => {}, VALID_CONFIG);
+ const bidderOrtb2 = {};
+ brandmetricsRTD.brandmetricsSubmodule.getBidRequestData({ortb2Fragments: {bidder: bidderOrtb2}}, () => {}, VALID_CONFIG);
- const bidderConfig = config.getBidderConfig()
const expected = VALID_CONFIG.params.bidders
expected.forEach(exp => {
- expect(bidderConfig[exp].ortb2.user.ext.data.brandmetrics_survey).to.equal('mockMeasurementId')
+ expect(bidderOrtb2[exp].user.ext.data.brandmetrics_survey).to.equal('mockMeasurementId')
})
});
});
diff --git a/test/spec/modules/bridgewellBidAdapter_spec.js b/test/spec/modules/bridgewellBidAdapter_spec.js
index 8da82c71820..77818f34a62 100644
--- a/test/spec/modules/bridgewellBidAdapter_spec.js
+++ b/test/spec/modules/bridgewellBidAdapter_spec.js
@@ -7,7 +7,6 @@ const userId = {
'pubcid': '074864cb-3705-430e-9ff7-48ccf3c21b94',
'sharedid': {'id': '01F61MX53D786DSB2WYD38ZVM7', 'third': '01F61MX53D786DSB2WYD38ZVM7'},
'uid2': {'id': 'eb33b0cb-8d35-1234-b9c0-1a31d4064777'},
- 'flocId': {'id': '12345', 'version': 'chrome.1.1'},
}
describe('bridgewellBidAdapter', function () {
@@ -142,7 +141,10 @@ describe('bridgewellBidAdapter', function () {
it('should attach valid params to the tag', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://www.bridgewell.com/'
+ page: 'https://www.bridgewell.com/',
+ legacy: {
+ referer: 'https://www.bridgewell.com/',
+ }
}
}
const request = spec.buildRequests(bidRequests, bidderRequest);
@@ -165,7 +167,10 @@ describe('bridgewellBidAdapter', function () {
it('should attach valid params to the tag, part2', function() {
const bidderRequest = {
refererInfo: {
- referer: 'https://www.bridgewell.com/'
+ page: 'https://www.bridgewell.com/',
+ legacy: {
+ referer: 'https://www.bridgewell.com/'
+ }
}
}
const bidRequests2 = [
@@ -207,7 +212,10 @@ describe('bridgewellBidAdapter', function () {
it('should attach validBidRequests to the tag', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://www.bridgewell.com/'
+ page: 'https://www.bridgewell.com/',
+ legacy: {
+ referer: 'https://www.bridgewell.com/',
+ }
}
}
diff --git a/test/spec/modules/brightcomBidAdapter_spec.js b/test/spec/modules/brightcomBidAdapter_spec.js
index b7d52c9f7d5..9354544ee5a 100644
--- a/test/spec/modules/brightcomBidAdapter_spec.js
+++ b/test/spec/modules/brightcomBidAdapter_spec.js
@@ -153,7 +153,8 @@ describe('brightcomBidAdapter', function() {
gdprApplies: true
},
refererInfo: {
- referer: 'http://example.com/page.html',
+ page: 'http://example.com/page.html',
+ domain: 'example.com',
}
};
bidderRequest.bids = bidRequests;
diff --git a/test/spec/modules/cleanmedianetBidAdapter_spec.js b/test/spec/modules/cleanmedianetBidAdapter_spec.js
index c2eea6f32d7..8c2ac34350b 100644
--- a/test/spec/modules/cleanmedianetBidAdapter_spec.js
+++ b/test/spec/modules/cleanmedianetBidAdapter_spec.js
@@ -85,7 +85,7 @@ describe('CleanmedianetAdapter', function () {
},
sizes: [[300, 250], [300, 600]],
transactionId: 'a123456789',
- refererInfo: { referer: 'https://examplereferer.com' },
+ refererInfo: { referer: 'https://examplereferer.com', domain: 'examplereferer.com' },
gdprConsent: {
consentString: 'some string',
gdprApplies: true
@@ -114,11 +114,16 @@ describe('CleanmedianetAdapter', function () {
it('builds request correctly', function() {
let bidRequest2 = utils.deepClone(bidRequest);
- bidRequest2.refererInfo.referer = 'https://www.test.com/page.html';
+ Object.assign(bidRequest2.refererInfo, {
+ page: 'https://www.test.com/page.html',
+ domain: 'test.com',
+ ref: 'https://referer.com'
+ })
+
let response = spec.buildRequests([bidRequest], bidRequest2)[0];
- expect(response.data.site.domain).to.equal('www.test.com');
+ expect(response.data.site.domain).to.equal('test.com');
expect(response.data.site.page).to.equal('https://www.test.com/page.html');
- expect(response.data.site.ref).to.equal('https://www.test.com/page.html');
+ expect(response.data.site.ref).to.equal('https://referer.com');
expect(response.data.imp.length).to.equal(1);
expect(response.data.imp[0].id).to.equal(bidRequest.transactionId);
expect(response.data.imp[0].instl).to.equal(0);
diff --git a/test/spec/modules/codefuelBidAdapter_spec.js b/test/spec/modules/codefuelBidAdapter_spec.js
index a2549012d84..354cbe63ffa 100644
--- a/test/spec/modules/codefuelBidAdapter_spec.js
+++ b/test/spec/modules/codefuelBidAdapter_spec.js
@@ -139,7 +139,8 @@ describe('Codefuel Adapter', function () {
timeout: 500,
auctionId: '12043683-3254-4f74-8934-f941b085579e',
refererInfo: {
- referer: 'https://example.com/',
+ page: 'https://example.com/',
+ domain: 'example.com'
}
}
diff --git a/test/spec/modules/concertBidAdapter_spec.js b/test/spec/modules/concertBidAdapter_spec.js
index 1b869d51bde..2f9eda0ca7c 100644
--- a/test/spec/modules/concertBidAdapter_spec.js
+++ b/test/spec/modules/concertBidAdapter_spec.js
@@ -8,7 +8,15 @@ describe('ConcertAdapter', function () {
let bidRequest;
let bidResponse;
+ afterEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ concert: {
+ storageAllowed: true
+ }
+ };
bidRequests = [
{
bidder: 'concert',
@@ -25,7 +33,7 @@ describe('ConcertAdapter', function () {
bidRequest = {
refererInfo: {
- referer: 'https://www.google.com'
+ page: 'https://www.google.com'
},
uspConsent: '1YYY',
gdprConsent: {}
diff --git a/test/spec/modules/connectadBidAdapter_spec.js b/test/spec/modules/connectadBidAdapter_spec.js
index 657bc432d06..7a70c4bacdb 100644
--- a/test/spec/modules/connectadBidAdapter_spec.js
+++ b/test/spec/modules/connectadBidAdapter_spec.js
@@ -255,14 +255,17 @@ describe('ConnectAd Adapter', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequ = {
refererInfo: {
- referer: 'https://connectad.io/page.html',
- reachedTop: true,
- numIframes: 2,
- stack: [
- 'https://connectad.io/page.html',
- 'https://connectad.io/iframe1.html',
- 'https://connectad.io/iframe2.html'
- ]
+ page: 'https://connectad.io/page.html',
+ legacy: {
+ referer: 'https://connectad.io/page.html',
+ reachedTop: true,
+ numIframes: 2,
+ stack: [
+ 'https://connectad.io/page.html',
+ 'https://connectad.io/iframe1.html',
+ 'https://connectad.io/iframe2.html'
+ ]
+ }
}
}
const request = spec.buildRequests([bidRequest], bidderRequ);
diff --git a/test/spec/modules/consentManagementUsp_spec.js b/test/spec/modules/consentManagementUsp_spec.js
index a2b1e22ed35..94a0ba92813 100644
--- a/test/spec/modules/consentManagementUsp_spec.js
+++ b/test/spec/modules/consentManagementUsp_spec.js
@@ -23,8 +23,27 @@ function createIFrameMarker() {
}
describe('consentManagement', function () {
+ it('should be enabled by default', () => {
+ expect(uspDataHandler.enabled).to.be.true;
+ });
+ it('should respect configuration set after activation', () => {
+ setConsentConfig({
+ usp: {
+ cmpApi: 'static',
+ consentData: {
+ getUSPData: {
+ uspString: '1YYY'
+ }
+ }
+ }
+ });
+ expect(uspDataHandler.getConsentData()).to.equal('1YYY');
+ })
+
describe('setConsentConfig tests:', function () {
describe('empty setConsentConfig value', function () {
+ before(resetConsentData);
+
beforeEach(function () {
sinon.stub(utils, 'logInfo');
sinon.stub(utils, 'logWarn');
@@ -37,11 +56,11 @@ describe('consentManagement', function () {
resetConsentData();
});
- it('should not run if no config', function () {
+ it('should run with defaults if no config', function () {
setConsentConfig({});
- expect(consentAPI).to.be.undefined;
- expect(consentTimeout).to.be.undefined;
- sinon.assert.callCount(utils.logWarn, 1);
+ expect(consentAPI).to.be.equal('iab');
+ expect(consentTimeout).to.be.equal(50);
+ sinon.assert.callCount(utils.logInfo, 3);
});
it('should use system default values', function () {
@@ -51,11 +70,11 @@ describe('consentManagement', function () {
sinon.assert.callCount(utils.logInfo, 3);
});
- it('should exit the consent manager if config.usp is not an object', function() {
+ it('should not exit the consent manager if config.usp is not an object', function() {
setConsentConfig({});
- expect(consentAPI).to.be.undefined;
- sinon.assert.calledOnce(utils.logWarn);
- sinon.assert.notCalled(utils.logInfo);
+ expect(consentAPI).to.be.equal('iab');
+ expect(consentTimeout).to.be.equal(50);
+ sinon.assert.callCount(utils.logInfo, 3);
});
it('should not produce any USP metadata', function() {
@@ -66,16 +85,16 @@ describe('consentManagement', function () {
it('should exit the consent manager if only config.gdpr is an object', function() {
setConsentConfig({ gdpr: { cmpApi: 'iab' } });
- expect(consentAPI).to.be.undefined;
- sinon.assert.calledOnce(utils.logWarn);
- sinon.assert.notCalled(utils.logInfo);
+ expect(consentAPI).to.be.equal('iab');
+ expect(consentTimeout).to.be.equal(50);
+ sinon.assert.callCount(utils.logInfo, 3);
});
it('should exit consentManagementUsp module if config is "undefined"', function() {
setConsentConfig(undefined);
- expect(consentAPI).to.be.undefined;
- sinon.assert.calledOnce(utils.logWarn);
- sinon.assert.notCalled(utils.logInfo);
+ expect(consentAPI).to.be.equal('iab');
+ expect(consentTimeout).to.be.equal(50);
+ sinon.assert.callCount(utils.logInfo, 3);
});
it('should immediately start looking up consent data', () => {
diff --git a/test/spec/modules/consentManagement_spec.js b/test/spec/modules/consentManagement_spec.js
index b0cd0197f8b..a286a4ed1b9 100644
--- a/test/spec/modules/consentManagement_spec.js
+++ b/test/spec/modules/consentManagement_spec.js
@@ -1,4 +1,4 @@
-import { setConsentConfig, requestBidsHook, resetConsentData, userCMP, consentTimeout, allowAuction, staticConsentData, gdprScope } from 'modules/consentManagement.js';
+import { setConsentConfig, requestBidsHook, resetConsentData, userCMP, consentTimeout, staticConsentData, gdprScope } from 'modules/consentManagement.js';
import { gdprDataHandler } from 'src/adapterManager.js';
import * as utils from 'src/utils.js';
import { config } from 'src/config.js';
@@ -69,17 +69,12 @@ describe('consentManagement', function () {
let allConfig = {
cmpApi: 'iab',
timeout: 7500,
- allowAuctionWithoutConsent: false,
defaultGdprScope: true
};
setConsentConfig(allConfig);
expect(userCMP).to.be.equal('iab');
expect(consentTimeout).to.be.equal(7500);
- expect(allowAuction).to.deep.equal({
- value: false,
- definedInConfig: true
- });
expect(gdprScope).to.be.true;
});
@@ -125,16 +120,11 @@ describe('consentManagement', function () {
setConsentConfig({
cmpApi: 'iab',
timeout: 3333,
- allowAuctionWithoutConsent: false,
gdpr: false
});
expect(userCMP).to.be.equal('iab');
expect(consentTimeout).to.be.equal(3333);
- expect(allowAuction).to.deep.equal({
- value: false,
- definedInConfig: true
- });
expect(gdprScope).to.be.equal(false);
});
@@ -148,63 +138,11 @@ describe('consentManagement', function () {
afterEach(() => {
config.resetConfig();
});
- it('results in user settings overriding system defaults for v1 spec', () => {
- let staticConfig = {
- cmpApi: 'static',
- timeout: 7500,
- allowAuctionWithoutConsent: false,
- consentData: {
- getConsentData: {
- 'gdprApplies': true,
- 'hasGlobalScope': false,
- 'consentData': 'BOOgjO9OOgjO9APABAENAi-AAAAWd7_______9____7_9uz_Gv_r_ff_3nW0739P1A_r_Oz_rm_-zzV44_lpQQRCEA'
- },
- getVendorConsents: {
- 'metadata': 'BOOgjO9OOgjO9APABAENAi-AAAAWd7_______9____7_9uz_Gv_r_ff_3nW0739P1A_r_Oz_rm_-zzV44_lpQQRCEA',
- 'gdprApplies': true,
- 'hasGlobalScope': false,
- 'isEU': true,
- 'cookieVersion': 1,
- 'created': '2018-05-29T07:45:48.522Z',
- 'lastUpdated': '2018-05-29T07:45:48.522Z',
- 'cmpId': 15,
- 'cmpVersion': 1,
- 'consentLanguage': 'EN',
- 'vendorListVersion': 34,
- 'maxVendorId': 359,
- 'purposeConsents': {
- '1': true,
- '2': true,
- '3': true,
- '4': true,
- '5': true
- },
- 'vendorConsents': {
- '1': true,
- '2': true,
- '3': true,
- '4': true,
- '5': false
- }
- }
- }
- };
-
- setConsentConfig(staticConfig);
- expect(userCMP).to.be.equal('static');
- expect(consentTimeout).to.be.equal(0); // should always return without a timeout when config is used
- expect(allowAuction).to.deep.equal({
- value: false,
- definedInConfig: true
- });
- expect(staticConsentData).to.be.equal(staticConfig.consentData);
- });
it('results in user settings overriding system defaults for v2 spec', () => {
let staticConfig = {
cmpApi: 'static',
timeout: 7500,
- allowAuctionWithoutConsent: false,
consentData: {
getTCData: {
'tcString': 'COuqj-POu90rDBcBkBENAZCgAPzAAAPAACiQFwwBAABAA1ADEAbQC4YAYAAgAxAG0A',
@@ -276,10 +214,6 @@ describe('consentManagement', function () {
setConsentConfig(staticConfig);
expect(userCMP).to.be.equal('static');
expect(consentTimeout).to.be.equal(0); // should always return without a timeout when config is used
- expect(allowAuction).to.deep.equal({
- value: false,
- definedInConfig: true
- });
expect(gdprScope).to.be.equal(false);
const consent = gdprDataHandler.getConsentData();
expect(consent.consentString).to.eql(staticConfig.consentData.getTCData.tcString);
@@ -290,16 +224,9 @@ describe('consentManagement', function () {
});
describe('requestBidsHook tests:', function () {
- let goodConfigWithCancelAuction = {
+ let goodConfig = {
cmpApi: 'iab',
timeout: 7500,
- allowAuctionWithoutConsent: false
- };
-
- let goodConfigWithAllowAuction = {
- cmpApi: 'iab',
- timeout: 7500,
- allowAuctionWithoutConsent: true
};
const staticConfig = {
@@ -312,10 +239,8 @@ describe('consentManagement', function () {
let didHookReturn;
- afterEach(function () {
- gdprDataHandler.consentData = null;
- resetConsentData();
- });
+ beforeEach(resetConsentData);
+ after(resetConsentData)
describe('error checks:', function () {
beforeEach(function () {
@@ -328,7 +253,6 @@ describe('consentManagement', function () {
utils.logWarn.restore();
utils.logError.restore();
config.resetConfig();
- resetConsentData();
});
it('should throw a warning and return to hooked function when an unknown CMP framework ID is used', function () {
@@ -356,7 +280,7 @@ describe('consentManagement', function () {
})
it('should throw proper errors when CMP is not found', function () {
- setConsentConfig(goodConfigWithCancelAuction);
+ setConsentConfig(goodConfig);
requestBidsHook(() => {
didHookReturn = true;
@@ -378,41 +302,59 @@ describe('consentManagement', function () {
return gdprDataHandler.promise.then(() => {
expect(ran).to.be.true;
});
+ });
+
+ it('should continue the auction immediately, without consent data, if timeout is 0', (done) => {
+ setConsentConfig({
+ cmpApi: 'iab',
+ timeout: 0,
+ defaultGdprScope: true
+ });
+ window.__tcfapi = function () {};
+ try {
+ requestBidsHook(() => {
+ const consent = gdprDataHandler.getConsentData();
+ expect(consent.gdprApplies).to.be.true;
+ expect(consent.consentString).to.be.undefined;
+ done();
+ }, {})
+ } finally {
+ delete window.__tcfapi;
+ }
})
});
describe('already known consentData:', function () {
let cmpStub = sinon.stub();
+ function mockCMP(cmpResponse) {
+ return function(...args) {
+ args[2](Object.assign({eventStatus: 'tcloaded'}, cmpResponse), true);
+ }
+ }
+
beforeEach(function () {
didHookReturn = false;
- window.__cmp = function () { };
+ window.__tcfapi = function () { };
});
afterEach(function () {
config.resetConfig();
cmpStub.restore();
- delete window.__cmp;
+ delete window.__tcfapi;
resetConsentData();
});
it('should bypass CMP and simply use previously stored consentData', function () {
let testConsentData = {
gdprApplies: true,
- consentData: 'xyz'
+ tcString: 'xyz',
};
- cmpStub = sinon.stub(window, '__cmp').callsFake((...args) => {
- args[2](testConsentData);
- });
- setConsentConfig(goodConfigWithAllowAuction);
+ cmpStub = sinon.stub(window, '__tcfapi').callsFake(mockCMP(testConsentData));
+ setConsentConfig(goodConfig);
requestBidsHook(() => { }, {});
- cmpStub.restore();
-
- // reset the stub to ensure it wasn't called during the second round of calls
- cmpStub = sinon.stub(window, '__cmp').callsFake((...args) => {
- args[2](testConsentData);
- });
+ cmpStub.reset();
requestBidsHook(() => {
didHookReturn = true;
@@ -420,7 +362,7 @@ describe('consentManagement', function () {
let consent = gdprDataHandler.getConsentData();
expect(didHookReturn).to.be.true;
- expect(consent.consentString).to.equal(testConsentData.consentData);
+ expect(consent.consentString).to.equal(testConsentData.tcString);
expect(consent.gdprApplies).to.be.true;
sinon.assert.notCalled(cmpStub);
});
@@ -428,12 +370,10 @@ describe('consentManagement', function () {
it('should not set consent.gdprApplies to true if defaultGdprScope is true', function () {
let testConsentData = {
gdprApplies: false,
- consentData: 'xyz'
+ tcString: 'xyz',
};
- cmpStub = sinon.stub(window, '__cmp').callsFake((...args) => {
- args[2](testConsentData);
- });
+ cmpStub = sinon.stub(window, '__tcfapi').callsFake(mockCMP(testConsentData));
setConsentConfig({
cmpApi: 'iab',
@@ -486,7 +426,7 @@ describe('consentManagement', function () {
function testIFramedPage(testName, messageFormatString, tarConsentString, ver) {
it(`should return the consent string from a postmessage + addEventListener response - ${testName}`, (done) => {
stringifyResponse = messageFormatString;
- setConsentConfig(goodConfigWithAllowAuction);
+ setConsentConfig(goodConfig);
requestBidsHook(() => {
let consent = gdprDataHandler.getConsentData();
sinon.assert.notCalled(utils.logError);
@@ -510,93 +450,6 @@ describe('consentManagement', function () {
resetConsentData();
});
- describe('v1 CMP workflow for safeframe page', function () {
- let registerStub = sinon.stub();
- let ifrSf = null;
- beforeEach(function () {
- didHookReturn = false;
- window.$sf = {
- ext: {
- register: function () { },
- cmp: function () { }
- }
- };
- ifrSf = createIFrameMarker('__cmpLocator');
- });
-
- afterEach(function () {
- delete window.$sf;
- registerStub.restore();
- document.body.removeChild(ifrSf);
- });
-
- it('should return the consent data from a safeframe callback', function () {
- let testConsentData = {
- data: {
- msgName: 'cmpReturn',
- vendorConsents: {
- metadata: 'abc123def',
- gdprApplies: true
- },
- vendorConsentData: {
- consentData: 'abc123def',
- gdprApplies: true
- }
- }
- };
- registerStub = sinon.stub(window.$sf.ext, 'register').callsFake((...args) => {
- args[2](testConsentData.data.msgName, testConsentData.data);
- });
-
- setConsentConfig(goodConfigWithAllowAuction);
- requestBidsHook(() => {
- didHookReturn = true;
- }, { adUnits: [{ sizes: [[300, 250]] }] });
- let consent = gdprDataHandler.getConsentData();
-
- sinon.assert.notCalled(utils.logWarn);
- sinon.assert.notCalled(utils.logError);
- expect(didHookReturn).to.be.true;
- expect(consent.consentString).to.equal('abc123def');
- expect(consent.gdprApplies).to.be.true;
- expect(consent.apiVersion).to.equal(1);
- });
- });
-
- describe('v1 CMP workflow for iframe pages', function () {
- stringifyResponse = false;
- let ifr1 = null;
-
- beforeEach(function () {
- ifr1 = createIFrameMarker('__cmpLocator');
- cmpPostMessageCb = creatCmpMessageHandler('__cmp', {
- consentData: 'encoded_consent_data_via_post_message',
- gdprApplies: true,
- });
- window.addEventListener('message', cmpPostMessageCb, false);
- });
-
- afterEach(function () {
- delete window.__cmp; // deletes the local copy made by the postMessage CMP call function
- document.body.removeChild(ifr1);
- window.removeEventListener('message', cmpPostMessageCb);
- });
-
- // Run tests with JSON response and String response
- // from CMP window postMessage listener.
- testIFramedPage('with/JSON response', false, 'encoded_consent_data_via_post_message', 1);
- testIFramedPage('with/String response', true, 'encoded_consent_data_via_post_message', 1);
-
- it('should contain correct V1 CMP definition', (done) => {
- setConsentConfig(goodConfigWithAllowAuction);
- requestBidsHook(() => {
- const nbArguments = window.__cmp.toString().split('\n')[0].split(', ').length;
- expect(nbArguments).to.equal(3);
- done();
- }, {});
- });
- });
-
describe('v2 CMP workflow for iframe pages:', function () {
stringifyResponse = false;
let ifr2 = null;
@@ -622,7 +475,7 @@ describe('consentManagement', function () {
testIFramedPage('with/String response', true, 'abc12345234', 2);
it('should contain correct v2 CMP definition', (done) => {
- setConsentConfig(goodConfigWithAllowAuction);
+ setConsentConfig(goodConfig);
requestBidsHook(() => {
const nbArguments = window.__tcfapi.toString().split('\n')[0].split(', ').length;
expect(nbArguments).to.equal(4);
@@ -649,40 +502,6 @@ describe('consentManagement', function () {
resetConsentData();
});
- describe('v1 CMP workflow for normal pages:', function () {
- beforeEach(function () {
- window.__cmp = function () { };
- });
-
- afterEach(function () {
- delete window.__cmp;
- });
-
- it('performs lookup check and stores consentData for a valid existing user', function () {
- let testConsentData = {
- gdprApplies: true,
- consentData: 'BOJy+UqOJy+UqABAB+AAAAAZ+A=='
- };
- cmpStub = sinon.stub(window, '__cmp').callsFake((...args) => {
- args[2](testConsentData);
- });
-
- setConsentConfig(goodConfigWithAllowAuction);
-
- requestBidsHook(() => {
- didHookReturn = true;
- }, {});
- let consent = gdprDataHandler.getConsentData();
-
- sinon.assert.notCalled(utils.logWarn);
- sinon.assert.notCalled(utils.logError);
- expect(didHookReturn).to.be.true;
- expect(consent.consentString).to.equal(testConsentData.consentData);
- expect(consent.gdprApplies).to.be.true;
- expect(consent.apiVersion).to.equal(1);
- });
- });
-
describe('v2 CMP workflow for normal pages:', function () {
beforeEach(function() {
window.__tcfapi = function () { };
@@ -703,7 +522,7 @@ describe('consentManagement', function () {
args[2](testConsentData, true);
});
- setConsentConfig(goodConfigWithAllowAuction);
+ setConsentConfig(goodConfig);
requestBidsHook(() => {
didHookReturn = true;
@@ -730,7 +549,7 @@ describe('consentManagement', function () {
args[2](testConsentData, true);
});
- setConsentConfig(goodConfigWithAllowAuction);
+ setConsentConfig(goodConfig);
requestBidsHook(() => {
didHookReturn = true;
@@ -755,7 +574,7 @@ describe('consentManagement', function () {
args[2](testConsentData, true);
});
- setConsentConfig(goodConfigWithAllowAuction);
+ setConsentConfig(goodConfig);
requestBidsHook(() => {
didHookReturn = true;
@@ -769,7 +588,7 @@ describe('consentManagement', function () {
expect(consent.apiVersion).to.equal(2);
});
- it('throws an error when processCmpData check fails + does not call requestBids callbcack even when allowAuction is true', function () {
+ it('throws an error when processCmpData check fails + does not call requestBids callback', function () {
let testConsentData = {};
let bidsBackHandlerReturn = false;
@@ -777,9 +596,9 @@ describe('consentManagement', function () {
args[2](testConsentData);
});
- setConsentConfig(goodConfigWithAllowAuction);
+ setConsentConfig(goodConfig);
- sinon.assert.calledOnce(utils.logWarn);
+ sinon.assert.notCalled(utils.logWarn);
sinon.assert.notCalled(utils.logError);
[utils.logWarn, utils.logError].forEach((stub) => stub.reset());
diff --git a/test/spec/modules/conversantBidAdapter_spec.js b/test/spec/modules/conversantBidAdapter_spec.js
index ebc9879bb84..c63dc8f9c3b 100644
--- a/test/spec/modules/conversantBidAdapter_spec.js
+++ b/test/spec/modules/conversantBidAdapter_spec.js
@@ -254,7 +254,7 @@ describe('Conversant adapter tests', function() {
const page = 'http://test.com?a=b&c=123';
const bidderRequest = {
refererInfo: {
- referer: page
+ page: page
}
};
const request = spec.buildRequests(bidRequests, bidderRequest);
@@ -392,9 +392,10 @@ describe('Conversant adapter tests', function() {
});
it('Verify first party data', () => {
- const bidderRequest = {refererInfo: {referer: 'http://test.com?a=b&c=123'}};
- const cfg = {ortb2: {site: {content: {series: 'MySeries', season: 'MySeason', episode: 3, title: 'MyTitle'}}}};
- config.setConfig(cfg);
+ const bidderRequest = {
+ refererInfo: {page: 'http://test.com?a=b&c=123'},
+ ortb2: {site: {content: {series: 'MySeries', season: 'MySeason', episode: 3, title: 'MyTitle'}}}
+ };
const request = spec.buildRequests(bidRequests, bidderRequest);
const payload = request.data;
expect(payload.site).to.have.property('content');
@@ -402,11 +403,10 @@ describe('Conversant adapter tests', function() {
expect(payload.site.content).to.have.property('season');
expect(payload.site.content).to.have.property('episode');
expect(payload.site.content).to.have.property('title');
- config.resetConfig();
});
it('Verify supply chain data', () => {
- const bidderRequest = {refererInfo: {referer: 'http://test.com?a=b&c=123'}};
+ const bidderRequest = {refererInfo: {page: 'http://test.com?a=b&c=123'}};
const schain = {complete: 1, ver: '1.0', nodes: [{asi: 'bidderA.com', sid: '00001', hp: 1}]};
const bidsWithSchain = bidRequests.map((bid) => {
return Object.assign({
@@ -421,12 +421,12 @@ describe('Conversant adapter tests', function() {
it('Verify override url', function() {
const testUrl = 'https://someurl?name=value';
- const request = spec.buildRequests([{params: {white_label_url: testUrl}}]);
+ const request = spec.buildRequests([{params: {white_label_url: testUrl}}], {});
expect(request.url).to.equal(testUrl);
});
it('Verify interpretResponse', function() {
- const request = spec.buildRequests(bidRequests);
+ const request = spec.buildRequests(bidRequests, {});
const response = spec.interpretResponse(bidResponses, request);
expect(response).to.be.an('array').with.lengthOf(4);
@@ -489,7 +489,7 @@ describe('Conversant adapter tests', function() {
Object.assign(unit, {crumbs: {pubcid: 12345}});
});
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', 12345);
expect(payload).to.not.have.nested.property('user.ext.eids');
});
@@ -504,7 +504,7 @@ describe('Conversant adapter tests', function() {
Object.assign(unit, {userIdAsEids: createEidsArray(unit.userId)});
});
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', 67890);
expect(payload).to.not.have.nested.property('user.ext.eids');
});
@@ -579,7 +579,7 @@ describe('Conversant adapter tests', function() {
Object.assign(unit, {userIdAsEids: createEidsArray(unit.userId)});
});
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.eids', [
{source: 'adserver.org', uids: [{id: '223344', atype: 1, ext: {rtiPartner: 'TDID'}}]},
{source: 'liveramp.com', uids: [{id: '334455', atype: 3}]}
@@ -603,7 +603,15 @@ describe('Conversant adapter tests', function() {
return (new Date(Date.now() + timeout * 60 * 60 * 24 * 1000)).toUTCString();
}
+ beforeEach(() => {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ conversant: {
+ storageAllowed: true
+ }
+ };
+ });
afterEach(() => {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
cleanUp(ID_NAME);
cleanUp(CUSTOM_ID_NAME);
});
@@ -616,7 +624,7 @@ describe('Conversant adapter tests', function() {
storage.setCookie(ID_NAME, '12345', expStr(TIMEOUT));
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', '12345');
});
@@ -629,7 +637,7 @@ describe('Conversant adapter tests', function() {
storage.setCookie(CUSTOM_ID_NAME, '12345', expStr(TIMEOUT));
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', '12345');
});
@@ -642,7 +650,7 @@ describe('Conversant adapter tests', function() {
storage.setDataInLocalStorage(ID_NAME, 'abcde');
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', 'abcde');
});
@@ -655,7 +663,7 @@ describe('Conversant adapter tests', function() {
storage.setDataInLocalStorage(ID_NAME, 'fghijk');
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', 'fghijk');
});
@@ -668,7 +676,7 @@ describe('Conversant adapter tests', function() {
storage.setDataInLocalStorage(ID_NAME, 'lmnopq');
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.not.have.deep.nested.property('user.ext.fpc');
});
@@ -682,7 +690,7 @@ describe('Conversant adapter tests', function() {
storage.setDataInLocalStorage(CUSTOM_ID_NAME, 'fghijk');
// construct http post payload
- const payload = spec.buildRequests(requests).data;
+ const payload = spec.buildRequests(requests, {}).data;
expect(payload).to.have.deep.nested.property('user.ext.fpc', 'fghijk');
});
});
@@ -702,7 +710,7 @@ describe('Conversant adapter tests', function() {
};
};
- const payload = spec.buildRequests(bidRequest).data;
+ const payload = spec.buildRequests(bidRequest, {}).data;
expect(payload.imp[0]).to.have.property('bidfloor', 3.21);
});
@@ -715,7 +723,7 @@ describe('Conversant adapter tests', function() {
};
bidRequest[0].params.bidfloor = 0.6;
- const payload = spec.buildRequests(bidRequest).data;
+ const payload = spec.buildRequests(bidRequest, {}).data;
expect(payload.imp[0]).to.have.property('bidfloor', 0.6);
});
@@ -727,7 +735,7 @@ describe('Conversant adapter tests', function() {
};
};
- const payload = spec.buildRequests(bidRequest).data;
+ const payload = spec.buildRequests(bidRequest, {}).data;
expect(payload.imp[0]).to.have.property('bidfloor', 0);
});
@@ -739,7 +747,7 @@ describe('Conversant adapter tests', function() {
};
};
- const payload = spec.buildRequests(bidRequest).data;
+ const payload = spec.buildRequests(bidRequest, {}).data;
expect(payload.imp[0]).to.have.property('bidfloor', 0);
});
@@ -748,14 +756,14 @@ describe('Conversant adapter tests', function() {
return {};
};
- const payload = spec.buildRequests(bidRequest).data;
+ const payload = spec.buildRequests(bidRequest, {}).data;
expect(payload.imp[0]).to.have.property('bidfloor', 0);
});
it('undefined floor result', function() {
bidRequest[0].getFloor = () => {};
- const payload = spec.buildRequests(bidRequest).data;
+ const payload = spec.buildRequests(bidRequest, {}).data;
expect(payload.imp[0]).to.have.property('bidfloor', 0);
});
});
diff --git a/test/spec/modules/cpmstarBidAdapter_spec.js b/test/spec/modules/cpmstarBidAdapter_spec.js
index 285fca9690a..dd076d060b9 100755
--- a/test/spec/modules/cpmstarBidAdapter_spec.js
+++ b/test/spec/modules/cpmstarBidAdapter_spec.js
@@ -14,7 +14,7 @@ const valid_bid_requests = [{
const bidderRequest = {
refererInfo: {
- referer: 'referer',
+ page: 'referer',
reachedTop: false,
}
};
diff --git a/test/spec/modules/craftBidAdapter_spec.js b/test/spec/modules/craftBidAdapter_spec.js
index 3f4bc977016..dfdbebde738 100644
--- a/test/spec/modules/craftBidAdapter_spec.js
+++ b/test/spec/modules/craftBidAdapter_spec.js
@@ -14,11 +14,17 @@ describe('craftAdapter', function () {
describe('isBidRequestValid', function () {
before(function() {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ craft: {
+ storageAllowed: true
+ }
+ };
this.windowContext = window.context;
window.context = null;
});
after(function() {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
window.context = this.windowContext;
});
let bid = {
@@ -60,6 +66,16 @@ describe('craftAdapter', function () {
});
describe('buildRequests', function () {
+ before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ craft: {
+ storageAllowed: true
+ }
+ };
+ });
+ after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
let bidRequests = [{
bidder: 'craft',
params: {
@@ -75,7 +91,7 @@ describe('craftAdapter', function () {
}];
let bidderRequest = {
refererInfo: {
- referer: 'https://www.gacraft.jp/publish/craft-prebid-example.html'
+ topmostLocation: 'https://www.gacraft.jp/publish/craft-prebid-example.html'
}
};
it('sends bid request to ENDPOINT via POST', function () {
diff --git a/test/spec/modules/criteoBidAdapter_spec.js b/test/spec/modules/criteoBidAdapter_spec.js
index d15691e20b1..a271aea9396 100755
--- a/test/spec/modules/criteoBidAdapter_spec.js
+++ b/test/spec/modules/criteoBidAdapter_spec.js
@@ -16,6 +16,11 @@ describe('The Criteo bidding adapter', function () {
let utilsMock, sandbox;
beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ criteo: {
+ storageAllowed: true
+ }
+ };
// Remove FastBid to avoid side effects
localStorage.removeItem('criteo_fast_bid');
utilsMock = sinon.mock(utils);
@@ -23,7 +28,8 @@ describe('The Criteo bidding adapter', function () {
sandbox = sinon.sandbox.create();
});
- afterEach(function () {
+ afterEach(function() {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
global.Criteo = undefined;
utilsMock.restore();
sandbox.restore();
@@ -404,7 +410,8 @@ describe('The Criteo bidding adapter', function () {
const refererUrl = 'https://criteo.com?pbt_debug=1&pbt_nolog=1';
const bidderRequest = {
refererInfo: {
- referer: refererUrl
+ page: refererUrl,
+ topmostLocation: refererUrl
},
timeout: 3000,
gdprConsent: {
@@ -553,7 +560,8 @@ describe('The Criteo bidding adapter', function () {
it('should properly build a networkId request', function () {
const bidderRequest = {
refererInfo: {
- referer: refererUrl
+ page: refererUrl,
+ topmostLocation: refererUrl,
},
timeout: 3000,
gdprConsent: {
@@ -600,7 +608,8 @@ describe('The Criteo bidding adapter', function () {
it('should properly build a mixed request', function () {
const bidderRequest = {
refererInfo: {
- referer: refererUrl
+ page: refererUrl,
+ topmostLocation: refererUrl,
},
timeout: 3000
};
@@ -925,19 +934,14 @@ describe('The Criteo bidding adapter', function () {
},
];
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- };
- return utils.deepAccess(config, key);
- });
-
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: {}});
expect(request.data.publisher.ext).to.equal(undefined);
expect(request.data.user.ext).to.equal(undefined);
expect(request.data.slots[0].ext).to.equal(undefined);
});
it('should properly build a request with criteo specific ad unit first party data', function () {
+ // TODO: this test does not do what it says
const bidRequests = [
{
bidder: 'criteo',
@@ -957,13 +961,7 @@ describe('The Criteo bidding adapter', function () {
},
];
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- };
- return utils.deepAccess(config, key);
- });
-
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: {}});
expect(request.data.slots[0].ext).to.deep.equal({
bidfloor: 0.75,
});
@@ -1012,17 +1010,12 @@ describe('The Criteo bidding adapter', function () {
},
];
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2: {
- site: siteData,
- user: userData
- }
- };
- return utils.deepAccess(config, key);
- });
+ const ortb2 = {
+ site: siteData,
+ user: userData
+ };
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2});
expect(request.data.publisher.ext).to.deep.equal({ data: { pageType: 'article' } });
expect(request.data.user.ext).to.deep.equal({ data: { registered: true } });
expect(request.data.slots[0].ext).to.deep.equal({
diff --git a/test/spec/modules/deltaprojectsBidAdapter_spec.js b/test/spec/modules/deltaprojectsBidAdapter_spec.js
index 382415eab62..b966d1580ca 100644
--- a/test/spec/modules/deltaprojectsBidAdapter_spec.js
+++ b/test/spec/modules/deltaprojectsBidAdapter_spec.js
@@ -7,6 +7,7 @@ import {
} from 'modules/deltaprojectsBidAdapter.js';
const BID_REQ_REFER = 'http://example.com/page?param=val';
+const BID_REQ_DOMAIN = 'example.com'
describe('deltaprojectsBidAdapter', function() {
describe('isBidRequestValid', function () {
@@ -62,7 +63,7 @@ describe('deltaprojectsBidAdapter', function() {
auctionId: '1d1a030790a475',
}
const bidRequests = [BIDREQ];
- const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0];
+ const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { page: BID_REQ_REFER, domain: BID_REQ_DOMAIN }})[0];
const bannerRequestBody = bannerRequest.data;
it('send bid request with test tag if it is set in the param', function () {
diff --git a/test/spec/modules/districtmDmxBidAdapter_spec.js b/test/spec/modules/districtmDmxBidAdapter_spec.js
deleted file mode 100644
index 4c060b1f5a4..00000000000
--- a/test/spec/modules/districtmDmxBidAdapter_spec.js
+++ /dev/null
@@ -1,815 +0,0 @@
-import { expect } from 'chai';
-import * as _ from 'lodash';
-import { spec, matchRequest, checkDeepArray, defaultSize, upto5, cleanSizes, shuffle, getApi, bindUserId, getPlaybackmethod, getProtocols, cleanVast } from '../../../modules/districtmDMXBidAdapter.js';
-
-const sample_vast = `
-
-
-
-
-
-
-
-
- 00:00:15
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`
-
-const supportedSize = [
- {
- size: [300, 250],
- s: 100
- },
- {
- size: [728, 90],
- s: 95
- },
- {
- size: [300, 600],
- s: 90
- },
- {
- size: [160, 600],
- s: 88
- },
- {
- size: [320, 50],
- s: 85
- },
- {
- size: [300, 50],
- s: 80
- },
- {
- size: [970, 250],
- s: 75
- },
- {
- size: [970, 90],
- s: 60
- },
-];
-const bidRequest = [{
- 'bidder': 'districtmDMX',
- 'params': {
- 'dmxid': 100001,
- 'memberid': 100003,
- },
- 'userId': {
- idl_env: {},
- digitrustid: {
- data: {
- id: {}
- }
- },
- id5id: {
- uid: ''
- },
- pubcid: {},
- tdid: {},
- criteoId: {},
- britepoolid: {},
- intentiqid: {},
- lotamePanoramaId: {},
- parrableId: {},
- netId: {},
- lipb: {
- lipbid: {}
- },
-
- },
- 'adUnitCode': 'div-gpt-ad-12345678-1',
- 'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
- 'sizes': [
- [300, 250],
- [300, 600]
- ],
- 'bidId': '29a28a1bbc8a8d',
- 'bidderRequestId': '124b579a136515',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
-}];
-
-const bidRequestVideo = [{
- 'bidder': 'districtmDMX',
- 'params': {
- 'dmxid': 100001,
- 'memberid': 100003,
- 'video': {
- id: 123,
- skipppable: true,
- playback_method: ['auto_play_sound_off', 'viewport_sound_off'],
- mimes: ['application/javascript',
- 'video/mp4'],
- }
- },
- 'mediaTypes': {
- video: {
- context: 'instream', // or 'outstream'
- playerSize: [[640, 480]]
- }
- },
- 'adUnitCode': 'div-gpt-ad-12345678-1',
- 'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
- 'sizes': [
- [300, 250],
- [300, 600]
- ],
- 'bidId': '29a28a1bbc8a8d',
- 'bidderRequestId': '124b579a136515',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
-}];
-const bidRequestNoCoppa = [{
- 'bidder': 'districtmDMX',
- 'params': {
- 'dmxid': 100001,
- 'memberid': 100003
- },
- 'adUnitCode': 'div-gpt-ad-12345678-1',
- 'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
- 'sizes': [
- [300, 250],
- [300, 600]
- ],
- 'bidId': '29a28a1bbc8a8d',
- 'bidderRequestId': '124b579a136515',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
-}];
-const bidderRequest = {
- 'bidderCode': 'districtmDMX',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf',
- 'bidderRequestId': '124b579a136515',
- 'bids': [{
- 'bidder': 'districtmDMX',
- 'params': {
- 'dmxid': 100001,
- 'memberid': 100003,
- },
- 'adUnitCode': 'div-gpt-ad-12345678-1',
- 'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
- 'sizes': [
- [300, 250],
- [300, 600]
- ],
- 'bidId': '29a28a1bbc8a8d',
- 'bidderRequestId': '124b579a136515',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
- }],
- 'auctionStart': 1529511035677,
- 'timeout': 700,
- 'uspConsent': '1NY',
- 'gdprConsent': {
- 'consentString': 'BOPqNzUOPqNzUAHABBAAA5AAAAAAAA',
- 'vendorData': {
- 'metadata': 'BOPqNzUOPqNzUAHABBAAA5AAAAAAAA',
- 'hasGlobalScope': false,
- 'gdprApplies': true,
- 'purposeConsents': {
- '1': false,
- '2': false,
- '3': false,
- '4': false,
- '5': false
- },
- 'vendorConsents': {
- '1': false,
- '2': false,
- '3': false,
- '4': false,
- '6': false,
- '7': false,
- '8': false,
- '9': false,
- '10': false,
- '11': false,
- '12': false,
- '13': false,
- '14': false,
- '15': false,
- '16': false,
- '17': false,
- '18': false,
- '19': false,
- '20': false,
- '21': false,
- '22': false,
- '23': false,
- '24': false,
- '25': false,
- '26': false,
- '27': false,
- '28': false,
- '29': false,
- '30': false,
- '31': false,
- '32': false,
- '33': false,
- '34': false,
- '35': false,
- '36': false,
- '37': false,
- '38': false,
- '39': false,
- '40': false,
- '41': false,
- '42': false,
- '43': false,
- '44': false,
- '45': false,
- '46': false,
- '47': false,
- '48': false,
- '49': false,
- '50': false,
- '51': false,
- '52': false,
- '53': false,
- '55': false,
- '56': false,
- '57': false,
- '58': false,
- '59': false,
- '60': false,
- '61': false,
- '62': false,
- '63': false,
- '64': false,
- '65': false,
- '66': false,
- '67': false,
- '68': false,
- '69': false,
- '70': false,
- '71': false,
- '72': false,
- '73': false,
- '74': false,
- '75': false,
- '76': false,
- '77': false,
- '78': false,
- '79': false,
- '80': false,
- '81': false,
- '82': false,
- '83': false,
- '84': false,
- '85': false,
- '86': false,
- '87': false,
- '88': false,
- '89': false,
- '90': false,
- '91': false,
- '92': false,
- '93': false,
- '94': false,
- '95': false,
- '97': false,
- '98': false,
- '100': false,
- '101': false,
- '102': false,
- '104': false,
- '105': false,
- '108': false,
- '109': false,
- '110': false,
- '111': false,
- '112': false,
- '113': false,
- '114': false,
- '115': false,
- '119': false,
- '120': false,
- '122': false,
- '124': false,
- '125': false,
- '126': false,
- '127': false,
- '128': false,
- '129': false,
- '130': false,
- '131': false,
- '132': false,
- '133': false,
- '134': false,
- '136': false,
- '138': false,
- '139': false,
- '140': false,
- '141': false,
- '142': false,
- '143': false,
- '144': false,
- '145': false,
- '147': false,
- '148': false,
- '149': false,
- '150': false,
- '151': false,
- '152': false,
- '153': false,
- '154': false,
- '155': false,
- '156': false,
- '157': false,
- '158': false,
- '159': false,
- '160': false,
- '161': false,
- '162': false,
- '163': false,
- '164': false,
- '165': false,
- '167': false,
- '168': false,
- '169': false,
- '170': false,
- '171': false,
- '173': false,
- '174': false,
- '175': false,
- '177': false,
- '178': false,
- '179': false,
- '180': false,
- '182': false,
- '183': false,
- '184': false,
- '185': false,
- '188': false,
- '189': false,
- '190': false,
- '191': false,
- '192': false,
- '193': false,
- '194': false,
- '195': false,
- '197': false,
- '198': false,
- '199': false,
- '200': false,
- '201': false,
- '202': false,
- '203': false,
- '205': false,
- '206': false,
- '208': false,
- '209': false,
- '210': false,
- '211': false,
- '212': false,
- '213': false,
- '214': false,
- '215': false,
- '216': false,
- '217': false,
- '218': false,
- '223': false,
- '224': false,
- '225': false,
- '226': false,
- '227': false,
- '228': false,
- '229': false,
- '230': false,
- '231': false,
- '232': false,
- '234': false,
- '235': false,
- '236': false,
- '237': false,
- '238': false,
- '239': false,
- '240': false,
- '241': false,
- '242': false,
- '244': false,
- '245': false,
- '246': false,
- '248': false,
- '249': false,
- '250': false,
- '251': false,
- '252': false,
- '253': false,
- '254': false,
- '255': false,
- '256': false,
- '257': false,
- '258': false,
- '259': false,
- '260': false,
- '261': false,
- '262': false,
- '263': false,
- '264': false,
- '265': false,
- '266': false,
- '269': false,
- '270': false,
- '272': false,
- '273': false,
- '274': false,
- '275': false,
- '276': false,
- '277': false,
- '278': false,
- '279': false,
- '280': false,
- '281': false,
- '282': false,
- '284': false,
- '285': false,
- '288': false,
- '289': false,
- '290': false,
- '291': false,
- '294': false,
- '295': false,
- '297': false,
- '299': false,
- '301': false,
- '302': false,
- '303': false,
- '304': false,
- '308': false,
- '309': false,
- '310': false,
- '311': false,
- '312': false,
- '314': false,
- '315': false,
- '316': false,
- '317': false,
- '318': false,
- '319': false,
- '320': false,
- '323': false,
- '325': false,
- '326': false,
- '328': false,
- '329': false,
- '330': false,
- '331': false,
- '333': false,
- '337': false,
- '339': false,
- '341': false,
- '343': false,
- '344': false,
- '345': false,
- '347': false,
- '349': false,
- '350': false,
- '351': false,
- '354': false,
- '358': false,
- '359': false,
- '360': false,
- '361': false,
- '368': false,
- '369': false,
- '371': false,
- '373': false,
- '376': false,
- '377': false,
- '378': false,
- '380': false,
- '382': false,
- '384': false,
- '385': false,
- '387': false,
- '388': false,
- '389': false,
- '390': false,
- '391': false,
- '398': false,
- '400': false,
- '402': false,
- '403': false,
- '404': false,
- '413': false,
- '415': false,
- '421': false,
- '422': false
- }
- },
- 'gdprApplies': true
- },
- 'start': 1529511035686,
- 'doneCbCallCount': 0
-};
-
-const bidderRequestNoCoppa = {
- 'bidderCode': 'districtmDMX',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf',
- 'bidderRequestId': '124b579a136515',
- 'bids': [{
- 'bidder': 'districtmDMX',
- 'params': {
- 'dmxid': 100001,
- 'memberid': 100003,
- },
- 'adUnitCode': 'div-gpt-ad-12345678-1',
- 'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
- 'sizes': [
- [300, 250],
- [300, 600]
- ],
- 'bidId': '29a28a1bbc8a8d',
- 'bidderRequestId': '124b579a136515',
- 'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
- }],
- 'auctionStart': 1529511035677,
- 'timeout': 700,
- 'start': 1529511035686,
- 'doneCbCallCount': 0
-};
-
-const responses = {
- 'body': {
- 'id': '1f45b37c-5298-4934-b517-4d911aadabfd',
- 'cur': 'USD',
- 'seatbid': [{
- 'bid': [{
- 'id': '29a28a1bbc8a8d',
- 'impid': '29a28a1bbc8a8d',
- 'price': '6.42',
- 'adm': ''
- }]
- }]
- },
- 'headers': {}
-};
-
-const responsesNegative = {
- 'body': {
- 'id': '1f45b37c-5298-4934-b517-4d911aadabfd',
- 'cur': 'USD',
- 'seatbid': [{
- 'bid': [{
- 'id': '29a28a1bbc8a8d',
- 'impid': '29a28a1bbc8a8d',
- 'price': '-0.10',
- 'adm': ''
- }]
- }]
- },
- 'headers': {}
-};
-
-const emptyResponse = { body: {} };
-const emptyResponseSeatBid = { body: { seatbid: [] } };
-
-describe('DistrictM Adaptor', function () {
- const districtm = spec;
- describe('verification of upto5', function () {
- it('upto5 function should always break 12 imps into 3 request same for 15', function () {
- expect(upto5([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], bidRequest, bidderRequest, 'https://google').length).to.be.equal(3)
- expect(upto5([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], bidRequest, bidderRequest, 'https://google').length).to.be.equal(3)
- })
- })
-
- describe('test vast tag', function () {
- it('img tag should not be present', function () {
- expect(cleanVast(sample_vast).indexOf('img') !== -1).to.be.equal(false)
- })
- })
- describe('Test getApi function', function () {
- const data = {
- api: [1]
- }
- it('Will return 1 for vpaid version 1', function () {
- expect(getApi(data)[0]).to.be.equal(1)
- })
- it('Will return 2 for vpaid default', function () {
- expect(getApi({})[0]).to.be.equal(2)
- })
- })
-
- describe('Test cleanSizes function', function () {
- it('sequence will be respected', function () {
- expect(cleanSizes(bidderRequest.bids[0].sizes).toString()).to.be.equal('300,250,300,600')
- })
- it('sequence will be respected', function () {
- expect(cleanSizes([[728, 90], [970, 90], [300, 600], [320, 50]]).toString()).to.be.equal('728,90,320,50,300,600,970,90')
- })
- })
-
- describe('Test getPlaybackmethod function', function () {
- it('getPlaybackmethod will return 2', function () {
- expect(getPlaybackmethod([])[0]).to.be.equal(2)
- })
- it('getPlaybackmethod will return 6', function () {
- expect(getPlaybackmethod(['viewport_sound_off'])[0]).to.be.equal(6)
- })
- })
-
- describe('Test getProtocols function', function () {
- it('getProtocols will return 3', function () {
- expect(getProtocols({ protocols: [3] })[0]).to.be.equal(3)
- })
- it('getProtocols will return 6', function () {
- expect(_.isEqual(getProtocols({}), [2, 3, 5, 6, 7, 8])).to.be.equal(true)
- })
- })
-
- describe('All needed functions are available', function () {
- it(`isBidRequestValid is present and type function`, function () {
- expect(districtm.isBidRequestValid).to.exist.and.to.be.a('function')
- });
-
- it(`BuildRequests is present and type function`, function () {
- expect(districtm.buildRequests).to.exist.and.to.be.a('function')
- });
-
- it(`interpretResponse is present and type function`, function () {
- expect(districtm.interpretResponse).to.exist.and.to.be.a('function')
- });
-
- it(`getUserSyncs is present and type function`, function () {
- expect(districtm.getUserSyncs).to.exist.and.to.be.a('function')
- });
- });
-
- describe(`these properties are available or not`, function () {
- it(`code should have a value of districtmDMX`, function () {
- expect(districtm.code).to.be.equal('districtmDMX');
- });
-
- it(`timeout should not be defined`, function () {
- expect(districtm.onTimeout).to.be.an('undefined');
- });
- });
-
- describe(`isBidRequestValid test response`, function () {
- let params = {
- dmxid: 10001, // optional
- memberid: 10003,
- };
- it(`function should return true`, function () {
- expect(districtm.isBidRequestValid({ params })).to.be.equal(true);
- });
- it(`function should return false`, function () {
- expect(districtm.isBidRequestValid({ params: {} })).to.be.equal(false);
- });
- it(`expect to have memberid`, function () {
- expect(params).to.have.property('memberid');
- });
- });
-
- describe(`getUserSyncs test usage`, function () {
- it(`return value should be an array`, function () {
- expect(districtm.getUserSyncs({ iframeEnabled: true })).to.be.an('array');
- });
- it(`array should have only one object and it should have a property type = 'iframe'`, function () {
- expect(districtm.getUserSyncs({ iframeEnabled: true }).length).to.be.equal(1);
- let [userSync] = districtm.getUserSyncs({ iframeEnabled: true });
- expect(userSync).to.have.property('type');
- expect(userSync.type).to.be.equal('iframe');
- });
- });
-
- describe(`buildRequests test usage`, function () {
- const buildRequestResults = districtm.buildRequests(bidRequest, bidderRequest);
- const buildRequestResultsNoCoppa = districtm.buildRequests(bidRequestNoCoppa, bidderRequestNoCoppa);
- it(`the function should return an array`, function () {
- expect(buildRequestResults).to.be.an('object');
- });
- it(`contain gdpr consent & ccpa`, function () {
- const bidr = JSON.parse(buildRequestResults.data)
- expect(bidr.regs.ext.gdpr).to.be.equal(1);
- expect(bidr.regs.ext.us_privacy).to.be.equal('1NY');
- expect(bidr.user.ext.consent).to.be.an('string');
- });
- it(`test contain COPPA`, function () {
- const bidr = JSON.parse(buildRequestResults.data)
- bidr.regs = bidr.regs || {};
- bidr.regs.coppa = 1;
- expect(bidr.regs.coppa).to.be.equal(1)
- })
- it(`test should not contain COPPA`, function () {
- const bidr = JSON.parse(buildRequestResultsNoCoppa.data)
- expect(bidr.regs.coppa).to.be.equal(0)
- })
- it(`the function should return array length of 1`, function () {
- expect(buildRequestResults.data).to.be.a('string');
- });
- });
-
- describe('bidRequest Video testing', function () {
- const request = districtm.buildRequests(bidRequestVideo, bidRequestVideo);
- const data = JSON.parse(request.data)
- expect(data instanceof Object).to.be.equal(true)
- })
-
- describe(`interpretResponse test usage`, function () {
- const responseResults = districtm.interpretResponse(responses, { bidderRequest });
- const emptyResponseResults = districtm.interpretResponse(emptyResponse, { bidderRequest });
- const emptyResponseResultsNegation = districtm.interpretResponse(responsesNegative, { bidderRequest });
- const emptyResponseResultsEmptySeat = districtm.interpretResponse(emptyResponseSeatBid, { bidderRequest });
- it(`the function should return an array`, function () {
- expect(responseResults).to.be.an('array');
- });
- it(`the function should return array length of 1`, function () {
- expect(responseResults.length).to.be.equal(1);
- });
- it(`the response return nothing`, function () {
- expect(emptyResponseResults.length).to.be.equal(0);
- });
- it(`the response seatbid return nothing`, function () {
- expect(emptyResponseResultsEmptySeat.length).to.be.equal(0);
- });
-
- it(`on invalid CPM`, function () {
- expect(emptyResponseResultsNegation.length).to.be.equal(0);
- });
- });
-
- describe(`check validation for id sync gdpr ccpa`, () => {
- let allin = spec.getUserSyncs({ iframeEnabled: true }, {}, bidderRequest.gdprConsent, bidderRequest.uspConsent)[0]
- let noCCPA = spec.getUserSyncs({ iframeEnabled: true }, {}, bidderRequest.gdprConsent, null)[0]
- let noGDPR = spec.getUserSyncs({ iframeEnabled: true }, {}, null, bidderRequest.uspConsent)[0]
- let nothing = spec.getUserSyncs({ iframeEnabled: true }, {}, null, null)[0]
-
- /*
-
- 'uspConsent': '1NY',
- 'gdprConsent': {
- 'consentString': 'BOPqNzUOPqNzUAHABBAAA5AAAAAAAA',
- */
- it(`gdpr & ccpa should be present`, () => {
- expect(allin.url).to.be.equal('https://cdn.districtm.io/ids/index.html?gdpr=BOPqNzUOPqNzUAHABBAAA5AAAAAAAA&ccpa=1NY')
- })
- it(`ccpa should be present`, () => {
- expect(noGDPR.url).to.be.equal('https://cdn.districtm.io/ids/index.html?ccpa=1NY')
- })
- it(`gdpr should be present`, () => {
- expect(noCCPA.url).to.be.equal('https://cdn.districtm.io/ids/index.html?gdpr=BOPqNzUOPqNzUAHABBAAA5AAAAAAAA')
- })
- it(`gdpr & ccpa shouldn't be present`, () => {
- expect(nothing.url).to.be.equal('https://cdn.districtm.io/ids/index.html')
- })
- })
-
- describe(`Helper function testing`, function () {
- const bid = matchRequest('29a28a1bbc8a8d', { bidderRequest });
- const { width, height } = defaultSize(bid);
- it(`test matchRequest`, function () {
- expect(matchRequest('29a28a1bbc8a8d', { bidderRequest })).to.be.an('object');
- });
- it(`test checkDeepArray`, function () {
- expect(_.isEqual(checkDeepArray([728, 90]), [728, 90])).to.be.equal(true);
- expect(_.isEqual(checkDeepArray([[728, 90]]), [728, 90])).to.be.equal(true);
- expect(_.isEqual(checkDeepArray([[728, 90], [300, 250]]), [728, 90])).to.be.equal(true);
- expect(_.isEqual(checkDeepArray([[300, 250], [300, 250]]), [728, 90])).to.be.equal(false);
- expect(_.isEqual(checkDeepArray([300, 250]), [300, 250])).to.be.equal(true);
- });
- it(`test defaultSize`, function () {
- expect(width).to.be.equal(300);
- expect(height).to.be.equal(250);
- });
- });
-});
diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js
index 1ba4eed2f29..ca971c37832 100644
--- a/test/spec/modules/eids_spec.js
+++ b/test/spec/modules/eids_spec.js
@@ -258,18 +258,6 @@ describe('eids array generation for known sub-modules', function() {
});
});
- it('NextRollId', function() {
- const userId = {
- nextrollId: 'some-random-id-value'
- };
- const newEids = createEidsArray(userId);
- expect(newEids.length).to.equal(1);
- expect(newEids[0]).to.deep.equal({
- source: 'nextroll.com',
- uids: [{id: 'some-random-id-value', atype: 1}]
- });
- });
-
it('zeotapIdPlus', function() {
const userId = {
IDP: 'some-random-id-value'
diff --git a/test/spec/modules/emx_digitalBidAdapter_spec.js b/test/spec/modules/emx_digitalBidAdapter_spec.js
index 043a8a3709e..d99318b5ddc 100644
--- a/test/spec/modules/emx_digitalBidAdapter_spec.js
+++ b/test/spec/modules/emx_digitalBidAdapter_spec.js
@@ -211,7 +211,9 @@ describe('emx_digital Adapter', function () {
'refererInfo': {
'numIframes': 0,
'reachedTop': true,
- 'referer': 'https://example.com/index.html?pbjs_debug=true'
+ 'page': 'https://example.com/index.html?pbjs_debug=true',
+ 'domain': 'example.com',
+ 'ref': 'https://referrer.com'
},
'bids': [{
'bidder': 'emx_digital',
@@ -304,7 +306,7 @@ describe('emx_digital Adapter', function () {
request = JSON.parse(request.data);
expect(request.site).to.have.property('domain', 'example.com');
expect(request.site).to.have.property('page', 'https://example.com/index.html?pbjs_debug=true');
- expect(request.site).to.have.property('ref', window.top.document.referrer);
+ expect(request.site).to.have.property('ref', 'https://referrer.com');
});
it('builds correctly formatted request banner object', function () {
diff --git a/test/spec/modules/enrichmentFpdModule_spec.js b/test/spec/modules/enrichmentFpdModule_spec.js
index 3184349cdf7..7d7e463c015 100644
--- a/test/spec/modules/enrichmentFpdModule_spec.js
+++ b/test/spec/modules/enrichmentFpdModule_spec.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { getRefererInfo } from 'src/refererDetection.js';
-import { initSubmodule, coreStorage } from 'modules/enrichmentFpdModule.js';
+import { processFpd, coreStorage } from 'modules/enrichmentFpdModule.js';
describe('the first party data enrichment module', function() {
let width;
@@ -52,11 +52,12 @@ describe('the first party data enrichment module', function() {
width = 800;
height = 500;
- let validated = initSubmodule({}, {});
+ let validated = processFpd({}, {}).global;
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
- expect(validated.site.page).to.be.undefined;
- expect(validated.site.domain).to.be.undefined;
+ const {ref, page, domain} = getRefererInfo();
+ expect(validated.site.ref).to.equal(ref || undefined);
+ expect(validated.site.page).to.equal(page || undefined)
+ expect(validated.site.domain).to.equal(domain || undefined)
expect(validated.device).to.deep.equal({ w: 800, h: 500 });
expect(validated.site.keywords).to.be.undefined;
});
@@ -66,9 +67,9 @@ describe('the first party data enrichment module', function() {
height = 500;
canonical.href = 'https://www.subdomain.domain.co.uk/path?query=12345';
- let validated = initSubmodule({}, {});
+ let validated = processFpd({}, {}).global;
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
+ expect(validated.site.ref).to.equal(getRefererInfo().ref || undefined);
expect(validated.site.page).to.equal('https://www.subdomain.domain.co.uk/path?query=12345');
expect(validated.site.domain).to.equal('subdomain.domain.co.uk');
expect(validated.site.publisher.domain).to.equal('domain.co.uk');
@@ -81,12 +82,8 @@ describe('the first party data enrichment module', function() {
height = 500;
keywords.content = 'value1,value2,value3';
- let validated = initSubmodule({}, {});
+ let validated = processFpd({}, {}).global;
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
- expect(validated.site.page).to.be.undefined;
- expect(validated.site.domain).to.be.undefined;
- expect(validated.device).to.deep.equal({ w: 800, h: 500 });
expect(validated.site.keywords).to.equal('value1,value2,value3');
});
@@ -94,11 +91,10 @@ describe('the first party data enrichment module', function() {
width = 800;
height = 500;
- let validated = initSubmodule({}, {device: {w: 1200, h: 700}, site: {ref: 'https://someUrl.com', page: 'test.com'}});
+ let validated = processFpd({}, {global: {device: {w: 1200, h: 700}, site: {ref: 'https://someUrl.com', page: 'test.com'}}}).global;
expect(validated.site.ref).to.equal('https://someUrl.com');
expect(validated.site.page).to.equal('test.com');
- expect(validated.site.domain).to.be.undefined;
expect(validated.device).to.deep.equal({ w: 1200, h: 700 });
expect(validated.site.keywords).to.be.undefined;
});
diff --git a/test/spec/modules/eplanningBidAdapter_spec.js b/test/spec/modules/eplanningBidAdapter_spec.js
index 921c133c5b0..52d2fb76115 100644
--- a/test/spec/modules/eplanningBidAdapter_spec.js
+++ b/test/spec/modules/eplanningBidAdapter_spec.js
@@ -293,7 +293,9 @@ describe('E-Planning Adapter', function () {
const refererUrl = 'https://localhost';
const bidderRequest = {
refererInfo: {
- referer: refererUrl
+ page: refererUrl,
+ domain: 'localhost',
+ ref: refererUrl,
},
gdprConsent: {
gdprApplies: 1,
@@ -337,12 +339,18 @@ describe('E-Planning Adapter', function () {
let getWindowSelfStub;
let innerWidth;
beforeEach(() => {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ eplanning: {
+ storageAllowed: true
+ }
+ };
sandbox = sinon.sandbox.create();
getWindowSelfStub = sandbox.stub(utils, 'getWindowSelf');
getWindowSelfStub.returns(createWindow(800));
});
afterEach(() => {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
sandbox.restore();
});
@@ -467,7 +475,7 @@ describe('E-Planning Adapter', function () {
it('should return ur parameter with current window url', function () {
const ur = spec.buildRequests(bidRequests, bidderRequest).data.ur;
- expect(ur).to.equal(bidderRequest.refererInfo.referer);
+ expect(ur).to.equal(bidderRequest.refererInfo.page);
});
it('should return fr parameter when there is a referrer', function () {
@@ -721,6 +729,11 @@ describe('E-Planning Adapter', function () {
});
}
beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ eplanning: {
+ storageAllowed: true
+ }
+ };
getLocalStorageSpy = sandbox.spy(storage, 'getDataFromLocalStorage');
setDataInLocalStorageSpy = sandbox.spy(storage, 'setDataInLocalStorage');
@@ -733,6 +746,7 @@ describe('E-Planning Adapter', function () {
focusStub.returns(true);
});
afterEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
sandbox.restore();
if (document.getElementById(ADUNIT_CODE_VIEW)) {
document.body.removeChild(element);
diff --git a/test/spec/modules/fabrickIdSystem_spec.js b/test/spec/modules/fabrickIdSystem_spec.js
index c250c8e5e8b..4f3ed55ec03 100644
--- a/test/spec/modules/fabrickIdSystem_spec.js
+++ b/test/spec/modules/fabrickIdSystem_spec.js
@@ -53,7 +53,7 @@ describe('Fabrick ID System', function() {
}
let configParams = Object.assign({}, defaultConfigParams, {
refererInfo: {
- referer: r,
+ topmostLocation: r,
stack: ['s-0'],
canonicalUrl: 'cu-0'
}
@@ -81,7 +81,7 @@ describe('Fabrick ID System', function() {
it('should complete successfully', function() {
let configParams = Object.assign({}, defaultConfigParams, {
refererInfo: {
- referer: 'r-0',
+ topmostLocation: 'r-0',
stack: ['s-0'],
canonicalUrl: 'cu-0'
}
diff --git a/test/spec/modules/feedadBidAdapter_spec.js b/test/spec/modules/feedadBidAdapter_spec.js
index 2739654eb5d..fc26d9bc0cf 100644
--- a/test/spec/modules/feedadBidAdapter_spec.js
+++ b/test/spec/modules/feedadBidAdapter_spec.js
@@ -108,7 +108,7 @@ describe('FeedAdAdapter', function () {
describe('buildRequests', function () {
const bidderRequest = {
refererInfo: {
- referer: 'the referer'
+ page: 'the referer'
},
some: 'thing'
};
@@ -332,7 +332,7 @@ describe('FeedAdAdapter', function () {
const referer = 'the referer';
const bidderRequest = {
refererInfo: {
- referer: referer
+ page: referer
},
some: 'thing'
};
diff --git a/test/spec/modules/fpdModule_spec.js b/test/spec/modules/fpdModule_spec.js
index c2a6c41835e..cedfd22a5d7 100644
--- a/test/spec/modules/fpdModule_spec.js
+++ b/test/spec/modules/fpdModule_spec.js
@@ -1,78 +1,14 @@
import {expect} from 'chai';
-import * as utils from 'src/utils.js';
import {config} from 'src/config.js';
import {getRefererInfo} from 'src/refererDetection.js';
-import {init, registerSubmodules} from 'modules/fpdModule/index.js';
+import {processFpd, registerSubmodules} from 'modules/fpdModule/index.js';
import * as enrichmentModule from 'modules/enrichmentFpdModule.js';
import * as validationModule from 'modules/validationFpdModule/index.js';
-let enrichments = {
- name: 'enrichments',
- queue: 2,
- init: enrichmentModule.initSubmodule
-};
-let validations = {
- name: 'validations',
- queue: 1,
- init: validationModule.initSubmodule
-};
+let enrichments = {...enrichmentModule};
+let validations = {...validationModule};
describe('the first party data module', function () {
- let ortb2 = {
- device: {
- h: 911,
- w: 1733
- },
- user: {
- data: [{
- segment: [{
- id: 'foo'
- }],
- name: 'bar',
- ext: 'string'
- }]
- },
- site: {
- content: {
- data: [{
- segment: [{
- id: 'test'
- }],
- name: 'content',
- ext: {
- foo: 'bar'
- }
- }]
- }
- }
- };
-
- let conf = {
- device: {
- h: 500,
- w: 750
- },
- user: {
- keywords: 'test1, test2',
- gender: 'f',
- data: [{
- segment: [{
- id: 'test'
- }],
- name: 'alt'
- }]
- },
- site: {
- ref: 'domain.com',
- page: 'www.domain.com/test',
- ext: {
- data: {
- inventory: ['first']
- }
- }
- }
- };
-
afterEach(function () {
config.resetConfig();
});
@@ -115,112 +51,43 @@ describe('the first party data module', function () {
keywords.name = 'keywords';
});
- it('sets default referer and dimension values to ortb2 data', function () {
- registerSubmodules(enrichments);
- registerSubmodules(validations);
-
- let validated;
-
- width = 1120;
- height = 750;
-
- init();
-
- validated = config.getConfig('ortb2');
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
- expect(validated.site.page).to.be.undefined;
- expect(validated.site.domain).to.be.undefined;
- expect(validated.device).to.deep.equal({w: 1120, h: 750});
- expect(validated.site.keywords).to.be.undefined;
- });
-
- it('sets page and domain values to ortb2 data if canonical link exists', function () {
- let validated;
-
- canonical.href = 'https://www.domain.com/path?query=12345';
-
- init();
-
- validated = config.getConfig('ortb2');
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
- expect(validated.site.page).to.equal('https://www.domain.com/path?query=12345');
- expect(validated.site.domain).to.equal('domain.com');
- expect(validated.device).to.deep.to.equal({w: 1120, h: 750});
- expect(validated.site.keywords).to.be.undefined;
- });
-
- it('sets keyword values to ortb2 data if keywords meta exists', function () {
- let validated;
-
- keywords.content = 'value1,value2,value3';
-
- init();
-
- validated = config.getConfig('ortb2');
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
- expect(validated.site.page).to.be.undefined;
- expect(validated.site.domain).to.be.undefined;
- expect(validated.device).to.deep.to.equal({w: 1120, h: 750});
- expect(validated.site.keywords).to.equal('value1,value2,value3');
- });
-
- it('only sets values that do not exist in ortb2 config', function () {
- let validated;
-
- config.setConfig({ortb2: {site: {ref: 'https://testpage.com', domain: 'newDomain.com'}}});
-
- init();
-
- validated = config.getConfig('ortb2');
- expect(validated.site.ref).to.equal('https://testpage.com');
- expect(validated.site.page).to.be.undefined;
- expect(validated.site.domain).to.equal('newDomain.com');
- expect(validated.device).to.deep.to.equal({w: 1120, h: 750});
- expect(validated.site.keywords).to.be.undefined;
- });
-
it('filters ortb2 data that is set', function () {
let validated;
- let conf = {
- ortb2: {
- user: {
- data: {},
- gender: 'f',
- age: 45
- },
- site: {
- content: {
- data: [{
- segment: {
- test: 1
- },
- name: 'foo'
+ const global = {
+ user: {
+ data: {},
+ gender: 'f',
+ age: 45
+ },
+ site: {
+ content: {
+ data: [{
+ segment: {
+ test: 1
+ },
+ name: 'foo'
+ }, {
+ segment: [{
+ id: 'test'
}, {
- segment: [{
- id: 'test'
- }, {
- id: 3
- }],
- name: 'bar'
- }]
- }
- },
- device: {
- w: 1,
- h: 1
+ id: 3
+ }],
+ name: 'bar'
+ }]
}
+ },
+ device: {
+ w: 1,
+ h: 1
}
};
- config.setConfig(conf);
canonical.href = 'https://www.domain.com/path?query=12345';
width = 1120;
height = 750;
- init();
-
- validated = config.getConfig('ortb2');
- expect(validated.site.ref).to.equal(getRefererInfo().referer);
+ ({global: validated} = processFpd({global}));
+ expect(validated.site.ref).to.equal(getRefererInfo().ref || undefined);
expect(validated.site.page).to.equal('https://www.domain.com/path?query=12345');
expect(validated.site.domain).to.equal('domain.com');
expect(validated.site.content.data).to.deep.equal([{segment: [{id: 'test'}], name: 'bar'}]);
@@ -231,43 +98,31 @@ describe('the first party data module', function () {
it('should not overwrite existing data with default settings', function () {
let validated;
- let conf = {
- ortb2: {
- site: {
- ref: 'https://referer.com'
- }
+ const global = {
+ site: {
+ ref: 'https://referer.com'
}
};
- config.setConfig(conf);
-
- init();
-
- validated = config.getConfig('ortb2');
+ ({global: validated} = processFpd({global}));
expect(validated.site.ref).to.equal('https://referer.com');
});
it('should allow overwrite default data with setConfig', function () {
let validated;
- let conf = {
- ortb2: {
- site: {
- ref: 'https://referer.com'
- }
+ const global = {
+ site: {
+ ref: 'https://referer.com'
}
};
- config.setConfig(conf);
-
- init();
-
- validated = config.getConfig('ortb2');
+ ({global: validated} = processFpd({global}));
expect(validated.site.ref).to.equal('https://referer.com');
});
it('should filter all data', function () {
let validated;
- let conf = {
+ let global = {
imp: [],
site: {
name: 123,
@@ -300,17 +155,13 @@ describe('the first party data module', function () {
config.setConfig({'firstPartyData': {skipEnrichments: true}});
- config.setConfig({ortb2: conf});
-
- init();
-
- validated = config.getConfig('ortb2');
+ ({global: validated} = processFpd({global}));
expect(validated).to.deep.equal({});
});
it('should add enrichments but not alter any arbitrary ortb2 data', function () {
let validated;
- let conf = {
+ let global = {
site: {
ext: {
data: {
@@ -328,11 +179,7 @@ describe('the first party data module', function () {
cur: ['USD']
};
- config.setConfig({ortb2: conf});
-
- init();
-
- validated = config.getConfig('ortb2');
+ ({global: validated} = processFpd({global}));
expect(validated.site.ref).to.equal(getRefererInfo().referer);
expect(validated.site.ext.data).to.deep.equal({inventory: ['value1']});
expect(validated.user.ext.data).to.deep.equal({visitor: ['value2']});
@@ -340,76 +187,61 @@ describe('the first party data module', function () {
});
it('should filter bidderConfig data', function () {
- let validated;
- let conf = {
- bidders: ['bidderA', 'bidderB'],
- config: {
- ortb2: {
- site: {
- keywords: 'other',
- ref: 'https://domain.com'
- },
- user: {
- keywords: 'test',
- data: [{
- segment: [{id: 4}],
- name: 't'
- }]
- }
+ let bidder = {
+ bidderA: {
+ site: {
+ keywords: 'other',
+ ref: 'https://domain.com'
+ },
+ user: {
+ keywords: 'test',
+ data: [{
+ segment: [{id: 4}],
+ name: 't'
+ }]
}
}
};
- config.setBidderConfig(conf);
-
- init();
-
- validated = config.getBidderConfig();
- expect(validated.bidderA.ortb2).to.not.be.undefined;
- expect(validated.bidderA.ortb2.user.data).to.be.undefined;
- expect(validated.bidderA.ortb2.user.keywords).to.equal('test');
- expect(validated.bidderA.ortb2.site.keywords).to.equal('other');
- expect(validated.bidderA.ortb2.site.ref).to.equal('https://domain.com');
+ const {bidder: validated} = processFpd({bidder});
+ expect(validated.bidderA).to.not.be.undefined;
+ expect(validated.bidderA.user.data).to.be.undefined;
+ expect(validated.bidderA.user.keywords).to.equal('test');
+ expect(validated.bidderA.site.keywords).to.equal('other');
+ expect(validated.bidderA.site.ref).to.equal('https://domain.com');
});
it('should not filter bidderConfig data as it is valid', function () {
- let validated;
- let conf = {
- bidders: ['bidderA', 'bidderB'],
- config: {
- ortb2: {
- site: {
- keywords: 'other',
- ref: 'https://domain.com'
- },
- user: {
- keywords: 'test',
- data: [{
- segment: [{id: 'data1_id'}],
- name: 'data1'
- }]
- }
+ let bidder = {
+ bidderA: {
+ site: {
+ keywords: 'other',
+ ref: 'https://domain.com'
+ },
+ user: {
+ keywords: 'test',
+ data: [{
+ segment: [{id: 'data1_id'}],
+ name: 'data1'
+ }]
}
}
};
- config.setBidderConfig(conf);
+ const {bidder: validated} = processFpd({bidder});
- init();
-
- validated = config.getBidderConfig();
- expect(validated.bidderA.ortb2).to.not.be.undefined;
- expect(validated.bidderA.ortb2.user.data).to.deep.equal([{segment: [{id: 'data1_id'}], name: 'data1'}]);
- expect(validated.bidderA.ortb2.user.keywords).to.equal('test');
- expect(validated.bidderA.ortb2.site.keywords).to.equal('other');
- expect(validated.bidderA.ortb2.site.ref).to.equal('https://domain.com');
+ expect(validated.bidderA).to.not.be.undefined;
+ expect(validated.bidderA.user.data).to.deep.equal([{segment: [{id: 'data1_id'}], name: 'data1'}]);
+ expect(validated.bidderA.user.keywords).to.equal('test');
+ expect(validated.bidderA.site.keywords).to.equal('other');
+ expect(validated.bidderA.site.ref).to.equal('https://domain.com');
});
it('should not set default values if skipEnrichments is turned on', function () {
let validated;
config.setConfig({'firstPartyData': {skipEnrichments: true}});
- let conf = {
+ let global = {
site: {
keywords: 'other'
},
@@ -420,26 +252,20 @@ describe('the first party data module', function () {
name: 'data1'
}]
}
- }
- ;
-
- config.setConfig({ortb2: conf});
-
- init();
+ };
- validated = config.getConfig();
- expect(validated.ortb2).to.not.be.undefined;
- expect(validated.ortb2.device).to.be.undefined;
- expect(validated.ortb2.site.ref).to.be.undefined;
- expect(validated.ortb2.site.page).to.be.undefined;
- expect(validated.ortb2.site.domain).to.be.undefined;
+ ({global: validated} = processFpd({global}));
+ expect(validated.device).to.be.undefined;
+ expect(validated.site.ref).to.be.undefined;
+ expect(validated.site.page).to.be.undefined;
+ expect(validated.site.domain).to.be.undefined;
});
it('should not validate ortb2 data if skipValidations is turned on', function () {
let validated;
config.setConfig({'firstPartyData': {skipValidations: true}});
- let conf = {
+ let global = {
site: {
keywords: 'other'
},
@@ -449,16 +275,10 @@ describe('the first party data module', function () {
segment: [{id: 'nonfiltered'}]
}]
}
- }
- ;
-
- config.setConfig({ortb2: conf});
-
- init();
+ };
- validated = config.getConfig();
- expect(validated.ortb2).to.not.be.undefined;
- expect(validated.ortb2.user.data).to.deep.equal([{segment: [{id: 'nonfiltered'}]}]);
+ ({global: validated} = processFpd({global}));
+ expect(validated.user.data).to.deep.equal([{segment: [{id: 'nonfiltered'}]}]);
});
});
});
diff --git a/test/spec/modules/gamoshiBidAdapter_spec.js b/test/spec/modules/gamoshiBidAdapter_spec.js
index 8d63a32ef4d..8f8e3f03736 100644
--- a/test/spec/modules/gamoshiBidAdapter_spec.js
+++ b/test/spec/modules/gamoshiBidAdapter_spec.js
@@ -201,10 +201,6 @@ describe('GamoshiAdapter', () => {
it('check if you are in the top frame', () => {
expect(helper.getTopFrame()).to.equal(0);
});
-
- it('verify domain parsing', () => {
- expect(helper.getTopWindowDomain('http://www.domain.com')).to.equal('www.domain.com');
- });
});
describe('Is String start with search', () => {
@@ -323,12 +319,16 @@ describe('GamoshiAdapter', () => {
it('builds request correctly', () => {
let bidRequest2 = utils.deepClone(bidRequest);
- bidRequest2.refererInfo.referer = 'http://www.test.com/page.html';
+ Object.assign(bidRequest2.refererInfo, {
+ page: 'http://www.test.com/page.html',
+ domain: 'www.test.com',
+ ref: 'http://referrer.com'
+ })
let response = spec.buildRequests([bidRequest], bidRequest2)[0];
expect(response.data.site.domain).to.equal('www.test.com');
expect(response.data.site.page).to.equal('http://www.test.com/page.html');
- expect(response.data.site.ref).to.equal('http://www.test.com/page.html');
+ expect(response.data.site.ref).to.equal('http://referrer.com');
expect(response.data.imp.length).to.equal(1);
expect(response.data.imp[0].id).to.equal(bidRequest.transactionId);
expect(response.data.imp[0].instl).to.equal(0);
diff --git a/test/spec/modules/glimpseBidAdapter_spec.js b/test/spec/modules/glimpseBidAdapter_spec.js
index 7104493792f..353e61c7859 100644
--- a/test/spec/modules/glimpseBidAdapter_spec.js
+++ b/test/spec/modules/glimpseBidAdapter_spec.js
@@ -36,7 +36,7 @@ const mock = {
refererInfo: {
numIframes: 0,
reachedTop: true,
- referer: 'https://demo.glimpseprotocol.io/prebid/desktop',
+ page: 'https://demo.glimpseprotocol.io/prebid/desktop',
stack: ['https://demo.glimpseprotocol.io/prebid/desktop'],
},
},
@@ -167,7 +167,7 @@ describe('GlimpseProtocolAdapter', () => {
it('Has referer information', () => {
const request = spec.buildRequests(bidRequests, bidderRequest);
const payload = JSON.parse(request.data);
- const expected = mock.bidderRequest.refererInfo.referer;
+ const expected = mock.bidderRequest.refererInfo.page;
expect(payload.data.referer).to.equal(expected);
});
@@ -273,16 +273,11 @@ describe('GlimpseProtocolAdapter', () => {
},
};
- afterEach(() => {
- config.getConfig.restore();
- });
-
it('should keep all non-empty fields', () => {
const fpdMock = fpdMockBase;
- sinon.stub(config, 'getConfig').withArgs('ortb2').returns(fpdMock);
const expected = fpdMockBase;
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: fpdMock});
const payload = JSON.parse(request.data);
const fpd = payload.data.fpd;
@@ -293,7 +288,6 @@ describe('GlimpseProtocolAdapter', () => {
const fpdMock = getDeepCopy(fpdMockBase);
fpdMock.site.ext.data.fpdProvider.dataObject = {};
fpdMock.user.ext.data.fpdProvider = {};
- sinon.stub(config, 'getConfig').withArgs('ortb2').returns(fpdMock);
const expected = {
site: {
@@ -312,7 +306,7 @@ describe('GlimpseProtocolAdapter', () => {
},
};
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: fpdMock});
const payload = JSON.parse(request.data);
const fpd = payload.data.fpd;
@@ -323,7 +317,6 @@ describe('GlimpseProtocolAdapter', () => {
const fpdMock = getDeepCopy(fpdMockBase);
fpdMock.site.ext.data.fpdProvider.dataArray = [];
fpdMock.user.ext.data.fpdProvider.dataArray = [];
- sinon.stub(config, 'getConfig').withArgs('ortb2').returns(fpdMock);
const expected = {
site: {
@@ -356,7 +349,7 @@ describe('GlimpseProtocolAdapter', () => {
},
};
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: fpdMock});
const payload = JSON.parse(request.data);
const fpd = payload.data.fpd;
@@ -369,7 +362,6 @@ describe('GlimpseProtocolAdapter', () => {
fpdMock.site.ext.data.fpdProvider.dataString = '';
fpdMock.user.keywords = '';
fpdMock.user.ext.data.fpdProvider.dataString = '';
- sinon.stub(config, 'getConfig').withArgs('ortb2').returns(fpdMock);
const expected = {
site: {
@@ -400,7 +392,7 @@ describe('GlimpseProtocolAdapter', () => {
},
};
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: fpdMock});
const payload = JSON.parse(request.data);
const fpd = payload.data.fpd;
@@ -417,11 +409,10 @@ describe('GlimpseProtocolAdapter', () => {
fpdMock.user.ext.data.fpdProvider.dataArray = [];
fpdMock.user.ext.data.fpdProvider.dataObject = {};
fpdMock.user.ext.data.fpdProvider.dataString = '';
- sinon.stub(config, 'getConfig').withArgs('ortb2').returns(fpdMock);
const expected = {};
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: fpdMock});
const payload = JSON.parse(request.data);
const fpd = payload.data.fpd;
diff --git a/test/spec/modules/glomexBidAdapter_spec.js b/test/spec/modules/glomexBidAdapter_spec.js
index 6e5765c31f5..30157da858b 100644
--- a/test/spec/modules/glomexBidAdapter_spec.js
+++ b/test/spec/modules/glomexBidAdapter_spec.js
@@ -21,7 +21,7 @@ const BIDDER_REQUEST = {
isAmp: true,
numIframes: 0,
reachedTop: true,
- referer: 'https://glomex.com'
+ topmostLocation: 'https://glomex.com'
},
gdprConsent: {
gdprApplies: true,
@@ -91,7 +91,12 @@ describe('glomexBidAdapter', function () {
})
it('sends refererInfo', function () {
- expect(request.data.refererInfo).to.eql(BIDDER_REQUEST.refererInfo)
+ const expected = {
+ ...BIDDER_REQUEST.refererInfo,
+ referer: BIDDER_REQUEST.refererInfo.topmostLocation
+ }
+ delete expected.topmostLocation;
+ expect(request.data.refererInfo).to.eql(expected)
})
it('sends gdprConsent', function () {
diff --git a/test/spec/modules/gmosspBidAdapter_spec.js b/test/spec/modules/gmosspBidAdapter_spec.js
index 87c87600b97..6d290504194 100644
--- a/test/spec/modules/gmosspBidAdapter_spec.js
+++ b/test/spec/modules/gmosspBidAdapter_spec.js
@@ -62,7 +62,7 @@ describe('GmosspAdapter', function () {
it('sends bid request to ENDPOINT via GET', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://hoge.com'
+ topmostLocation: 'https://hoge.com'
}
};
const requests = spec.buildRequests(bidRequests, bidderRequest);
@@ -74,7 +74,7 @@ describe('GmosspAdapter', function () {
it('should use fallback if refererInfo.referer in bid request is empty and im_uid ,shared_id, idl_env cookie is empty', function () {
const bidderRequest = {
refererInfo: {
- referer: ''
+ topmostLocation: ''
},
};
bidRequests[0].userId.imuid = '';
diff --git a/test/spec/modules/gnetBidAdapter_spec.js b/test/spec/modules/gnetBidAdapter_spec.js
index a69b196bc5c..21526aba201 100644
--- a/test/spec/modules/gnetBidAdapter_spec.js
+++ b/test/spec/modules/gnetBidAdapter_spec.js
@@ -69,7 +69,7 @@ describe('gnetAdapter', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://gnetrtb.com'
+ page: 'https://gnetrtb.com'
}
};
diff --git a/test/spec/modules/goldbachBidAdapter_spec.js b/test/spec/modules/goldbachBidAdapter_spec.js
index 459cda7958f..fc2c1beb900 100644
--- a/test/spec/modules/goldbachBidAdapter_spec.js
+++ b/test/spec/modules/goldbachBidAdapter_spec.js
@@ -802,7 +802,7 @@ describe('GoldbachXandrAdapter', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
@@ -919,11 +919,7 @@ describe('GoldbachXandrAdapter', function () {
uid2: { id: 'sample-uid2-value' },
criteoId: 'sample-criteo-userid',
netId: 'sample-netId-userid',
- idl_env: 'sample-idl-userid',
- flocId: {
- id: 'sample-flocid-value',
- version: 'chrome.1.0'
- }
+ idl_env: 'sample-idl-userid'
}
});
@@ -940,11 +936,6 @@ describe('GoldbachXandrAdapter', function () {
id: 'sample-criteo-userid',
});
- expect(payload.eids).to.deep.include({
- source: 'chrome.com',
- id: 'sample-flocid-value'
- });
-
expect(payload.eids).to.deep.include({
source: 'netid.de',
id: 'sample-netId-userid',
diff --git a/test/spec/modules/gridBidAdapter_spec.js b/test/spec/modules/gridBidAdapter_spec.js
index 61776f58682..94524e07fb3 100644
--- a/test/spec/modules/gridBidAdapter_spec.js
+++ b/test/spec/modules/gridBidAdapter_spec.js
@@ -44,12 +44,12 @@ describe('TheMediaGrid Adapter', function () {
return JSON.parse(data);
}
const bidderRequest = {
- refererInfo: {referer: 'https://example.com'},
+ refererInfo: {page: 'https://example.com'},
bidderRequestId: '22edbae2733bf6',
auctionId: '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
timeout: 3000
};
- const referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
+ const referrer = encodeURIComponent(bidderRequest.refererInfo.page);
let bidRequests = [
{
'bidder': 'grid',
@@ -126,14 +126,10 @@ describe('TheMediaGrid Adapter', function () {
genre: 'Adventure'
}
};
-
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.site' ? site : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
+ const request = spec.buildRequests([bidRequests[0]], {...bidderRequest, ortb2: {site}});
const payload = parseRequest(request.data);
expect(payload.site.cat).to.deep.equal([...site.cat, ...site.pagecat]);
expect(payload.site.content.genre).to.deep.equal(site.content.genre);
- getConfigStub.restore();
});
it('should attach valid params to the tag', function () {
@@ -405,16 +401,14 @@ describe('TheMediaGrid Adapter', function () {
screenHeight: 800,
language: 'ru'
};
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user.ext.device' ? ortb2UserExtDevice : null);
+ const ortb2 = {user: {ext: {device: ortb2UserExtDevice}}};
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2});
expect(request.data).to.be.an('string');
const payload = parseRequest(request.data);
expect(payload).to.have.property('user');
expect(payload.user).to.have.property('ext');
expect(payload.user.ext.device).to.deep.equal(ortb2UserExtDevice);
- getConfigStub.restore();
});
it('if schain is present payload must have source.ext.schain param', function () {
@@ -473,8 +467,10 @@ describe('TheMediaGrid Adapter', function () {
});
it('should contain the keyword values if it present in ortb2.(site/user)', function () {
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user' ? {'keywords': 'foo,any'} : (arg === 'ortb2.site' ? {'keywords': 'bar'} : null));
+ const ortb2 = {
+ user: {'keywords': 'foo,any'},
+ site: {'keywords': 'bar'}
+ };
const keywords = {
'site': {
'somePublisher': [
@@ -498,7 +494,7 @@ describe('TheMediaGrid Adapter', function () {
}
};
const bidRequestWithKW = { ...bidRequests[0], params: { ...bidRequests[0].params, keywords } }
- const request = spec.buildRequests([bidRequestWithKW], bidderRequest);
+ const request = spec.buildRequests([bidRequestWithKW], {...bidderRequest, ortb2});
expect(request.data).to.be.an('string');
const payload = parseRequest(request.data);
expect(payload.ext.keywords).to.deep.equal({
@@ -543,7 +539,6 @@ describe('TheMediaGrid Adapter', function () {
]
}
});
- getConfigStub.restore();
});
it('should have user.data filled from config ortb2.user.data', function () {
@@ -560,13 +555,10 @@ describe('TheMediaGrid Adapter', function () {
someKey: 'another data'
}
];
-
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user.data' ? userData : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
+ const ortb2 = {user: {data: userData}};
+ const request = spec.buildRequests([bidRequests[0]], {...bidderRequest, ortb2});
const payload = parseRequest(request.data);
expect(payload.user.data).to.deep.equal(userData);
- getConfigStub.restore();
});
it('should have site.content.data filled from config ortb2.site.content.data', function () {
@@ -582,13 +574,10 @@ describe('TheMediaGrid Adapter', function () {
]
}
];
-
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.site' ? { content: { data: contentData } } : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
+ const ortb2 = {site: { content: { data: contentData } }};
+ const request = spec.buildRequests([bidRequests[0]], {...bidderRequest, ortb2});
const payload = parseRequest(request.data);
expect(payload.site.content.data).to.deep.equal(contentData);
- getConfigStub.restore();
});
it('should have right value in user.data when jwpsegments are present', function () {
@@ -605,8 +594,7 @@ describe('TheMediaGrid Adapter', function () {
someKey: 'another data'
}
];
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user.data' ? userData : null);
+ const ortb2 = {user: {data: userData}};
const jsContent = {id: 'test_jw_content_id'};
const jsSegments = ['test_seg_1', 'test_seg_2'];
@@ -620,7 +608,7 @@ describe('TheMediaGrid Adapter', function () {
}
}
});
- const request = spec.buildRequests([bidRequestsWithJwTargeting], bidderRequest);
+ const request = spec.buildRequests([bidRequestsWithJwTargeting], {...bidderRequest, ortb2});
const payload = parseRequest(request.data);
expect(payload.user.data).to.deep.equal([{
name: 'iow_labs_pub_data',
@@ -629,18 +617,14 @@ describe('TheMediaGrid Adapter', function () {
{name: 'jwpseg', value: jsSegments[1]}
]
}, ...userData]);
- getConfigStub.restore();
});
it('should have site.content.id filled from config ortb2.site.content.id', function () {
const contentId = 'jw_abc';
-
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.site' ? { content: { id: contentId } } : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
+ const ortb2 = {site: {content: {id: contentId}}};
+ const request = spec.buildRequests([bidRequests[0]], {...bidderRequest, ortb2});
const payload = parseRequest(request.data);
expect(payload.site.content.id).to.equal(contentId);
- getConfigStub.restore();
});
it('should be right tmax when timeout in config is less then timeout in bidderRequest', function() {
@@ -760,12 +744,12 @@ describe('TheMediaGrid Adapter', function () {
'auctionId': 654645,
};
const bidderRequestWithNumId = {
- refererInfo: {referer: 'https://example.com'},
+ refererInfo: {page: 'https://example.com'},
bidderRequestId: 345345345,
auctionId: 654645,
timeout: 3000
};
- const parsedReferrer = encodeURIComponent(bidderRequestWithNumId.refererInfo.referer);
+ const parsedReferrer = encodeURIComponent(bidderRequestWithNumId.refererInfo.page);
const request = spec.buildRequests([bidRequestWithNumId], bidderRequestWithNumId);
expect(request.data).to.be.an('string');
const payload = parseRequest(request.data);
diff --git a/test/spec/modules/gridNMBidAdapter_spec.js b/test/spec/modules/gridNMBidAdapter_spec.js
index 89efe942c1f..c09aca07cc3 100644
--- a/test/spec/modules/gridNMBidAdapter_spec.js
+++ b/test/spec/modules/gridNMBidAdapter_spec.js
@@ -184,9 +184,9 @@ describe('TheMediaGridNM Adapter', function () {
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
timeout: 3000,
- refererInfo: { referer: 'https://example.com' }
+ refererInfo: { page: 'https://example.com' }
};
- const referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
+ const referrer = encodeURIComponent(bidderRequest.refererInfo.page);
let bidRequests = [
{
'bidder': 'gridNM',
diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js
index ebbc1c230f1..1a2641e5133 100644
--- a/test/spec/modules/gumgumBidAdapter_spec.js
+++ b/test/spec/modules/gumgumBidAdapter_spec.js
@@ -546,7 +546,7 @@ describe('gumgumAdapter', function () {
});
it('should handle no gg params', function () {
- const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo¶m2=bar¶m3=baz' } })[0];
+ const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { page: 'https://www.prebid.org/?param1=foo¶m2=bar¶m3=baz' } })[0];
// no params are in object
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
@@ -555,7 +555,7 @@ describe('gumgumAdapter', function () {
});
it('should handle encrypted ad buy id', function () {
- const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=bar¶m3=baz' } })[0];
+ const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { page: 'https://www.prebid.org/?param1=foo&ggad=bar¶m3=baz' } })[0];
// correct params are in object
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
@@ -567,7 +567,7 @@ describe('gumgumAdapter', function () {
});
it('should handle unencrypted ad buy id', function () {
- const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=123¶m3=baz' } })[0];
+ const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { page: 'https://www.prebid.org/?param1=foo&ggad=123¶m3=baz' } })[0];
// correct params are in object
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
@@ -579,7 +579,7 @@ describe('gumgumAdapter', function () {
});
it('should handle multiple gg params', function () {
- const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?ggdeal=foo&ggad=bar¶m3=baz' } })[0];
+ const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { page: 'https://www.prebid.org/?ggdeal=foo&ggad=bar¶m3=baz' } })[0];
// correct params are in object
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
diff --git a/test/spec/modules/hadronRtdProvider_spec.js b/test/spec/modules/hadronRtdProvider_spec.js
index 30e4947566f..b9e07c97f84 100644
--- a/test/spec/modules/hadronRtdProvider_spec.js
+++ b/test/spec/modules/hadronRtdProvider_spec.js
@@ -1,3 +1,5 @@
+// TODO: this and hadronRtdProvider_spec are a copy-paste of each other
+
import {config} from 'src/config.js';
import {HALOID_LOCAL_NAME, RTD_LOCAL_NAME, addRealTimeData, getRealTimeData, hadronSubmodule, storage} from 'modules/hadronRtdProvider.js';
import {server} from 'test/mocks/xhr.js';
@@ -25,7 +27,6 @@ describe('hadronRtdProvider', function() {
describe('Add Real-Time Data', function() {
it('merges ortb2 data', function() {
let rtdConfig = {};
- let bidConfig = {};
const setConfigUserObj1 = {
name: 'www.dataprovider1.com',
@@ -58,18 +59,20 @@ describe('hadronRtdProvider', function() {
]
}
- config.setConfig({
- ortb2: {
- user: {
- data: [setConfigUserObj1, setConfigUserObj2]
- },
- site: {
- content: {
- data: [setConfigSiteObj1]
+ let bidConfig = {
+ ortb2Fragments: {
+ global: {
+ user: {
+ data: [setConfigUserObj1, setConfigUserObj2]
+ },
+ site: {
+ content: {
+ data: [setConfigSiteObj1]
+ }
}
}
}
- });
+ };
const rtdUserObj1 = {
name: 'www.dataprovider4.com',
@@ -116,7 +119,7 @@ describe('hadronRtdProvider', function() {
addRealTimeData(bidConfig, rtd, rtdConfig);
- let ortb2Config = config.getConfig().ortb2;
+ let ortb2Config = bidConfig.ortb2Fragments.global;
expect(ortb2Config.user.data).to.deep.include.members([setConfigUserObj1, setConfigUserObj2, rtdUserObj1]);
expect(ortb2Config.site.content.data).to.deep.include.members([setConfigSiteObj1, rtdSiteObj1]);
@@ -124,7 +127,6 @@ describe('hadronRtdProvider', function() {
it('merges ortb2 data without duplication', function() {
let rtdConfig = {};
- let bidConfig = {};
const userObj1 = {
name: 'www.dataprovider1.com',
@@ -157,18 +159,20 @@ describe('hadronRtdProvider', function() {
]
}
- config.setConfig({
- ortb2: {
- user: {
- data: [userObj1, userObj2]
- },
- site: {
- content: {
- data: [siteObj1]
+ let bidConfig = {
+ ortb2Fragments: {
+ global: {
+ user: {
+ data: [userObj1, userObj2]
+ },
+ site: {
+ content: {
+ data: [siteObj1]
+ }
}
}
}
- });
+ };
const rtd = {
ortb2: {
@@ -185,7 +189,7 @@ describe('hadronRtdProvider', function() {
addRealTimeData(bidConfig, rtd, rtdConfig);
- let ortb2Config = config.getConfig().ortb2;
+ let ortb2Config = bidConfig.ortb2Fragments.global;
expect(ortb2Config.user.data).to.deep.include.members([userObj1, userObj2]);
expect(ortb2Config.site.content.data).to.deep.include.members([siteObj1]);
@@ -195,7 +199,6 @@ describe('hadronRtdProvider', function() {
it('merges bidder-specific ortb2 data', function() {
let rtdConfig = {};
- let bidConfig = {};
const configUserObj1 = {
name: 'www.dataprovider1.com',
@@ -248,37 +251,32 @@ describe('hadronRtdProvider', function() {
]
};
- config.setBidderConfig({
- bidders: ['adbuzz'],
- config: {
- ortb2: {
- user: {
- data: [configUserObj1, configUserObj2]
- },
- site: {
- content: {
- data: [configSiteObj1]
+ let bidConfig = {
+ ortb2Fragments: {
+ bidder: {
+ adbuzz: {
+ user: {
+ data: [configUserObj1, configUserObj2]
+ },
+ site: {
+ content: {
+ data: [configSiteObj1]
+ }
}
- }
- }
- }
- });
-
- config.setBidderConfig({
- bidders: ['pubvisage'],
- config: {
- ortb2: {
- user: {
- data: [configUserObj3]
},
- site: {
- content: {
- data: [configSiteObj2]
+ pubvisage: {
+ user: {
+ data: [configUserObj3]
+ },
+ site: {
+ content: {
+ data: [configSiteObj2]
+ }
}
}
}
}
- });
+ };
const rtdUserObj1 = {
name: 'www.dataprovider4.com',
@@ -365,12 +363,12 @@ describe('hadronRtdProvider', function() {
addRealTimeData(bidConfig, rtd, rtdConfig);
- let ortb2Config = config.getBidderConfig().adbuzz.ortb2;
+ let ortb2Config = bidConfig.ortb2Fragments.bidder.adbuzz;
expect(ortb2Config.user.data).to.deep.include.members([configUserObj1, configUserObj2, rtdUserObj1]);
expect(ortb2Config.site.content.data).to.deep.include.members([configSiteObj1, rtdSiteObj1]);
- ortb2Config = config.getBidderConfig().pubvisage.ortb2;
+ ortb2Config = bidConfig.ortb2Fragments.bidder.pubvisage;
expect(ortb2Config.user.data).to.deep.include.members([configUserObj3, rtdUserObj2]);
expect(ortb2Config.site.content.data).to.deep.include.members([configSiteObj2, rtdSiteObj2]);
@@ -378,7 +376,6 @@ describe('hadronRtdProvider', function() {
it('merges bidder-specific ortb2 data without duplication', function() {
let rtdConfig = {};
- let bidConfig = {};
const userObj1 = {
name: 'www.dataprovider1.com',
@@ -431,37 +428,32 @@ describe('hadronRtdProvider', function() {
]
};
- config.setBidderConfig({
- bidders: ['adbuzz'],
- config: {
- ortb2: {
- user: {
- data: [userObj1, userObj2]
- },
- site: {
- content: {
- data: [siteObj1]
+ let bidConfig = {
+ ortb2Fragments: {
+ bidder: {
+ adbuzz: {
+ user: {
+ data: [userObj1, userObj2]
+ },
+ site: {
+ content: {
+ data: [siteObj1]
+ }
}
- }
- }
- }
- });
-
- config.setBidderConfig({
- bidders: ['pubvisage'],
- config: {
- ortb2: {
- user: {
- data: [userObj3]
},
- site: {
- content: {
- data: [siteObj2]
+ pubvisage: {
+ user: {
+ data: [userObj3]
+ },
+ site: {
+ content: {
+ data: [siteObj2]
+ }
}
}
}
}
- });
+ };
const rtd = {
ortb2b: {
@@ -494,7 +486,7 @@ describe('hadronRtdProvider', function() {
addRealTimeData(bidConfig, rtd, rtdConfig);
- let ortb2Config = config.getBidderConfig().adbuzz.ortb2;
+ let ortb2Config = bidConfig.ortb2Fragments.bidder.adbuzz;
expect(ortb2Config.user.data).to.deep.include.members([userObj1]);
expect(ortb2Config.site.content.data).to.deep.include.members([siteObj1]);
@@ -502,7 +494,7 @@ describe('hadronRtdProvider', function() {
expect(ortb2Config.user.data).to.have.lengthOf(2);
expect(ortb2Config.site.content.data).to.have.lengthOf(1);
- ortb2Config = config.getBidderConfig().pubvisage.ortb2;
+ ortb2Config = bidConfig.ortb2Fragments.bidder.pubvisage;
expect(ortb2Config.user.data).to.deep.include.members([userObj3, userObj3]);
expect(ortb2Config.site.content.data).to.deep.include.members([siteObj1, siteObj2]);
@@ -647,7 +639,7 @@ describe('hadronRtdProvider', function() {
}
};
- const bidConfig = {};
+ const bidConfig = {ortb2Fragments: {global: {}}};
const rtdUserObj1 = {
name: 'www.dataprovider3.com',
@@ -676,9 +668,8 @@ describe('hadronRtdProvider', function() {
getDataFromLocalStorageStub.withArgs(RTD_LOCAL_NAME).returns(JSON.stringify(cachedRtd));
- expect(config.getConfig().ortb2).to.be.undefined;
getRealTimeData(bidConfig, () => {}, rtdConfig, {});
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj1]);
+ expect(bidConfig.ortb2Fragments.global.user.data).to.deep.include.members([rtdUserObj1]);
});
it('gets real-time data via async request', function() {
@@ -698,16 +689,6 @@ describe('hadronRtdProvider', function() {
]
}
- config.setConfig({
- ortb2: {
- site: {
- content: {
- data: [setConfigSiteObj1]
- }
- }
- }
- });
-
const rtdConfig = {
params: {
segmentCache: false,
@@ -718,7 +699,17 @@ describe('hadronRtdProvider', function() {
}
};
- let bidConfig = {};
+ let bidConfig = {
+ ortb2Fragments: {
+ global: {
+ site: {
+ content: {
+ data: [setConfigSiteObj1]
+ }
+ }
+ }
+ }
+ };
const rtdUserObj1 = {
name: 'www.audigent.com',
@@ -756,7 +747,7 @@ describe('hadronRtdProvider', function() {
request.respond(200, responseHeader, JSON.stringify(data));
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj1]);
+ expect(bidConfig.ortb2Fragments.global.user.data).to.deep.include.members([rtdUserObj1]);
});
});
});
diff --git a/test/spec/modules/haloIdSystem_spec.js b/test/spec/modules/haloIdSystem_spec.js
deleted file mode 100644
index 0b8fff12abe..00000000000
--- a/test/spec/modules/haloIdSystem_spec.js
+++ /dev/null
@@ -1,57 +0,0 @@
-import { haloIdSubmodule, storage } from 'modules/haloIdSystem.js';
-import { server } from 'test/mocks/xhr.js';
-import * as utils from 'src/utils.js';
-
-describe('HaloIdSystem', function () {
- describe('getId', function() {
- let getDataFromLocalStorageStub;
-
- beforeEach(function() {
- getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- });
-
- afterEach(function () {
- getDataFromLocalStorageStub.restore();
- });
-
- it('gets a haloId', function() {
- const config = {
- params: {}
- };
- const callbackSpy = sinon.spy();
- const callback = haloIdSubmodule.getId(config).callback;
- callback(callbackSpy);
- const request = server.requests[0];
- expect(request.url).to.eq(`https://id.halo.ad.gt/api/v1/pbhid`);
- request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ haloId: 'testHaloId1' }));
- expect(callbackSpy.lastCall.lastArg).to.deep.equal({haloId: 'testHaloId1'});
- });
-
- it('gets a cached haloid', function() {
- const config = {
- params: {}
- };
- getDataFromLocalStorageStub.withArgs('auHaloId').returns('tstCachedHaloId1');
-
- const callbackSpy = sinon.spy();
- const callback = haloIdSubmodule.getId(config).callback;
- callback(callbackSpy);
- expect(callbackSpy.lastCall.lastArg).to.deep.equal({haloId: 'tstCachedHaloId1'});
- });
-
- it('allows configurable id url', function() {
- const config = {
- params: {
- url: 'https://haloid.publync.com'
- }
- };
- const callbackSpy = sinon.spy();
- const callback = haloIdSubmodule.getId(config).callback;
- callback(callbackSpy);
- const request = server.requests[0];
- expect(request.url).to.eq('https://haloid.publync.com');
- request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ haloId: 'testHaloId1' }));
- expect(callbackSpy.lastCall.lastArg).to.deep.equal({haloId: 'testHaloId1'});
- });
- });
-});
diff --git a/test/spec/modules/haloRtdProvider_spec.js b/test/spec/modules/haloRtdProvider_spec.js
deleted file mode 100644
index 32c0338b87f..00000000000
--- a/test/spec/modules/haloRtdProvider_spec.js
+++ /dev/null
@@ -1,762 +0,0 @@
-import {config} from 'src/config.js';
-import {HALOID_LOCAL_NAME, RTD_LOCAL_NAME, addRealTimeData, getRealTimeData, haloSubmodule, storage} from 'modules/haloRtdProvider.js';
-import {server} from 'test/mocks/xhr.js';
-
-const responseHeader = {'Content-Type': 'application/json'};
-
-describe('haloRtdProvider', function() {
- let getDataFromLocalStorageStub;
-
- beforeEach(function() {
- config.resetConfig();
- getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- });
-
- afterEach(function () {
- getDataFromLocalStorageStub.restore();
- });
-
- describe('haloSubmodule', function() {
- it('successfully instantiates', function () {
- expect(haloSubmodule.init()).to.equal(true);
- });
- });
-
- describe('Add Real-Time Data', function() {
- it('merges ortb2 data', function() {
- let rtdConfig = {};
- let bidConfig = {};
-
- const setConfigUserObj1 = {
- name: 'www.dataprovider1.com',
- ext: { taxonomyname: 'iab_audience_taxonomy' },
- segment: [{
- id: '1776'
- }]
- };
-
- const setConfigUserObj2 = {
- name: 'www.dataprovider2.com',
- ext: { taxonomyname: 'iab_audience_taxonomy' },
- segment: [{
- id: '1914'
- }]
- };
-
- const setConfigSiteObj1 = {
- name: 'www.dataprovider3.com',
- ext: {
- taxonomyname: 'iab_audience_taxonomy'
- },
- segment: [
- {
- id: '1812'
- },
- {
- id: '1955'
- }
- ]
- }
-
- config.setConfig({
- ortb2: {
- user: {
- data: [setConfigUserObj1, setConfigUserObj2]
- },
- site: {
- content: {
- data: [setConfigSiteObj1]
- }
- }
- }
- });
-
- const rtdUserObj1 = {
- name: 'www.dataprovider4.com',
- ext: {
- taxonomyname: 'iab_audience_taxonomy'
- },
- segment: [
- {
- id: '1918'
- },
- {
- id: '1939'
- }
- ]
- };
-
- const rtdSiteObj1 = {
- name: 'www.dataprovider5.com',
- ext: {
- taxonomyname: 'iab_audience_taxonomy'
- },
- segment: [
- {
- id: '1945'
- },
- {
- id: '2003'
- }
- ]
- };
-
- const rtd = {
- ortb2: {
- user: {
- data: [rtdUserObj1]
- },
- site: {
- content: {
- data: [rtdSiteObj1]
- }
- }
- }
- };
-
- addRealTimeData(bidConfig, rtd, rtdConfig);
-
- let ortb2Config = config.getConfig().ortb2;
-
- expect(ortb2Config.user.data).to.deep.include.members([setConfigUserObj1, setConfigUserObj2, rtdUserObj1]);
- expect(ortb2Config.site.content.data).to.deep.include.members([setConfigSiteObj1, rtdSiteObj1]);
- });
-
- it('merges ortb2 data without duplication', function() {
- let rtdConfig = {};
- let bidConfig = {};
-
- const userObj1 = {
- name: 'www.dataprovider1.com',
- ext: { taxonomyname: 'iab_audience_taxonomy' },
- segment: [{
- id: '1776'
- }]
- };
-
- const userObj2 = {
- name: 'www.dataprovider2.com',
- ext: { taxonomyname: 'iab_audience_taxonomy' },
- segment: [{
- id: '1914'
- }]
- };
-
- const siteObj1 = {
- name: 'www.dataprovider3.com',
- ext: {
- taxonomyname: 'iab_audience_taxonomy'
- },
- segment: [
- {
- id: '1812'
- },
- {
- id: '1955'
- }
- ]
- }
-
- config.setConfig({
- ortb2: {
- user: {
- data: [userObj1, userObj2]
- },
- site: {
- content: {
- data: [siteObj1]
- }
- }
- }
- });
-
- const rtd = {
- ortb2: {
- user: {
- data: [userObj1]
- },
- site: {
- content: {
- data: [siteObj1]
- }
- }
- }
- };
-
- addRealTimeData(bidConfig, rtd, rtdConfig);
-
- let ortb2Config = config.getConfig().ortb2;
-
- expect(ortb2Config.user.data).to.deep.include.members([userObj1, userObj2]);
- expect(ortb2Config.site.content.data).to.deep.include.members([siteObj1]);
- expect(ortb2Config.user.data).to.have.lengthOf(2);
- expect(ortb2Config.site.content.data).to.have.lengthOf(1);
- });
-
- it('merges bidder-specific ortb2 data', function() {
- let rtdConfig = {};
- let bidConfig = {};
-
- const configUserObj1 = {
- name: 'www.dataprovider1.com',
- ext: { segtax: 3 },
- segment: [{
- id: '1776'
- }]
- };
-
- const configUserObj2 = {
- name: 'www.dataprovider2.com',
- ext: { segtax: 3 },
- segment: [{
- id: '1914'
- }]
- };
-
- const configUserObj3 = {
- name: 'www.dataprovider1.com',
- ext: { segtax: 3 },
- segment: [{
- id: '2003'
- }]
- };
-
- const configSiteObj1 = {
- name: 'www.dataprovider3.com',
- ext: {
- segtax: 1
- },
- segment: [
- {
- id: '1812'
- },
- {
- id: '1955'
- }
- ]
- };
-
- const configSiteObj2 = {
- name: 'www.dataprovider3.com',
- ext: {
- segtax: 1
- },
- segment: [
- {
- id: '1812'
- }
- ]
- };
-
- config.setBidderConfig({
- bidders: ['adbuzz'],
- config: {
- ortb2: {
- user: {
- data: [configUserObj1, configUserObj2]
- },
- site: {
- content: {
- data: [configSiteObj1]
- }
- }
- }
- }
- });
-
- config.setBidderConfig({
- bidders: ['pubvisage'],
- config: {
- ortb2: {
- user: {
- data: [configUserObj3]
- },
- site: {
- content: {
- data: [configSiteObj2]
- }
- }
- }
- }
- });
-
- const rtdUserObj1 = {
- name: 'www.dataprovider4.com',
- ext: {
- segtax: 501
- },
- segment: [
- {
- id: '1918'
- },
- {
- id: '1939'
- }
- ]
- };
-
- const rtdUserObj2 = {
- name: 'www.dataprovider2.com',
- ext: {
- segtax: 502
- },
- segment: [
- {
- id: '1939'
- }
- ]
- };
-
- const rtdSiteObj1 = {
- name: 'www.dataprovider5.com',
- ext: {
- segtax: 1
- },
- segment: [
- {
- id: '441'
- },
- {
- id: '442'
- }
- ]
- };
-
- const rtdSiteObj2 = {
- name: 'www.dataprovider6.com',
- ext: {
- segtax: 2
- },
- segment: [
- {
- id: '676'
- }
- ]
- };
-
- const rtd = {
- ortb2b: {
- adbuzz: {
- ortb2: {
- user: {
- data: [rtdUserObj1]
- },
- site: {
- content: {
- data: [rtdSiteObj1]
- }
- }
- }
- },
- pubvisage: {
- ortb2: {
- user: {
- data: [rtdUserObj2]
- },
- site: {
- content: {
- data: [rtdSiteObj2]
- }
- }
- }
- }
- }
- };
-
- addRealTimeData(bidConfig, rtd, rtdConfig);
-
- let ortb2Config = config.getBidderConfig().adbuzz.ortb2;
-
- expect(ortb2Config.user.data).to.deep.include.members([configUserObj1, configUserObj2, rtdUserObj1]);
- expect(ortb2Config.site.content.data).to.deep.include.members([configSiteObj1, rtdSiteObj1]);
-
- ortb2Config = config.getBidderConfig().pubvisage.ortb2;
-
- expect(ortb2Config.user.data).to.deep.include.members([configUserObj3, rtdUserObj2]);
- expect(ortb2Config.site.content.data).to.deep.include.members([configSiteObj2, rtdSiteObj2]);
- });
-
- it('merges bidder-specific ortb2 data without duplication', function() {
- let rtdConfig = {};
- let bidConfig = {};
-
- const userObj1 = {
- name: 'www.dataprovider1.com',
- ext: { segtax: 3 },
- segment: [{
- id: '1776'
- }]
- };
-
- const userObj2 = {
- name: 'www.dataprovider2.com',
- ext: { segtax: 3 },
- segment: [{
- id: '1914'
- }]
- };
-
- const userObj3 = {
- name: 'www.dataprovider1.com',
- ext: { segtax: 3 },
- segment: [{
- id: '2003'
- }]
- };
-
- const siteObj1 = {
- name: 'www.dataprovider3.com',
- ext: {
- segtax: 1
- },
- segment: [
- {
- id: '1812'
- },
- {
- id: '1955'
- }
- ]
- };
-
- const siteObj2 = {
- name: 'www.dataprovider3.com',
- ext: {
- segtax: 1
- },
- segment: [
- {
- id: '1812'
- }
- ]
- };
-
- config.setBidderConfig({
- bidders: ['adbuzz'],
- config: {
- ortb2: {
- user: {
- data: [userObj1, userObj2]
- },
- site: {
- content: {
- data: [siteObj1]
- }
- }
- }
- }
- });
-
- config.setBidderConfig({
- bidders: ['pubvisage'],
- config: {
- ortb2: {
- user: {
- data: [userObj3]
- },
- site: {
- content: {
- data: [siteObj2]
- }
- }
- }
- }
- });
-
- const rtd = {
- ortb2b: {
- adbuzz: {
- ortb2: {
- user: {
- data: [userObj1]
- },
- site: {
- content: {
- data: [siteObj1]
- }
- }
- }
- },
- pubvisage: {
- ortb2: {
- user: {
- data: [userObj2, userObj3]
- },
- site: {
- content: {
- data: [siteObj1, siteObj2]
- }
- }
- }
- }
- }
- };
-
- addRealTimeData(bidConfig, rtd, rtdConfig);
-
- let ortb2Config = config.getBidderConfig().adbuzz.ortb2;
-
- expect(ortb2Config.user.data).to.deep.include.members([userObj1]);
- expect(ortb2Config.site.content.data).to.deep.include.members([siteObj1]);
-
- expect(ortb2Config.user.data).to.have.lengthOf(2);
- expect(ortb2Config.site.content.data).to.have.lengthOf(1);
-
- ortb2Config = config.getBidderConfig().pubvisage.ortb2;
-
- expect(ortb2Config.user.data).to.deep.include.members([userObj3, userObj3]);
- expect(ortb2Config.site.content.data).to.deep.include.members([siteObj1, siteObj2]);
-
- expect(ortb2Config.user.data).to.have.lengthOf(2);
- expect(ortb2Config.site.content.data).to.have.lengthOf(2);
- });
-
- it('allows publisher defined rtd ortb2 logic', function() {
- const rtdConfig = {
- params: {
- handleRtd: function(bidConfig, rtd, rtdConfig, pbConfig) {
- if (rtd.ortb2.user.data[0].segment[0].id == '1776') {
- pbConfig.setConfig({ortb2: rtd.ortb2});
- } else {
- pbConfig.setConfig({ortb2: {}});
- }
- }
- }
- };
-
- let bidConfig = {};
-
- const rtdUserObj1 = {
- name: 'www.dataprovider.com',
- ext: { taxonomyname: 'iab_audience_taxonomy' },
- segment: [{
- id: '1776'
- }]
- };
-
- let rtd = {
- ortb2: {
- user: {
- data: [rtdUserObj1]
- }
- }
- };
-
- config.resetConfig();
-
- let pbConfig = config.getConfig();
- addRealTimeData(bidConfig, rtd, rtdConfig);
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj1]);
-
- const rtdUserObj2 = {
- name: 'www.audigent.com',
- ext: {
- segtax: '1',
- taxprovider: '1'
- },
- segment: [{
- id: 'pubseg1'
- }]
- };
-
- rtd = {
- ortb2: {
- user: {
- data: [rtdUserObj2]
- }
- }
- };
-
- config.resetConfig();
-
- pbConfig = config.getConfig();
- addRealTimeData(bidConfig, rtd, rtdConfig);
- expect(config.getConfig().ortb2).to.deep.equal({});
- });
-
- it('allows publisher defined adunit logic', function() {
- const rtdConfig = {
- params: {
- handleRtd: function(bidConfig, rtd, rtdConfig, pbConfig) {
- var adUnits = bidConfig.adUnits;
- for (var i = 0; i < adUnits.length; i++) {
- var adUnit = adUnits[i];
- for (var j = 0; j < adUnit.bids.length; j++) {
- var bid = adUnit.bids[j];
- if (bid.bidder == 'adBuzz') {
- for (var k = 0; k < rtd.adBuzz.length; k++) {
- bid.adBuzzData.segments.adBuzz.push(rtd.adBuzz[k]);
- }
- } else if (bid.bidder == 'trueBid') {
- for (var k = 0; k < rtd.trueBid.length; k++) {
- bid.trueBidSegments.push(rtd.trueBid[k]);
- }
- }
- }
- }
- }
- }
- };
-
- let bidConfig = {
- adUnits: [
- {
- bids: [
- {
- bidder: 'adBuzz',
- adBuzzData: {
- segments: {
- adBuzz: [
- {
- id: 'adBuzzSeg1'
- }
- ]
- }
- }
- },
- {
- bidder: 'trueBid',
- trueBidSegments: []
- }
- ]
- }
- ]
- };
-
- const rtd = {
- adBuzz: [{id: 'adBuzzSeg2'}, {id: 'adBuzzSeg3'}],
- trueBid: [{id: 'truebidSeg1'}, {id: 'truebidSeg2'}, {id: 'truebidSeg3'}]
- };
-
- addRealTimeData(bidConfig, rtd, rtdConfig);
-
- expect(bidConfig.adUnits[0].bids[0].adBuzzData.segments.adBuzz[0].id).to.equal('adBuzzSeg1');
- expect(bidConfig.adUnits[0].bids[0].adBuzzData.segments.adBuzz[1].id).to.equal('adBuzzSeg2');
- expect(bidConfig.adUnits[0].bids[0].adBuzzData.segments.adBuzz[2].id).to.equal('adBuzzSeg3');
- expect(bidConfig.adUnits[0].bids[1].trueBidSegments[0].id).to.equal('truebidSeg1');
- expect(bidConfig.adUnits[0].bids[1].trueBidSegments[1].id).to.equal('truebidSeg2');
- expect(bidConfig.adUnits[0].bids[1].trueBidSegments[2].id).to.equal('truebidSeg3');
- });
- });
-
- describe('Get Real-Time Data', function() {
- it('gets rtd from local storage cache', function() {
- const rtdConfig = {
- params: {
- segmentCache: true
- }
- };
-
- const bidConfig = {};
-
- const rtdUserObj1 = {
- name: 'www.dataprovider3.com',
- ext: {
- taxonomyname: 'iab_audience_taxonomy'
- },
- segment: [
- {
- id: '1918'
- },
- {
- id: '1939'
- }
- ]
- };
-
- const cachedRtd = {
- rtd: {
- ortb2: {
- user: {
- data: [rtdUserObj1]
- }
- }
- }
- };
-
- getDataFromLocalStorageStub.withArgs(RTD_LOCAL_NAME).returns(JSON.stringify(cachedRtd));
-
- expect(config.getConfig().ortb2).to.be.undefined;
- getRealTimeData(bidConfig, () => {}, rtdConfig, {});
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj1]);
- });
-
- it('gets real-time data via async request', function() {
- const setConfigSiteObj1 = {
- name: 'www.audigent.com',
- ext: {
- segtax: '1',
- taxprovider: '1'
- },
- segment: [
- {
- id: 'pubseg1'
- },
- {
- id: 'pubseg2'
- }
- ]
- }
-
- config.setConfig({
- ortb2: {
- site: {
- content: {
- data: [setConfigSiteObj1]
- }
- }
- }
- });
-
- const rtdConfig = {
- params: {
- segmentCache: false,
- usePubHalo: true,
- requestParams: {
- publisherId: 'testPub1'
- }
- }
- };
-
- let bidConfig = {};
-
- const rtdUserObj1 = {
- name: 'www.audigent.com',
- ext: {
- segtax: '1',
- taxprovider: '1'
- },
- segment: [
- {
- id: 'pubseg1'
- },
- {
- id: 'pubseg2'
- }
- ]
- };
-
- const data = {
- rtd: {
- ortb2: {
- user: {
- data: [rtdUserObj1]
- }
- }
- }
- };
-
- getDataFromLocalStorageStub.withArgs(HALOID_LOCAL_NAME).returns('testHaloId1');
- getRealTimeData(bidConfig, () => {}, rtdConfig, {});
-
- let request = server.requests[0];
- let postData = JSON.parse(request.requestBody);
- expect(postData.config).to.have.deep.property('publisherId', 'testPub1');
- expect(postData.userIds).to.have.deep.property('haloId', 'testHaloId1');
-
- request.respond(200, responseHeader, JSON.stringify(data));
-
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj1]);
- });
- });
-});
diff --git a/test/spec/modules/hybridBidAdapter_spec.js b/test/spec/modules/hybridBidAdapter_spec.js
index ffbc27293fb..6c98264c06f 100644
--- a/test/spec/modules/hybridBidAdapter_spec.js
+++ b/test/spec/modules/hybridBidAdapter_spec.js
@@ -15,7 +15,7 @@ function getSlotConfigs(mediaTypes, params) {
describe('Hybrid.ai Adapter', function() {
const PLACE_ID = '5af45ad34d506ee7acad0c26';
const bidderRequest = {
- refererInfo: { referer: 'referer' }
+ refererInfo: { page: 'referer' }
}
const bannerMandatoryParams = {
placeId: PLACE_ID,
diff --git a/test/spec/modules/idWardRtdProvider_spec.js b/test/spec/modules/idWardRtdProvider_spec.js
index 949365baec6..924a3794c7b 100644
--- a/test/spec/modules/idWardRtdProvider_spec.js
+++ b/test/spec/modules/idWardRtdProvider_spec.js
@@ -45,7 +45,11 @@ describe('idWardRtdProvider', function() {
}
};
- const bidConfig = {};
+ const bidConfig = {
+ ortb2Fragments: {
+ global: {}
+ }
+ };
const rtdUserObj1 = {
name: 'id-ward.com',
@@ -65,9 +69,8 @@ describe('idWardRtdProvider', function() {
getDataFromLocalStorageStub.withArgs('cohort_ids')
.returns(JSON.stringify(['TCZPQOWPEJG3MJOTUQUF793A', '93SUG3H540WBJMYNT03KX8N3']));
- expect(config.getConfig().ortb2).to.be.undefined;
getRealTimeData(bidConfig, () => {}, rtdConfig, {});
- expect(config.getConfig().ortb2.user.data).to.deep.include.members([rtdUserObj1]);
+ expect(bidConfig.ortb2Fragments.global.user.data).to.deep.include.members([rtdUserObj1]);
});
it('do not set rtd if local storage empty', function() {
diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js
index b6e5ab86de5..b44859f73a0 100644
--- a/test/spec/modules/improvedigitalBidAdapter_spec.js
+++ b/test/spec/modules/improvedigitalBidAdapter_spec.js
@@ -141,7 +141,8 @@ describe('Improve Digital Adapter Tests', function () {
const bidderRequestReferrer = {
bids: [simpleBidRequest],
refererInfo: {
- referer: 'https://blah.com/test.html',
+ page: 'https://blah.com/test.html',
+ domain: 'blah.com'
},
};
@@ -273,7 +274,7 @@ describe('Improve Digital Adapter Tests', function () {
});
it('should make a well-formed native request', function () {
- const payload = JSON.parse(spec.buildRequests([nativeBidRequest])[0].data);
+ const payload = JSON.parse(spec.buildRequests([nativeBidRequest], {})[0].data);
expect(payload.imp[0].native).to.deep.equal({
ver: '1.2',
request: '{\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":3,\"required\":1,\"data\":{\"type\":2}}]}'
@@ -283,19 +284,19 @@ describe('Improve Digital Adapter Tests', function () {
it('should not make native request when nativeParams is undefined', function () {
const request = deepClone(nativeBidRequest);
delete request.nativeParams;
- const payload = JSON.parse(spec.buildRequests([request])[0].data);
+ const payload = JSON.parse(spec.buildRequests([request], {})[0].data);
expect(payload.imp[0].native).to.not.exist;
});
it('should not make native request when no assets', function () {
const request = deepClone(nativeBidRequest);
request.nativeParams = {};
- const payload = JSON.parse(spec.buildRequests([request])[0].data);
+ const payload = JSON.parse(spec.buildRequests([request], {})[0].data);
expect(payload.imp[0].native).to.not.exist;
});
it('should make a well-formed native request', function () {
- const payload = JSON.parse(spec.buildRequests([nativeBidRequest])[0].data);
+ const payload = JSON.parse(spec.buildRequests([nativeBidRequest], {})[0].data);
expect(payload.imp[0].native).to.deep.equal({
ver: '1.2',
request: '{\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":3,\"required\":1,\"data\":{\"type\":2}}]}'
@@ -305,14 +306,14 @@ describe('Improve Digital Adapter Tests', function () {
it('should not make native request when nativeParams is undefined', function () {
const request = deepClone(nativeBidRequest);
delete request.nativeParams;
- const payload = JSON.parse(spec.buildRequests([request])[0].data);
+ const payload = JSON.parse(spec.buildRequests([request], {})[0].data);
expect(payload.imp[0].native).to.not.exist;
});
it('should not make native request when no assets', function () {
const request = deepClone(nativeBidRequest);
request.nativeParams = {};
- const payload = JSON.parse(spec.buildRequests([request])[0].data);
+ const payload = JSON.parse(spec.buildRequests([request], {})[0].data);
expect(payload.imp[0].native).to.not.exist;
});
@@ -493,7 +494,7 @@ describe('Improve Digital Adapter Tests', function () {
skipafter: 30
}
bidRequest.params.video = videoTest;
- let request = spec.buildRequests([bidRequest])[0];
+ let request = spec.buildRequests([bidRequest], {})[0];
let payload = JSON.parse(request.data);
expect(payload.imp[0].video.skip).to.equal(1);
expect(payload.imp[0].video.skipmin).to.equal(5);
@@ -502,7 +503,7 @@ describe('Improve Digital Adapter Tests', function () {
// 0 - leave out skipmin and skipafter
videoTest.skip = 0;
bidRequest.params.video = videoTest;
- request = spec.buildRequests([bidRequest])[0];
+ request = spec.buildRequests([bidRequest], {})[0];
payload = JSON.parse(request.data);
expect(payload.imp[0].video.skip).to.equal(0);
expect(payload.imp[0].video.skipmin).to.not.exist;
@@ -511,7 +512,7 @@ describe('Improve Digital Adapter Tests', function () {
// other
videoTest.skip = 'blah';
bidRequest.params.video = videoTest;
- request = spec.buildRequests([bidRequest])[0];
+ request = spec.buildRequests([bidRequest], {})[0];
payload = JSON.parse(request.data);
expect(payload.imp[0].video.skip).to.not.exist;
expect(payload.imp[0].video.skipmin).to.not.exist;
@@ -529,7 +530,7 @@ describe('Improve Digital Adapter Tests', function () {
const videoTestInvParam = Object.assign({}, videoTest);
videoTestInvParam.blah = 1;
bidRequest.params.video = videoTestInvParam;
- let request = spec.buildRequests([bidRequest])[0];
+ let request = spec.buildRequests([bidRequest], {})[0];
let payload = JSON.parse(request.data);
expect(payload.imp[0].video.blah).not.to.exist;
});
@@ -537,7 +538,7 @@ describe('Improve Digital Adapter Tests', function () {
it('should set video params for outstream', function() {
const bidRequest = deepClone(outstreamBidRequest);
bidRequest.params.video = videoParams;
- const request = spec.buildRequests([bidRequest])[0];
+ const request = spec.buildRequests([bidRequest], {})[0];
const payload = JSON.parse(request.data);
expect(payload.imp[0].video).to.deep.equal({...{
mimes: ['video/mp4'],
@@ -551,7 +552,7 @@ describe('Improve Digital Adapter Tests', function () {
it('should set video params for multi-format', function() {
const bidRequest = deepClone(multiFormatBidRequest);
bidRequest.params.video = videoParams;
- const request = spec.buildRequests([bidRequest])[0];
+ const request = spec.buildRequests([bidRequest], {})[0];
const payload = JSON.parse(request.data);
const testVideoParams = Object.assign({
placement: OUTSTREAM_TYPE,
@@ -696,9 +697,8 @@ describe('Improve Digital Adapter Tests', function () {
});
it('should not set site when app is defined in FPD', function () {
- getConfigStub = sinon.stub(config, 'getConfig');
- getConfigStub.withArgs('ortb2.app').returns({ content: 'XYZ' });
- let request = spec.buildRequests([simpleBidRequest], bidderRequest)[0];
+ const ortb2 = {app: {content: 'XYZ'}};
+ let request = spec.buildRequests([simpleBidRequest], {...bidderRequest, ortb2})[0];
let payload = JSON.parse(request.data);
expect(payload.site).does.not.exist;
expect(payload.app).does.exist;
@@ -735,32 +735,14 @@ describe('Improve Digital Adapter Tests', function () {
expect(payload.site.page).does.exist.and.equal('https://blah.com/test.html');
expect(payload.site.domain).does.exist.and.equal('blah.com');
- getConfigStub.withArgs('ortb2.site').returns({
- content: 'ZZZ',
- });
- request = spec.buildRequests([simpleBidRequest], bidderRequestReferrer)[0];
+ const ortb2 = {site: {content: 'ZZZ'}};
+ request = spec.buildRequests([simpleBidRequest], {...bidderRequestReferrer, ortb2})[0];
payload = JSON.parse(request.data);
expect(payload.site.content).does.exist.and.equal('ZZZ');
expect(payload.site.page).does.exist.and.equal('https://blah.com/test.html');
expect(payload.site.domain).does.exist.and.equal('blah.com');
});
- it('should set pageUrl as site param', function () {
- getConfigStub = sinon.stub(config, 'getConfig');
- getConfigStub.withArgs('pageUrl').returns('https://improvidigital.com/test-page');
- let request = spec.buildRequests([simpleBidRequest], bidderRequestReferrer)[0];
- let payload = JSON.parse(request.data);
- expect(payload.site.page).does.exist.and.equal('https://improvidigital.com/test-page');
- expect(payload.site.domain).does.exist.and.equal('improvidigital.com');
- getConfigStub.reset();
-
- getConfigStub.withArgs('pageUrl').returns(undefined);
- request = spec.buildRequests([simpleBidRequest], bidderRequestReferrer)[0];
- payload = JSON.parse(request.data);
- expect(payload.site.page).does.exist.and.equal('https://blah.com/test.html');
- expect(payload.site.domain).does.exist.and.equal('blah.com');
- });
-
it('should set site when app not available', function () {
getConfigStub = sinon.stub(config, 'getConfig');
getConfigStub.withArgs('app').returns(undefined);
@@ -1346,7 +1328,7 @@ describe('Improve Digital Adapter Tests', function () {
it('should return iframe user sync for the adunit extend mode if iframe mode enabled', function () {
// buildRequests() sets spec.syncStore vars
- spec.buildRequests([simpleBidRequest, extendBidRequest]);
+ spec.buildRequests([simpleBidRequest, extendBidRequest], {});
const syncs = spec.getUserSyncs({ iframeEnabled: true, pixelEnabled: true }, serverResponses);
expect(syncs).to.deep.equal([{ type: 'iframe', url: basicIframeSyncUrl + '&pbs=1' }]);
});
@@ -1355,7 +1337,7 @@ describe('Improve Digital Adapter Tests', function () {
getConfigStub = sinon.stub(config, 'getConfig');
getConfigStub.withArgs('improvedigital.extend').returns(true);
// buildRequests() sets spec.syncStore vars
- spec.buildRequests([simpleBidRequest]);
+ spec.buildRequests([simpleBidRequest], {});
const syncs = spec.getUserSyncs({ iframeEnabled: true, pixelEnabled: true }, serverResponses);
expect(syncs).to.deep.equal([{ type: 'iframe', url: basicIframeSyncUrl + '&pbs=1' }]);
});
diff --git a/test/spec/modules/incrxBidAdapter_spec.js b/test/spec/modules/incrxBidAdapter_spec.js
index da90cf181f3..8fb95742766 100644
--- a/test/spec/modules/incrxBidAdapter_spec.js
+++ b/test/spec/modules/incrxBidAdapter_spec.js
@@ -35,7 +35,7 @@ describe('IncrementX', function () {
describe('buildRequests', function () {
let bidderRequest = {
refererInfo: {
- referer: 'https://www.test.com',
+ page: 'https://www.test.com',
reachedTop: true,
isAmp: false,
numIframes: 0,
diff --git a/test/spec/modules/inmarBidAdapter_spec.js b/test/spec/modules/inmarBidAdapter_spec.js
index 998fe20d369..d21fcbc377b 100644
--- a/test/spec/modules/inmarBidAdapter_spec.js
+++ b/test/spec/modules/inmarBidAdapter_spec.js
@@ -108,8 +108,10 @@ describe('Inmar adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
- numIframes: 0
+ legacy: {
+ referer: 'https://domain.com',
+ numIframes: 0
+ }
}
});
diff --git a/test/spec/modules/innityBidAdapter_spec.js b/test/spec/modules/innityBidAdapter_spec.js
index d4a28ec2100..192ab4911ee 100644
--- a/test/spec/modules/innityBidAdapter_spec.js
+++ b/test/spec/modules/innityBidAdapter_spec.js
@@ -39,7 +39,7 @@ describe('innityAdapterTest', () => {
let bidderRequest = {
refererInfo: {
- referer: 'https://refererExample.com'
+ page: 'https://refererExample.com'
}
};
diff --git a/test/spec/modules/insticatorBidAdapter_spec.js b/test/spec/modules/insticatorBidAdapter_spec.js
index 211addaf626..e05033d67a6 100644
--- a/test/spec/modules/insticatorBidAdapter_spec.js
+++ b/test/spec/modules/insticatorBidAdapter_spec.js
@@ -81,7 +81,9 @@ describe('InsticatorBidAdapter', function () {
refererInfo: {
numIframes: 0,
reachedTop: true,
- referer: 'https://example.com',
+ page: 'https://example.com',
+ domain: 'example.com',
+ ref: 'https://referrer.com',
stack: ['https://example.com']
},
};
@@ -236,7 +238,7 @@ describe('InsticatorBidAdapter', function () {
expect(data.site).to.be.an('object');
expect(data.site.domain).not.to.be.empty;
expect(data.site.page).not.to.be.empty;
- expect(data.site.ref).to.equal(bidderRequest.refererInfo.referer);
+ expect(data.site.ref).to.equal(bidderRequest.refererInfo.ref);
expect(data.device).to.be.an('object');
expect(data.device.w).to.equal(window.innerWidth);
expect(data.device.h).to.equal(window.innerHeight);
diff --git a/test/spec/modules/invibesBidAdapter_spec.js b/test/spec/modules/invibesBidAdapter_spec.js
index 39d6271606a..971af98411f 100644
--- a/test/spec/modules/invibesBidAdapter_spec.js
+++ b/test/spec/modules/invibesBidAdapter_spec.js
@@ -107,6 +107,11 @@ describe('invibesBidAdapter:', function () {
beforeEach(function () {
resetInvibes();
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ invibes: {
+ storageAllowed: true
+ }
+ };
document.cookie = '';
this.cStub1 = sinon.stub(console, 'info');
});
diff --git a/test/spec/modules/ipromBidAdapter_spec.js b/test/spec/modules/ipromBidAdapter_spec.js
index a3310a33cc2..bb2f364bece 100644
--- a/test/spec/modules/ipromBidAdapter_spec.js
+++ b/test/spec/modules/ipromBidAdapter_spec.js
@@ -29,13 +29,15 @@ describe('iPROM Adapter', function () {
bidderRequest = {
timeout: 3000,
refererInfo: {
- referer: 'https://adserver.si/index.html',
- reachedTop: true,
- numIframes: 1,
- stack: [
- 'https://adserver.si/index.html',
- 'https://adserver.si/iframe1.html',
- ]
+ legacy: {
+ referer: 'https://adserver.si/index.html',
+ reachedTop: true,
+ numIframes: 1,
+ stack: [
+ 'https://adserver.si/index.html',
+ 'https://adserver.si/iframe1.html',
+ ]
+ }
}
}
});
diff --git a/test/spec/modules/iqmBidAdapter_spec.js b/test/spec/modules/iqmBidAdapter_spec.js
index 27693937330..2f8b5811b2f 100644
--- a/test/spec/modules/iqmBidAdapter_spec.js
+++ b/test/spec/modules/iqmBidAdapter_spec.js
@@ -101,7 +101,7 @@ describe('iqmAdapter', function () {
bidfloor: 0.5},
crumbs: {
pubcid: 'a0f51f64-6d86-41d0-abaf-7ece71404d94'},
- fpd: {'context': {'pbAdSlot': '/19968336/header-bid-tag-0'}},
+ ortb2Imp: {ext: {data: {'pbadslot': '/19968336/header-bid-tag-0'}}},
mediaTypes: {
banner: {
sizes: [[300, 250]]}},
@@ -116,7 +116,41 @@ describe('iqmAdapter', function () {
bidderRequestsCount: 1,
bidderWinsCount: 0}];
- let bidderRequest = {bidderCode: 'iqm', auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f', bidderRequestId: '13c05d264c7ffe', bids: [{bidder: 'iqm', params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5}, crumbs: {pubcid: 'a0f51f64-6d86-41d0-abaf-7ece71404d94'}, fpd: {context: {pbAdSlot: '/19968336/header-bid-tag-0'}}, mediaTypes: {banner: {sizes: [[300, 250]]}}, adUnitCode: '/19968336/header-bid-tag-0', transactionId: '56fe8d92-ff6e-4c34-90ad-2f743cd0eae8', sizes: [[300, 250]], bidId: '266d810da21904', bidderRequestId: '13c05d264c7ffe', auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f', src: 'client', bidRequestsCount: 1, bidderRequestsCount: 1, bidderWinsCount: 0}], auctionStart: 1615205942159, timeout: 7000, refererInfo: {referer: 'http://test.localhost:9999/integrationExamples/gpt/hello_world.html', reachedTop: true, isAmp: false, numIframes: 0, stack: ['http://test.localhost:9999/integrationExamples/gpt/hello_world.html'], canonicalUrl: null}, start: 1615205942162};
+ let bidderRequest = {
+ bidderCode: 'iqm',
+ auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f',
+ bidderRequestId: '13c05d264c7ffe',
+ bids: [{
+ bidder: 'iqm',
+ params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5},
+ crumbs: {pubcid: 'a0f51f64-6d86-41d0-abaf-7ece71404d94'},
+ ortb2Imp: {ext: {data: {'pbadslot': '/19968336/header-bid-tag-0'}}},
+ mediaTypes: {banner: {sizes: [[300, 250]]}},
+ adUnitCode: '/19968336/header-bid-tag-0',
+ transactionId: '56fe8d92-ff6e-4c34-90ad-2f743cd0eae8',
+ sizes: [[300, 250]],
+ bidId: '266d810da21904',
+ bidderRequestId: '13c05d264c7ffe',
+ auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f',
+ src: 'client',
+ bidRequestsCount: 1,
+ bidderRequestsCount: 1,
+ bidderWinsCount: 0
+ }],
+ auctionStart: 1615205942159,
+ timeout: 7000,
+ refererInfo: {
+ page: 'http://test.localhost:9999/integrationExamples/gpt/hello_world.html',
+ domain: 'test.localhost.com:9999',
+ ref: null,
+ reachedTop: true,
+ isAmp: false,
+ numIframes: 0,
+ stack: ['http://test.localhost:9999/integrationExamples/gpt/hello_world.html'],
+ canonicalUrl: null
+ },
+ start: 1615205942162
+ };
it('should parse out sizes', function () {
let temp = [];
@@ -141,8 +175,80 @@ describe('iqmAdapter', function () {
expect(request[0].method).to.equal('POST');
});
it('should attach valid video params to the tag', function () {
- let validBidRequests_video = [{bidder: 'iqm', params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5, video: {placement: 2, mimes: ['video/mp4'], protocols: [2, 5], skipppable: true, playback_method: ['auto_play_sound_off']}}, crumbs: {pubcid: '09b8f065-9d1b-4a36-bd0c-ea22e2dad807'}, fpd: {context: {pbAdSlot: 'video1'}}, mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}}, adUnitCode: 'video1', transactionId: '86795c66-acf9-4dd5-998f-6d5362aaa541', sizes: [[640, 480]], bidId: '28bfb7e2d12897', bidderRequestId: '16e1ce8481bc6d', auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71', src: 'client', bidRequestsCount: 1, bidderRequestsCount: 1, bidderWinsCount: 0}];
- let bidderRequest_video = {bidderCode: 'iqm', auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71', bidderRequestId: '16e1ce8481bc6d', bids: [{bidder: 'iqm', params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5, video: {placement: 2, mimes: ['video/mp4'], protocols: [2, 5], skipppable: true, playback_method: ['auto_play_sound_off']}}, crumbs: {pubcid: '09b8f065-9d1b-4a36-bd0c-ea22e2dad807'}, fpd: {context: {pbAdSlot: 'video1'}}, mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}}, adUnitCode: 'video1', transactionId: '86795c66-acf9-4dd5-998f-6d5362aaa541', sizes: [[640, 480]], bidId: '28bfb7e2d12897', bidderRequestId: '16e1ce8481bc6d', auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71', src: 'client', bidRequestsCount: 1, bidderRequestsCount: 1, bidderWinsCount: 0}], auctionStart: 1615271191985, timeout: 3000, refererInfo: {referer: 'http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html', reachedTop: true, isAmp: false, numIframes: 0, stack: ['http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html'], canonicalUrl: null}, start: 1615271191988};
+ let validBidRequests_video = [{
+ bidder: 'iqm',
+ params: {
+ publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a',
+ placementId: 23451,
+ bidfloor: 0.5,
+ video: {
+ placement: 2,
+ mimes: ['video/mp4'],
+ protocols: [2, 5],
+ skipppable: true,
+ playback_method: ['auto_play_sound_off']
+ }
+ },
+ crumbs: {pubcid: '09b8f065-9d1b-4a36-bd0c-ea22e2dad807'},
+ ortb2Imp: {ext: {data: {'pbadslot': 'video1'}}},
+ mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}},
+ adUnitCode: 'video1',
+ transactionId: '86795c66-acf9-4dd5-998f-6d5362aaa541',
+ sizes: [[640, 480]],
+ bidId: '28bfb7e2d12897',
+ bidderRequestId: '16e1ce8481bc6d',
+ auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71',
+ src: 'client',
+ bidRequestsCount: 1,
+ bidderRequestsCount: 1,
+ bidderWinsCount: 0
+ }];
+ let bidderRequest_video = {
+ bidderCode: 'iqm',
+ auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71',
+ bidderRequestId: '16e1ce8481bc6d',
+ bids: [{
+ bidder: 'iqm',
+ params: {
+ publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a',
+ placementId: 23451,
+ bidfloor: 0.5,
+ video: {
+ placement: 2,
+ mimes: ['video/mp4'],
+ protocols: [2, 5],
+ skipppable: true,
+ playback_method: ['auto_play_sound_off']
+ }
+ },
+ crumbs: {pubcid: '09b8f065-9d1b-4a36-bd0c-ea22e2dad807'},
+ fpd: {context: {pbAdSlot: 'video1'}},
+ mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}},
+ adUnitCode: 'video1',
+ transactionId: '86795c66-acf9-4dd5-998f-6d5362aaa541',
+ sizes: [[640, 480]],
+ bidId: '28bfb7e2d12897',
+ bidderRequestId: '16e1ce8481bc6d',
+ auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71',
+ src: 'client',
+ bidRequestsCount: 1,
+ bidderRequestsCount: 1,
+ bidderWinsCount: 0
+ }],
+ auctionStart: 1615271191985,
+ timeout: 3000,
+ refererInfo: {
+ page: 'http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html',
+ domain: 'test.localhost.com:9999',
+ ref: null,
+ reachedTop: true,
+ isAmp: false,
+ numIframes: 0,
+ stack: ['http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html'],
+ canonicalUrl: null
+ },
+ start: 1615271191988
+ };
const request = spec.buildRequests(validBidRequests_video, bidderRequest_video);
const payload = request[0].data;
expect(payload.imp.id).to.exist;
@@ -161,11 +267,13 @@ describe('iqmAdapter', function () {
});
it('should add referer info to payload', function () {
+ // TODO: this is wrong on multiple levels
+ // The payload contains everything in `bidderRequest`; that is sometimes not even serializable
+ // this should not be testing the validity of internal Prebid structures
const request = spec.buildRequests(validBidRequests, bidderRequest);
const payload = request[0].data;
expect(payload.bidderRequest.refererInfo).to.exist;
- expect(payload.bidderRequest.refererInfo).to.deep.equal({referer: 'http://test.localhost:9999/integrationExamples/gpt/hello_world.html', reachedTop: true, isAmp: false, numIframes: 0, stack: ['http://test.localhost:9999/integrationExamples/gpt/hello_world.html'], canonicalUrl: null});
});
})
@@ -179,7 +287,7 @@ describe('iqmAdapter', function () {
bidfloor: 0.5},
crumbs: {
pubcid: 'a0f51f64-6d86-41d0-abaf-7ece71404d94'},
- fpd: {'context': {'pbAdSlot': '/19968336/header-bid-tag-0'}},
+ ortb2Imp: {ext: {data: {'pbadslot': '/19968336/header-bid-tag-0'}}},
mediaTypes: {
banner: {
sizes: [[300, 250]]}},
@@ -193,7 +301,41 @@ describe('iqmAdapter', function () {
bidRequestsCount: 1,
bidderRequestsCount: 1,
bidderWinsCount: 0}];
- let bidderRequest = {bidderCode: 'iqm', auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f', bidderRequestId: '13c05d264c7ffe', bids: [{bidder: 'iqm', params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5}, crumbs: {pubcid: 'a0f51f64-6d86-41d0-abaf-7ece71404d94'}, fpd: {context: {pbAdSlot: '/19968336/header-bid-tag-0'}}, mediaTypes: {banner: {sizes: [[300, 250]]}}, adUnitCode: '/19968336/header-bid-tag-0', transactionId: '56fe8d92-ff6e-4c34-90ad-2f743cd0eae8', sizes: [[300, 250]], bidId: '266d810da21904', bidderRequestId: '13c05d264c7ffe', auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f', src: 'client', bidRequestsCount: 1, bidderRequestsCount: 1, bidderWinsCount: 0}], auctionStart: 1615205942159, timeout: 7000, refererInfo: {referer: 'http://test.localhost:9999/integrationExamples/gpt/hello_world.html', reachedTop: true, isAmp: false, numIframes: 0, stack: ['http://test.localhost:9999/integrationExamples/gpt/hello_world.html'], canonicalUrl: null}, start: 1615205942162};
+ let bidderRequest = {
+ bidderCode: 'iqm',
+ auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f',
+ bidderRequestId: '13c05d264c7ffe',
+ bids: [{
+ bidder: 'iqm',
+ params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5},
+ crumbs: {pubcid: 'a0f51f64-6d86-41d0-abaf-7ece71404d94'},
+ ortb2Imp: {ext: {data: {'pbadslot': '/19968336/header-bid-tag-0'}}},
+ mediaTypes: {banner: {sizes: [[300, 250]]}},
+ adUnitCode: '/19968336/header-bid-tag-0',
+ transactionId: '56fe8d92-ff6e-4c34-90ad-2f743cd0eae8',
+ sizes: [[300, 250]],
+ bidId: '266d810da21904',
+ bidderRequestId: '13c05d264c7ffe',
+ auctionId: '565ab569-ab95-40d6-8b42-b9707a92062f',
+ src: 'client',
+ bidRequestsCount: 1,
+ bidderRequestsCount: 1,
+ bidderWinsCount: 0
+ }],
+ auctionStart: 1615205942159,
+ timeout: 7000,
+ refererInfo: {
+ page: 'http://test.localhost:9999/integrationExamples/gpt/hello_world.html',
+ domain: 'test.localhost.com:9999',
+ ref: null,
+ reachedTop: true,
+ isAmp: false,
+ numIframes: 0,
+ stack: ['http://test.localhost:9999/integrationExamples/gpt/hello_world.html'],
+ canonicalUrl: null
+ },
+ start: 1615205942162
+ };
let response = {
id: '5bdbab92aae961cfbdf7465d',
@@ -213,7 +355,52 @@ describe('iqmAdapter', function () {
let validBidRequests_temp_video =
[{bidder: 'iqm', params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5, video: {placement: 2, mimes: ['video/mp4'], protocols: [2, 5], skipppable: true, playback_method: ['auto_play_sound_off']}}, crumbs: {pubcid: 'cd86c3ff-d630-40e6-83ab-420e9e800594'}, fpd: {context: {pbAdSlot: 'video1'}}, mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}}, adUnitCode: 'video1', transactionId: '8335b266-7a41-45f9-86a2-92fdc7cf0cd9', sizes: [[640, 480]], bidId: '26274beff25455', bidderRequestId: '17c5d8c3168761', auctionId: '2c592dcf-7dfc-4823-8203-dd1ebab77fe0', src: 'client', bidRequestsCount: 1, bidderRequestsCount: 1, bidderWinsCount: 0}];
- let bidderRequest_video = {bidderCode: 'iqm', auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71', bidderRequestId: '16e1ce8481bc6d', bids: [{bidder: 'iqm', params: {publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a', placementId: 23451, bidfloor: 0.5, video: {placement: 2, mimes: ['video/mp4'], protocols: [2, 5], skipppable: true, playback_method: ['auto_play_sound_off']}}, crumbs: {pubcid: '09b8f065-9d1b-4a36-bd0c-ea22e2dad807'}, fpd: {context: {pbAdSlot: 'video1'}}, mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}}, adUnitCode: 'video1', transactionId: '86795c66-acf9-4dd5-998f-6d5362aaa541', sizes: [[640, 480]], bidId: '28bfb7e2d12897', bidderRequestId: '16e1ce8481bc6d', auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71', src: 'client', bidRequestsCount: 1, bidderRequestsCount: 1, bidderWinsCount: 0}], auctionStart: 1615271191985, timeout: 3000, refererInfo: {referer: 'http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html', reachedTop: true, isAmp: false, numIframes: 0, stack: ['http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html'], canonicalUrl: null}, start: 1615271191988};
+ let bidderRequest_video = {
+ bidderCode: 'iqm',
+ auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71',
+ bidderRequestId: '16e1ce8481bc6d',
+ bids: [{
+ bidder: 'iqm',
+ params: {
+ publisherId: 'df5fd732-c5f3-11e7-abc4-cec278b6b50a',
+ placementId: 23451,
+ bidfloor: 0.5,
+ video: {
+ placement: 2,
+ mimes: ['video/mp4'],
+ protocols: [2, 5],
+ skipppable: true,
+ playback_method: ['auto_play_sound_off']
+ }
+ },
+ crumbs: {pubcid: '09b8f065-9d1b-4a36-bd0c-ea22e2dad807'},
+ ortb2Imp: {ext: {data: {'pbadslot': 'video1'}}},
+ mediaTypes: {video: {playerSize: [[640, 480]], context: 'instream'}},
+ adUnitCode: 'video1',
+ transactionId: '86795c66-acf9-4dd5-998f-6d5362aaa541',
+ sizes: [[640, 480]],
+ bidId: '28bfb7e2d12897',
+ bidderRequestId: '16e1ce8481bc6d',
+ auctionId: '3140a2ec-d567-4db0-9bbb-eb6fa20ccb71',
+ src: 'client',
+ bidRequestsCount: 1,
+ bidderRequestsCount: 1,
+ bidderWinsCount: 0
+ }],
+ auctionStart: 1615271191985,
+ timeout: 3000,
+ refererInfo: {
+ page: 'http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html',
+ domain: 'test.localhost.com:9999',
+ ref: '',
+ reachedTop: true,
+ isAmp: false,
+ numIframes: 0,
+ stack: ['http://test.localhost:9999/integrationExamples/gpt/pbjs_video_adUnit.html'],
+ canonicalUrl: null
+ },
+ start: 1615271191988
+ };
it('handles non-banner media responses', function () {
let response = {id: '2341234', seatbid: [{bid: [{id: 'bid-2341234-1', impid: '1', price: 9, nurl: 'https://frontend.stage.iqm.com/static/vast-01.xml', adm: 'http://cdn.iqm.com/pbd?raw=312730_203cf73dc83fb_2824348636878_pbd', adomain: ['app1.stage.iqm.com'], cid: '168900', crid: 'cr-304503', attr: []}]}], bidid: '2341234'};
diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js
index 002c51cba8a..f06769445c5 100644
--- a/test/spec/modules/ixBidAdapter_spec.js
+++ b/test/spec/modules/ixBidAdapter_spec.js
@@ -444,7 +444,7 @@ describe('IndexexchangeAdapter', function () {
vendorData: {}
},
refererInfo: {
- referer: 'https://www.prebid.org',
+ page: 'https://www.prebid.org',
canonicalUrl: 'https://www.prebid.org/the/link/to/the/page'
}
};
@@ -551,23 +551,9 @@ describe('IndexexchangeAdapter', function () {
];
const DEFAULT_USERID_BID_DATA = {
- lotamePanoramaId: 'bd738d136bdaa841117fe9b331bb4',
- flocId: { id: '1234', version: 'chrome.1.2' }
+ lotamePanoramaId: 'bd738d136bdaa841117fe9b331bb4'
};
- const DEFAULT_FLOC_USERID_PAYLOAD = [
- {
- source: 'chrome.com',
- uids: [{
- id: DEFAULT_USERID_BID_DATA.flocId.id,
- ext: {
- rtiPartner: 'flocId',
- ver: DEFAULT_USERID_BID_DATA.flocId.version
- }
- }]
- }
- ];
-
describe('inherited functions', function () {
it('should exists and is a function', function () {
const adapter = newBidder(spec);
@@ -1034,76 +1020,6 @@ describe('IndexexchangeAdapter', function () {
expect(payload.user.eids).to.have.deep.members(DEFAULT_USERID_PAYLOAD);
});
- it('IX adapter reads floc id from prebid userId and adds it to eids when there is not other eids', function () {
- const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
- cloneValidBid[0].userId = utils.deepClone(DEFAULT_USERID_BID_DATA);
- const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
- const payload = JSON.parse(request.data.r);
-
- expect(payload.user.eids).to.have.lengthOf(1);
- expect(payload.user.eids).to.deep.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
- });
-
- it('IX adapter reads floc id from prebid userId and appends it to eids', function () {
- const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
- cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
- cloneValidBid[0].userId = utils.deepClone(DEFAULT_USERID_BID_DATA);
- const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
- const payload = JSON.parse(request.data.r);
-
- expect(payload.user.eids).to.have.lengthOf(7);
- expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
- expect(payload.user.eids).to.deep.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
- });
-
- it('IX adapter reads empty floc obj from prebid userId it, floc is not added to eids', function () {
- const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
- cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
- cloneValidBid[0].userId = { 'flocId': {} }
- const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
- const payload = JSON.parse(request.data.r);
-
- expect(payload.user.eids).to.have.lengthOf(6);
- expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
- expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
- });
-
- it('IX adapter reads floc obj from prebid userId it version is missing, floc is not added to eids', function () {
- const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
- cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
- cloneValidBid[0].userId = { 'flocId': { 'id': 'abcd' } }
- const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
- const payload = JSON.parse(request.data.r);
-
- expect(payload.user.eids).to.have.lengthOf(6);
- expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
- expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
- });
-
- it('IX adapter reads floc obj from prebid userId it ID is missing, floc is not added to eids', function () {
- const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
- cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
- cloneValidBid[0].userId = { 'flocId': { 'version': 'chrome.a.b.c' } }
- const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
- const payload = JSON.parse(request.data.r);
-
- expect(payload.user.eids).to.have.lengthOf(6);
- expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
- expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
- });
-
- it('IX adapter reads floc id with empty id from prebid userId and it does not added to eids', function () {
- const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
- cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
- cloneValidBid[0].userId = { flocID: { id: '', ver: 'chrome.1.2.3' } };
- const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
- const payload = JSON.parse(request.data.r);
-
- expect(payload.user.eids).to.have.lengthOf(6);
- expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
- expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
- });
-
it('We continue to send in IXL identity info and Prebid takes precedence over IXL', function () {
validIdentityResponse = {
AdserverOrgIp: {
@@ -1307,100 +1223,44 @@ describe('IndexexchangeAdapter', function () {
});
describe('First party data', function () {
- afterEach(function () {
- config.setConfig({
- ortb2: {}
- });
- });
-
it('should not set ixdiag.fpd value if not defined', function () {
- config.setConfig({
- ortb2: {}
- });
-
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2: {}})[0];
const r = JSON.parse(request.data.r);
expect(r.ext.ixdiag.fpd).to.be.undefined;
});
- it('should set ixdiag.fpd value if it exists using fpd', function () {
- config.setConfig({
- fpd: {
- site: {
+ it('should set ixdiag.fpd value if it exists using ortb2', function () {
+ const ortb2 = {
+ site: {
+ ext: {
data: {
pageType: 'article'
}
}
}
- });
-
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
- const r = JSON.parse(request.data.r);
-
- expect(r.ext.ixdiag.fpd).to.exist;
- });
-
- it('should set ixdiag.fpd value if it exists using ortb2', function () {
- config.setConfig({
- ortb2: {
- site: {
- ext: {
- data: {
- pageType: 'article'
- }
- }
- }
- }
- });
+ };
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2})[0];
const r = JSON.parse(request.data.r);
expect(r.ext.ixdiag.fpd).to.exist;
});
- it('should not send information that is not part of openRTB spec v2.5 using fpd', function () {
- config.setConfig({
- fpd: {
- site: {
- keywords: 'power tools, drills',
- search: 'drill',
- testProperty: 'test_string'
- },
- user: {
- keywords: ['a'],
- testProperty: 'test_string'
- }
- }
- });
-
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
- const r = JSON.parse(request.data.r);
-
- expect(r.site.keywords).to.exist;
- expect(r.site.search).to.exist;
- expect(r.site.testProperty).to.be.undefined;
- expect(r.user.keywords).to.exist;
- expect(r.user.testProperty).to.be.undefined;
- });
-
it('should not send information that is not part of openRTB spec v2.5 using ortb2', function () {
- config.setConfig({
- ortb2: {
- site: {
- keywords: 'power tools, drills',
- search: 'drill',
- testProperty: 'test_string'
- },
- user: {
- keywords: ['a'],
- testProperty: 'test_string'
- }
+ const ortb2 = {
+ site: {
+ keywords: 'power tools, drills',
+ search: 'drill',
+ testProperty: 'test_string'
+ },
+ user: {
+ keywords: ['a'],
+ testProperty: 'test_string'
}
- });
+ };
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2})[0];
const r = JSON.parse(request.data.r);
expect(r.site.keywords).to.exist;
@@ -1411,22 +1271,20 @@ describe('IndexexchangeAdapter', function () {
});
it('should not add fpd data to r object if it exceeds maximum request', function () {
- config.setConfig({
- ortb2: {
- site: {
- keywords: 'power tools, drills',
- search: 'drill',
- },
- user: {
- keywords: Array(1000).join('#'),
- }
+ const ortb2 = {
+ site: {
+ keywords: 'power tools, drills',
+ search: 'drill',
+ },
+ user: {
+ keywords: Array(1000).join('#'),
}
- });
+ };
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
bid.mediaTypes.banner.sizes = LARGE_SET_OF_SIZES;
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {ortb2})[0];
const r = JSON.parse(request.data.r);
expect(r.site.ref).to.exist;
@@ -1564,7 +1422,7 @@ describe('IndexexchangeAdapter', function () {
const payload = JSON.parse(query.r);
expect(payload.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidderRequestId);
expect(payload.id).to.be.a('string');
- expect(payload.site.page).to.equal(DEFAULT_OPTION.refererInfo.referer);
+ expect(payload.site.page).to.equal(DEFAULT_OPTION.refererInfo.page);
expect(payload.site.ref).to.equal(document.referrer);
expect(payload.ext.source).to.equal('prebid');
expect(payload.source.ext.schain).to.deep.equal(SAMPLE_SCHAIN);
@@ -1572,14 +1430,6 @@ describe('IndexexchangeAdapter', function () {
expect(payload.imp).to.have.lengthOf(1);
});
- it('payload should set site.page to pageUrl when it exists in config object', function () {
- const url = 'https://example.com/index.html';
- config.setConfig({ pageUrl: url });
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0].data;
- const payload = JSON.parse(request.r);
- expect(payload.site.page).to.contains(url);
- });
-
it('payload should have correct format and value for r.id when bidderRequestId is a number ', function () {
const bidWithIntId = utils.deepClone(DEFAULT_BANNER_VALID_BID);
bidWithIntId[0].bidderRequestId = 123456;
@@ -1648,7 +1498,7 @@ describe('IndexexchangeAdapter', function () {
const bid = utils.deepClone(ONE_VIDEO[0]);
const expectedFloor = 3.25;
bid.getFloor = () => ({ floor: expectedFloor, currency });
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.bidfloor).to.equal(expectedFloor);
@@ -1660,7 +1510,7 @@ describe('IndexexchangeAdapter', function () {
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0])
const expectedFloor = 3.25;
bid.getFloor = () => ({ floor: expectedFloor, currency });
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.bidfloor).to.equal(expectedFloor);
@@ -1672,7 +1522,7 @@ describe('IndexexchangeAdapter', function () {
const bid = utils.deepClone(ONE_BANNER[0]);
bid.params.bidFloor = highFloor;
bid.params.bidFloorCur = 'USD'
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.bidfloor).to.equal(highFloor);
@@ -1686,7 +1536,7 @@ describe('IndexexchangeAdapter', function () {
bid.params.bidFloorCur = 'USD';
const expectedFloor = highFloor;
bid.getFloor = () => ({ floor: expectedFloor, currency });
- const requestBidFloor = spec.buildRequests([bid])[0];
+ const requestBidFloor = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(requestBidFloor.data.r).imp[0];
expect(impression.bidfloor).to.equal(highFloor);
@@ -1698,7 +1548,7 @@ describe('IndexexchangeAdapter', function () {
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
bid.params.bidFloor = 50;
bid.params.bidFloorCur = 'USD';
- const requestBidFloor = spec.buildRequests([bid])[0];
+ const requestBidFloor = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(requestBidFloor.data.r).imp[0];
expect(impression.bidfloor).to.equal(bid.params.bidFloor);
@@ -1715,7 +1565,7 @@ describe('IndexexchangeAdapter', function () {
sinon.spy(bid, 'getFloor');
- const requestBidFloor = spec.buildRequests([bid])[0];
+ const requestBidFloor = spec.buildRequests([bid], {})[0];
expect(bid.getFloor.getCall(0).args[0].mediaType).to.equal('banner');
expect(bid.getFloor.getCall(0).args[0].size[0]).to.equal(300);
expect(bid.getFloor.getCall(0).args[0].size[1]).to.equal(250);
@@ -1749,7 +1599,7 @@ describe('IndexexchangeAdapter', function () {
sinon.spy(bid, 'getFloor');
- const requestBidFloor = spec.buildRequests([bid])[0];
+ const requestBidFloor = spec.buildRequests([bid], {})[0];
expect(bid.getFloor.getCall(0).args[0].mediaType).to.equal('banner');
expect(bid.getFloor.getCall(0).args[0].size[0]).to.equal(300);
expect(bid.getFloor.getCall(0).args[0].size[1]).to.equal(250);
@@ -1763,7 +1613,7 @@ describe('IndexexchangeAdapter', function () {
it('impression should have sid if id is configured as number', function () {
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
bid.params.id = 50;
- const requestBidFloor = spec.buildRequests([bid])[0];
+ const requestBidFloor = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(requestBidFloor.data.r).imp[0];
expect(impression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
@@ -1777,7 +1627,7 @@ describe('IndexexchangeAdapter', function () {
it('impression should have sid if id is configured as string', function () {
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
bid.params.id = 'abc';
- const requestBidFloor = spec.buildRequests([bid])[0];
+ const requestBidFloor = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(requestBidFloor.data.r).imp[0];
expect(impression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
@@ -1807,7 +1657,7 @@ describe('IndexexchangeAdapter', function () {
const requestWithFirstPartyData = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
const pageUrl = JSON.parse(requestWithFirstPartyData.data.r).site.page;
- const expectedPageUrl = DEFAULT_OPTION.refererInfo.referer + '?ab=123&cd=123%23ab&e%2Ff=456&h%3Fg=456%23cd';
+ const expectedPageUrl = DEFAULT_OPTION.refererInfo.page + '?ab=123&cd=123%23ab&e%2Ff=456&h%3Fg=456%23cd';
expect(pageUrl).to.equal(expectedPageUrl);
});
@@ -1821,7 +1671,7 @@ describe('IndexexchangeAdapter', function () {
const requestFirstPartyDataNumber = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
const pageUrl = JSON.parse(requestFirstPartyDataNumber.data.r).site.page;
- expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.referer);
+ expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.page);
});
it('should not set first party or timeout if it is not present', function () {
@@ -1832,7 +1682,7 @@ describe('IndexexchangeAdapter', function () {
const requestWithoutConfig = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
const pageUrl = JSON.parse(requestWithoutConfig.data.r).site.page;
- expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.referer);
+ expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.page);
expect(requestWithoutConfig.data.t).to.be.undefined;
});
@@ -1840,7 +1690,7 @@ describe('IndexexchangeAdapter', function () {
const requestWithoutConfig = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
const pageUrl = JSON.parse(requestWithoutConfig.data.r).site.page;
- expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.referer);
+ expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.page);
expect(requestWithoutConfig.data.t).to.be.undefined;
});
@@ -1850,7 +1700,7 @@ describe('IndexexchangeAdapter', function () {
timeout: 500
}
});
- const requestWithTimeout = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
+ const requestWithTimeout = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {})[0];
expect(requestWithTimeout.data.t).to.equal(500);
});
@@ -1861,14 +1711,14 @@ describe('IndexexchangeAdapter', function () {
timeout: '500'
}
});
- const requestStringTimeout = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
+ const requestStringTimeout = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {})[0];
expect(requestStringTimeout.data.t).to.be.undefined;
});
});
describe('request should contain both banner and video requests', function () {
- const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_VIDEO_VALID_BID[0]]);
+ const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_VIDEO_VALID_BID[0]], {});
it('should have banner request', () => {
const bannerImpression = JSON.parse(request[0].data.r).imp[0];
@@ -2125,7 +1975,7 @@ describe('IndexexchangeAdapter', function () {
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
bid.mediaTypes.video.context = 'outstream';
bid.mediaTypes.video.placement = 2;
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
@@ -2135,7 +1985,7 @@ describe('IndexexchangeAdapter', function () {
it('should set correct default placement, if context is instream', function () {
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
bid.mediaTypes.video.context = 'instream';
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
@@ -2145,7 +1995,7 @@ describe('IndexexchangeAdapter', function () {
it('should set correct default placement, if context is outstream', function () {
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
bid.mediaTypes.video.context = 'outstream';
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
@@ -2155,7 +2005,7 @@ describe('IndexexchangeAdapter', function () {
it('should handle unexpected context', function () {
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
bid.mediaTypes.video.context = 'not-valid';
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.video.placement).to.be.undefined;
});
@@ -2165,7 +2015,7 @@ describe('IndexexchangeAdapter', function () {
bid.mediaTypes.video.context = 'outstream';
bid.mediaTypes.video.protocols = [1];
bid.mediaTypes.video.mimes = ['video/override'];
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.video.protocols[0]).to.equal(2);
@@ -2176,7 +2026,7 @@ describe('IndexexchangeAdapter', function () {
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
bid.mediaTypes.video.context = 'outstream';
bid.mediaTypes.video.random = true;
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.video.random).to.not.exist;
@@ -2190,7 +2040,7 @@ describe('IndexexchangeAdapter', function () {
bid.mediaTypes.video.protocols = [6];
bid.mediaTypes.video.mimes = ['video/mp4'];
bid.mediaTypes.video.api = 2;
- const request = spec.buildRequests([bid])[0];
+ const request = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(request.data.r).imp[0];
expect(impression.video.protocols[0]).to.equal(6);
@@ -2212,7 +2062,7 @@ describe('IndexexchangeAdapter', function () {
});
it('should build video request when if video obj is not provided at params level', () => {
- const request = spec.buildRequests([DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0]]);
+ const request = spec.buildRequests([DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0]], {});
const videoImpression = JSON.parse(request[0].data.r).imp[0];
expect(JSON.parse(request[0].data.v)).to.equal(VIDEO_ENDPOINT_VERSION);
@@ -2224,7 +2074,7 @@ describe('IndexexchangeAdapter', function () {
describe('buildRequestMultiFormat', function () {
it('only banner bidder params set', function () {
- const request = spec.buildRequests(DEFAULT_MULTIFORMAT_BANNER_VALID_BID)
+ const request = spec.buildRequests(DEFAULT_MULTIFORMAT_BANNER_VALID_BID, {})
const bannerImpression = JSON.parse(request[0].data.r).imp[0];
expect(JSON.parse(request[0].data.r).imp).to.have.lengthOf(1);
expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
@@ -2235,7 +2085,7 @@ describe('IndexexchangeAdapter', function () {
describe('only video bidder params set', function () {
it('should generate video impression', function () {
- const request = spec.buildRequests(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID);
+ const request = spec.buildRequests(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID, {});
const videoImp = JSON.parse(request[1].data.r).imp[0];
expect(JSON.parse(request[1].data.r).imp).to.have.lengthOf(1);
expect(JSON.parse(request[1].data.v)).to.equal(VIDEO_ENDPOINT_VERSION);
@@ -2247,7 +2097,7 @@ describe('IndexexchangeAdapter', function () {
it('should get missing sizes count 0 when params.size not used', function () {
const bid = utils.deepClone(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]);
delete bid.params.size;
- const request = spec.buildRequests([bid]);
+ const request = spec.buildRequests([bid], {});
const diagObj = JSON.parse(request[0].data.r).ext.ixdiag;
expect(diagObj.msd).to.equal(0);
expect(diagObj.msi).to.equal(0);
@@ -2256,7 +2106,7 @@ describe('IndexexchangeAdapter', function () {
describe('both banner and video bidder params set', function () {
const bids = [DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0], DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]];
- const request = spec.buildRequests(bids);
+ const request = spec.buildRequests(bids, {});
it('should return valid banner requests', function () {
const impressions = JSON.parse(request[0].data.r).imp;
@@ -2663,7 +2513,7 @@ describe('IndexexchangeAdapter', function () {
const validBidWithoutreferInfo = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
const requestWithoutreferInfo = JSON.parse(validBidWithoutreferInfo[0].data.r);
- expect(requestWithoutreferInfo.site.page).to.equal(options.refererInfo.referer);
+ expect(requestWithoutreferInfo.site.page).to.equal(options.refererInfo.page);
expect(validBidWithoutreferInfo[0].url).to.equal(IX_SECURE_ENDPOINT);
});
@@ -2842,7 +2692,7 @@ describe('IndexexchangeAdapter', function () {
sandbox.restore();
config.setConfig({
- fpd: {},
+ ortb2: {},
ix: {},
})
});
@@ -2905,7 +2755,7 @@ describe('IndexexchangeAdapter', function () {
});
expect(spec.isBidRequestValid(bid)).to.be.true;
- spec.buildRequests([bid]);
+ spec.buildRequests([bid], {});
expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.IX_FPD_EXCEEDS_MAX_SIZE]: 2 } });
});
@@ -2914,25 +2764,24 @@ describe('IndexexchangeAdapter', function () {
bid.bidderRequestId = Array(8000).join('#');
expect(spec.isBidRequestValid(bid)).to.be.true;
- spec.buildRequests([bid]);
+ spec.buildRequests([bid], {});
expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.EXCEEDS_MAX_SIZE]: 2 } });
});
it('should log ERROR_CODES.PB_FPD_EXCEEDS_MAX_SIZE in LocalStorage when there is logError called.', () => {
const bid = utils.deepClone(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]);
-
- config.setConfig({
- fpd: {
- site: {
+ const ortb2 = {
+ site: {
+ ext: {
data: {
pageType: Array(5700).join('#')
}
}
}
- });
+ };
expect(spec.isBidRequestValid(bid)).to.be.true;
- spec.buildRequests([bid]);
+ spec.buildRequests([bid], {ortb2});
expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.PB_FPD_EXCEEDS_MAX_SIZE]: 2 } });
});
@@ -2942,7 +2791,7 @@ describe('IndexexchangeAdapter', function () {
bid.params.video.maxduration = 0;
expect(spec.isBidRequestValid(bid)).to.be.true;
- spec.buildRequests([bid]);
+ spec.buildRequests([bid], {});
expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.VIDEO_DURATION_INVALID]: 3 } });
});
diff --git a/test/spec/modules/jwplayerRtdProvider_spec.js b/test/spec/modules/jwplayerRtdProvider_spec.js
index 43103d953d6..77c8ce58442 100644
--- a/test/spec/modules/jwplayerRtdProvider_spec.js
+++ b/test/spec/modules/jwplayerRtdProvider_spec.js
@@ -1,8 +1,9 @@
import { fetchTargetingForMediaId, getVatFromCache, extractPublisherParams,
formatTargetingResponse, getVatFromPlayer, enrichAdUnits, addTargetingToBid,
- fetchTargetingInformation, jwplayerSubmodule, getContentId, getContentSegments, getContentData, getOrtbSiteContent } from 'modules/jwplayerRtdProvider.js';
+ fetchTargetingInformation, jwplayerSubmodule, getContentId, getContentSegments, getContentData, addOrtbSiteContent } from 'modules/jwplayerRtdProvider.js';
import { server } from 'test/mocks/xhr.js';
import { config as prebidConfig } from 'src/config.js';
+import {deepClone} from '../../../src/utils.js';
describe('jwplayerRtdProvider', function() {
const testIdForSuccess = 'test_id_for_success';
@@ -435,17 +436,13 @@ describe('jwplayerRtdProvider', function() {
bids
};
- enrichAdUnits([adUnit]);
+ const ortb2Fragments = {global: {}};
+ enrichAdUnits([adUnit], ortb2Fragments);
const bid1 = bids[0];
const bid2 = bids[1];
expect(bid1).to.not.have.property('rtd');
expect(bid2).to.not.have.property('rtd');
- let updatedConfig;
- const setConfigSub = sinon.stub(prebidConfig, 'setConfig').callsFake(function (config) {
- updatedConfig = config;
- });
-
const request = fakeServer.requests[0];
request.respond(
200,
@@ -460,12 +457,11 @@ describe('jwplayerRtdProvider', function() {
})
);
- expect(updatedConfig).to.have.property('ortb2');
- expect(updatedConfig.ortb2).to.have.property('site');
- expect(updatedConfig.ortb2.site).to.have.property('content');
- expect(updatedConfig.ortb2.site.content).to.have.property('id', 'jw_' + testIdForSuccess);
- expect(updatedConfig.ortb2.site.content).to.have.property('data');
- const data = updatedConfig.ortb2.site.content.data;
+ expect(ortb2Fragments.global).to.have.property('site');
+ expect(ortb2Fragments.global.site).to.have.property('content');
+ expect(ortb2Fragments.global.site.content).to.have.property('id', 'jw_' + testIdForSuccess);
+ expect(ortb2Fragments.global.site.content).to.have.property('data');
+ const data = ortb2Fragments.global.site.content.data;
expect(data).to.have.length(1);
const datum = data[0];
expect(datum).to.have.property('name', 'jwplayer.com');
@@ -476,8 +472,6 @@ describe('jwplayerRtdProvider', function() {
const segment2 = datum.segment[1];
expect(segment1).to.have.property('id', 'test_seg_1');
expect(segment2).to.have.property('id', 'test_seg_2');
-
- setConfigSub.restore();
});
it('should remove obsolete jwplayer data', function () {
@@ -500,16 +494,8 @@ describe('jwplayerRtdProvider', function() {
bids
};
- enrichAdUnits([adUnit]);
- const bid1 = bids[0];
- expect(bid1).to.not.have.property('rtd');
-
- let updatedConfig;
- const setConfigSub = sinon.stub(prebidConfig, 'setConfig').callsFake(function (config) {
- updatedConfig = config;
- });
- const getConfigSub = sinon.stub(prebidConfig, 'getConfig').callsFake(function () {
- return {
+ const ortb2Fragments = {
+ global: {
site: {
content: {
id: 'randomContentId',
@@ -526,7 +512,11 @@ describe('jwplayerRtdProvider', function() {
}
}
}
- });
+ };
+
+ enrichAdUnits([adUnit], ortb2Fragments);
+ const bid1 = bids[0];
+ expect(bid1).to.not.have.property('rtd');
const request = fakeServer.requests[0];
request.respond(
@@ -542,12 +532,11 @@ describe('jwplayerRtdProvider', function() {
})
);
- expect(updatedConfig).to.have.property('ortb2');
- expect(updatedConfig.ortb2).to.have.property('site');
- expect(updatedConfig.ortb2.site).to.have.property('content');
- expect(updatedConfig.ortb2.site.content).to.have.property('id', 'jw_' + testIdForSuccess);
- expect(updatedConfig.ortb2.site.content).to.have.property('data');
- const data = updatedConfig.ortb2.site.content.data;
+ expect(ortb2Fragments.global).to.have.property('site');
+ expect(ortb2Fragments.global.site).to.have.property('content');
+ expect(ortb2Fragments.global.site.content).to.have.property('id', 'jw_' + testIdForSuccess);
+ expect(ortb2Fragments.global.site.content).to.have.property('data');
+ const data = ortb2Fragments.global.site.content.data;
expect(data).to.have.length(3);
const randomDatum = data[0];
@@ -567,9 +556,6 @@ describe('jwplayerRtdProvider', function() {
const segment2 = jwplayerDatum.segment[1];
expect(segment1).to.have.property('id', 'test_seg_1');
expect(segment2).to.have.property('id', 'test_seg_2');
-
- setConfigSub.restore();
- getConfigSub.restore();
});
});
@@ -718,152 +704,141 @@ describe('jwplayerRtdProvider', function() {
});
describe(' Add Ortb Site Content', function () {
- it('should return undefined when id and data params are empty', function () {
- const bid = {
- ortb2: {
- site: {
- content: {
- id: 'randomId'
- },
- random: {
- random_sub: 'randomSub'
- }
+ it('should maintain object structure when id and data params are empty', function () {
+ const ortb2 = {
+ site: {
+ content: {
+ id: 'randomId'
},
- app: {
- content: {
- id: 'appId'
- }
+ random: {
+ random_sub: 'randomSub'
+ }
+ },
+ app: {
+ content: {
+ id: 'appId'
}
}
- };
- const ortb = getOrtbSiteContent(bid.ortb2);
- expect(ortb).to.be.undefined;
+ }
+ const copy = deepClone(ortb2);
+ addOrtbSiteContent(copy);
+ expect(copy).to.eql(ortb2);
});
it('should create a structure compliant with the oRTB 2 spec', function() {
- const bid = {};
+ const ortb2 = {}
const expectedId = 'expectedId';
const expectedData = { datum: 'datum' };
- const ortb = getOrtbSiteContent(bid.ortb2, expectedId, expectedData);
- expect(ortb).to.have.nested.property('site.content.id', expectedId);
- expect(ortb).to.have.nested.property('site.content.data');
- expect(ortb.site.content.data[0]).to.be.deep.equal(expectedData);
+ addOrtbSiteContent(ortb2, expectedId, expectedData);
+ expect(ortb2).to.have.nested.property('site.content.id', expectedId);
+ expect(ortb2).to.have.nested.property('site.content.data');
+ expect(ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
});
it('should respect existing structure when adding adding fields', function () {
- const bid = {
- ortb2: {
- site: {
- content: {
- id: 'oldId'
- },
- random: {
- random_sub: 'randomSub'
- }
+ const ortb2 = {
+ site: {
+ content: {
+ id: 'oldId'
},
- app: {
- content: {
- id: 'appId'
- }
+ random: {
+ random_sub: 'randomSub'
+ }
+ },
+ app: {
+ content: {
+ id: 'appId'
}
}
};
const expectedId = 'expectedId';
const expectedData = { datum: 'datum' };
- const ortb = getOrtbSiteContent(bid.ortb2, expectedId, expectedData);
- expect(ortb).to.have.nested.property('site.random.random_sub', 'randomSub');
- expect(ortb).to.have.nested.property('app.content.id', 'appId');
- expect(ortb).to.have.nested.property('site.content.id', expectedId);
- expect(ortb).to.have.nested.property('site.content.data');
- expect(ortb.site.content.data[0]).to.be.deep.equal(expectedData);
+ addOrtbSiteContent(ortb2, expectedId, expectedData);
+ expect(ortb2).to.have.nested.property('site.random.random_sub', 'randomSub');
+ expect(ortb2).to.have.nested.property('app.content.id', 'appId');
+ expect(ortb2).to.have.nested.property('site.content.id', expectedId);
+ expect(ortb2).to.have.nested.property('site.content.data');
+ expect(ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
});
it('should set content id', function () {
- const bid = {};
+ const ortb2 = {};
const expectedId = 'expectedId';
- const ortb = getOrtbSiteContent(bid.ortb2, expectedId);
- expect(ortb).to.have.nested.property('site.content.id', expectedId);
+ addOrtbSiteContent(ortb2, expectedId);
+ expect(ortb2).to.have.nested.property('site.content.id', expectedId);
});
it('should override content id', function () {
- const bid = {
- ortb2: {
- site: {
- content: {
- id: 'oldId'
- }
+ const ortb2 = {
+ site: {
+ content: {
+ id: 'oldId'
}
}
};
const expectedId = 'expectedId';
- const ortb = getOrtbSiteContent(bid.ortb2, expectedId);
- expect(ortb).to.have.nested.property('site.content.id', expectedId);
+ addOrtbSiteContent(ortb2, expectedId);
+ expect(ortb2).to.have.nested.property('site.content.id', expectedId);
});
it('should keep previous content id when not set', function () {
const previousId = 'oldId';
- const bid = {
- ortb2: {
- site: {
- content: {
- id: previousId,
- data: [{ datum: 'first_datum' }]
- }
+ const ortb2 = {
+ site: {
+ content: {
+ id: previousId,
+ data: [{ datum: 'first_datum' }]
}
}
};
- const ortb = getOrtbSiteContent(bid.ortb2, null, { datum: 'new_datum' });
- expect(ortb).to.have.nested.property('site.content.id', previousId);
+ addOrtbSiteContent(ortb2, null, { datum: 'new_datum' });
+ expect(ortb2).to.have.nested.property('site.content.id', previousId);
});
it('should set content data', function () {
- const bid = {};
+ const ortb2 = {};
const expectedData = { datum: 'datum' };
- const ortb = getOrtbSiteContent(bid.ortb2, null, expectedData);
- expect(ortb).to.have.nested.property('site.content.data');
- expect(ortb.site.content.data).to.have.length(1);
- expect(ortb.site.content.data[0]).to.be.deep.equal(expectedData);
+ addOrtbSiteContent(ortb2, null, expectedData);
+ expect(ortb2).to.have.nested.property('site.content.data');
+ expect(ortb2.site.content.data).to.have.length(1);
+ expect(ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
});
it('should append content data', function () {
- const bid = {
- ortb2: {
- site: {
- content: {
- data: [{ datum: 'first_datum' }]
- }
+ const ortb2 = {
+ site: {
+ content: {
+ data: [{ datum: 'first_datum' }]
}
}
};
const expectedData = { datum: 'datum' };
- const ortb = getOrtbSiteContent(bid.ortb2, null, expectedData);
- expect(ortb).to.have.nested.property('site.content.data');
- expect(ortb.site.content.data).to.have.length(2);
- expect(ortb.site.content.data.pop()).to.be.deep.equal(expectedData);
+ addOrtbSiteContent(ortb2, null, expectedData);
+ expect(ortb2).to.have.nested.property('site.content.data');
+ expect(ortb2.site.content.data).to.have.length(2);
+ expect(ortb2.site.content.data.pop()).to.be.deep.equal(expectedData);
});
it('should keep previous data when not set', function () {
const expectedId = 'expectedId';
const expectedData = { datum: 'first_datum' };
- const bid = {
- ortb2: {
- site: {
- content: {
- data: [expectedData]
- }
+ const ortb2 = {
+ site: {
+ content: {
+ data: [expectedData]
}
}
};
- const ortb = getOrtbSiteContent(bid.ortb2, expectedId);
- expect(ortb).to.have.nested.property('site.content.data');
- expect(ortb.site.content.data).to.have.length(1);
- expect(ortb.site.content.data[0]).to.be.deep.equal(expectedData);
- expect(ortb).to.have.nested.property('site.content.id', expectedId);
+ addOrtbSiteContent(ortb2, expectedId);
+ expect(ortb2).to.have.nested.property('site.content.data');
+ expect(ortb2.site.content.data).to.have.length(1);
+ expect(ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
+ expect(ortb2).to.have.nested.property('site.content.id', expectedId);
});
});
diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js
index 4733c2dcdb3..2f73af204e4 100644
--- a/test/spec/modules/kargoBidAdapter_spec.js
+++ b/test/spec/modules/kargoBidAdapter_spec.js
@@ -38,6 +38,11 @@ describe('kargo adapter tests', function () {
var bids, undefinedCurrency, noAdServerCurrency, cookies = [], localStorageItems = [], sessionIds = [], requestCount = 0;
beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ kargo: {
+ storageAllowed: true
+ }
+ };
undefinedCurrency = false;
noAdServerCurrency = false;
sandbox.stub(config, 'getConfig').callsFake(function(key) {
@@ -96,6 +101,7 @@ describe('kargo adapter tests', function () {
cookies.length = 0;
localStorageItems.length = 0;
+ $$PREBID_GLOBAL$$.bidderSettings = {};
});
function setCookie(cname, cvalue, exdays = 1) {
diff --git a/test/spec/modules/koblerBidAdapter_spec.js b/test/spec/modules/koblerBidAdapter_spec.js
index 8b45fead744..5bcf62ff95d 100644
--- a/test/spec/modules/koblerBidAdapter_spec.js
+++ b/test/spec/modules/koblerBidAdapter_spec.js
@@ -10,7 +10,7 @@ function createBidderRequest(auctionId, timeout, pageUrl) {
auctionId: auctionId || 'c1243d83-0bed-4fdb-8c76-42b456be17d0',
timeout: timeout || 2000,
refererInfo: {
- referer: pageUrl || 'example.com'
+ page: pageUrl || 'example.com'
}
};
}
@@ -373,7 +373,7 @@ describe('KoblerAdapter', function () {
const bidderRequest = {
auctionId: 'c1243d83-0bed-4fdb-8c76-42b456be17d0',
refererInfo: {
- referer: 'example.com'
+ page: 'example.com'
}
};
config.setConfig({
@@ -729,12 +729,12 @@ describe('KoblerAdapter', function () {
expect(utils.triggerPixel.getCall(0).args[0]).to.be.equal(
'https://bid.essrtb.com/notify/prebid_timeout?ad_unit_code=adunit-code&' +
'auction_id=a1fba829-dd41-409f-acfb-b7b0ac5f30c6&bid_id=ef236c6c-e934-406b-a877-d7be8e8a839a&timeout=100&' +
- 'page_url=' + encodeURIComponent(getRefererInfo().referer)
+ 'page_url=' + encodeURIComponent(getRefererInfo().page)
);
expect(utils.triggerPixel.getCall(1).args[0]).to.be.equal(
'https://bid.essrtb.com/notify/prebid_timeout?ad_unit_code=adunit-code-2&' +
'auction_id=a1fba829-dd41-409f-acfb-b7b0ac5f30c6&bid_id=ca4121c8-9a4a-46ba-a624-e9b64af206f2&timeout=100&' +
- 'page_url=' + encodeURIComponent(getRefererInfo().referer)
+ 'page_url=' + encodeURIComponent(getRefererInfo().page)
);
});
});
diff --git a/test/spec/modules/kubientBidAdapter_spec.js b/test/spec/modules/kubientBidAdapter_spec.js
index f7afc709564..a6241aa8d41 100644
--- a/test/spec/modules/kubientBidAdapter_spec.js
+++ b/test/spec/modules/kubientBidAdapter_spec.js
@@ -91,7 +91,7 @@ describe('KubientAdapter', function () {
auctionStart: 1472239426000,
timeout: 5000,
refererInfo: {
- referer: 'http://www.example.com',
+ page: 'http://www.example.com',
reachedTop: true,
},
gdprConsent: {
diff --git a/test/spec/modules/livewrappedBidAdapter_spec.js b/test/spec/modules/livewrappedBidAdapter_spec.js
index 6e4245dd82c..a4fee5e3b26 100644
--- a/test/spec/modules/livewrappedBidAdapter_spec.js
+++ b/test/spec/modules/livewrappedBidAdapter_spec.js
@@ -2,7 +2,7 @@ import {expect} from 'chai';
import {spec, storage} from 'modules/livewrappedBidAdapter.js';
import {config} from 'src/config.js';
import * as utils from 'src/utils.js';
-import { BANNER, NATIVE, VIDEO } from 'src/mediaTypes.js';
+import { NATIVE, VIDEO } from 'src/mediaTypes.js';
describe('Livewrapped adapter tests', function () {
let sandbox,
@@ -758,9 +758,9 @@ describe('Livewrapped adapter tests', function () {
expect(data).to.deep.equal(expectedQuery);
});
- it('should use params.url, then config pageUrl, then bidderRequest.refererInfo.referer', function() {
+ it('should use params.url, then bidderRequest.refererInfo.page', function() {
let testRequest = clone(bidderRequest);
- testRequest.refererInfo = {referer: 'https://www.topurl.com'};
+ testRequest.refererInfo = {page: 'https://www.topurl.com'};
let result = spec.buildRequests(testRequest.bids, testRequest);
let data = JSON.parse(result.data);
@@ -773,19 +773,6 @@ describe('Livewrapped adapter tests', function () {
data = JSON.parse(result.data);
expect(data.url).to.equal('https://www.topurl.com');
-
- let origGetConfig = config.getConfig;
- sandbox.stub(config, 'getConfig').callsFake(function (key) {
- if (key === 'pageUrl') {
- return 'https://www.configurl.com';
- }
- return origGetConfig.apply(config, arguments);
- });
-
- result = spec.buildRequests(testRequest.bids, testRequest);
- data = JSON.parse(result.data);
-
- expect(data.url).to.equal('https://www.configurl.com');
});
it('should make use of pubcid if available', function() {
@@ -889,16 +876,9 @@ describe('Livewrapped adapter tests', function () {
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
- let origGetConfig = config.getConfig;
- let orgOrtb2 = {user: {ext: {prop: 'value'}}};
- sandbox.stub(config, 'getConfig').callsFake(function (key) {
- if (key === 'ortb2') {
- return orgOrtb2;
- }
- return origGetConfig.apply(config, arguments);
- });
+ const ortb2 = {user: {ext: {prop: 'value'}}};
- let testbidRequest = clone(bidderRequest);
+ let testbidRequest = {...clone(bidderRequest), ortb2};
delete testbidRequest.bids[0].params.userId;
testbidRequest.bids[0].userIdAsEids = [
{
@@ -915,7 +895,7 @@ describe('Livewrapped adapter tests', function () {
var expected = {user: {ext: {prop: 'value', eids: testbidRequest.bids[0].userIdAsEids}}}
expect(data.rtbData).to.deep.equal(expected);
- expect(orgOrtb2).to.deep.equal({user: {ext: {prop: 'value'}}});
+ expect(ortb2).to.deep.equal({user: {ext: {prop: 'value'}}});
});
it('should send schain object if available', function() {
diff --git a/test/spec/modules/lockerdomeBidAdapter_spec.js b/test/spec/modules/lockerdomeBidAdapter_spec.js
index 9e3d7981300..d65837c39ab 100644
--- a/test/spec/modules/lockerdomeBidAdapter_spec.js
+++ b/test/spec/modules/lockerdomeBidAdapter_spec.js
@@ -74,7 +74,7 @@ describe('LockerDomeAdapter', function () {
const bidderRequest = {
refererInfo: {
canonicalUrl: 'https://example.com/canonical',
- referer: 'https://example.com'
+ topmostLocation: 'https://example.com'
}
};
const request = spec.buildRequests(bidRequests, bidderRequest);
@@ -88,7 +88,7 @@ describe('LockerDomeAdapter', function () {
expect(bids).to.have.lengthOf(2);
expect(requestData.url).to.equal(encodeURIComponent(bidderRequest.refererInfo.canonicalUrl));
- expect(requestData.referrer).to.equal(encodeURIComponent(bidderRequest.refererInfo.referer));
+ expect(requestData.referrer).to.equal(encodeURIComponent(bidderRequest.refererInfo.topmostLocation));
expect(bids[0].requestId).to.equal('2652ca954bce9');
expect(bids[0].adUnitCode).to.equal('ad-1');
diff --git a/test/spec/modules/loglyliftBidAdapter_spec.js b/test/spec/modules/loglyliftBidAdapter_spec.js
index d091c4b042d..8ff2eb97463 100644
--- a/test/spec/modules/loglyliftBidAdapter_spec.js
+++ b/test/spec/modules/loglyliftBidAdapter_spec.js
@@ -63,7 +63,8 @@ describe('loglyliftBidAdapter', function () {
const bidderRequest = {
refererInfo: {
- referer: 'fakeReferer',
+ domain: 'domain',
+ page: 'fakeReferer',
reachedTop: true,
numIframes: 1,
stack: []
@@ -160,7 +161,7 @@ describe('loglyliftBidAdapter', function () {
expect(data.prebidJsVersion).to.equal('$prebid.version$');
expect(data.url).to.exist;
expect(data.domain).to.exist;
- expect(data.referer).to.equal(bidderRequest.refererInfo.referer);
+ expect(data.referer).to.equal(bidderRequest.refererInfo.page);
expect(data.auctionStartTime).to.equal(bidderRequest.auctionStart);
expect(data.currency).to.exist;
expect(data.timeout).to.equal(bidderRequest.timeout);
diff --git a/test/spec/modules/luponmediaBidAdapter_spec.js b/test/spec/modules/luponmediaBidAdapter_spec.js
index 8aeecc87c98..9f109ff1892 100755
--- a/test/spec/modules/luponmediaBidAdapter_spec.js
+++ b/test/spec/modules/luponmediaBidAdapter_spec.js
@@ -135,7 +135,7 @@ describe('luponmediaBidAdapter', function () {
'auctionStart': 1587413920820,
'timeout': 2000,
'refererInfo': {
- 'referer': 'https://novi.ba/clanak/176067/fast-car-beginner-s-guide-to-tuning-turbo-engines',
+ 'page': 'https://novi.ba/clanak/176067/fast-car-beginner-s-guide-to-tuning-turbo-engines',
'reachedTop': true,
'numIframes': 0,
'stack': [
diff --git a/test/spec/modules/marsmediaBidAdapter_spec.js b/test/spec/modules/marsmediaBidAdapter_spec.js
index cf074b0f3d6..055b05700b2 100644
--- a/test/spec/modules/marsmediaBidAdapter_spec.js
+++ b/test/spec/modules/marsmediaBidAdapter_spec.js
@@ -38,7 +38,7 @@ describe('marsmedia adapter tests', function () {
};
this.defaultBidderRequest = {
'refererInfo': {
- 'referer': 'Reference Page',
+ 'ref': 'Reference Page',
'stack': [
'aodomain.dvl',
'page.dvl'
diff --git a/test/spec/modules/mediaforceBidAdapter_spec.js b/test/spec/modules/mediaforceBidAdapter_spec.js
index 0b5c4d00f53..22f584306a9 100644
--- a/test/spec/modules/mediaforceBidAdapter_spec.js
+++ b/test/spec/modules/mediaforceBidAdapter_spec.js
@@ -132,7 +132,7 @@ describe('mediaforce bid adapter', function () {
});
const refererInfo = {
- referer: 'https://www.prebid.org',
+ ref: 'https://www.prebid.org',
reachedTop: true,
stack: [
'https://www.prebid.org/page.html',
@@ -181,7 +181,7 @@ describe('mediaforce bid adapter', function () {
site: {
id: bid.params.publisher_id,
publisher: {id: bid.params.publisher_id},
- ref: encodeURIComponent(refererInfo.referer),
+ ref: encodeURIComponent(refererInfo.ref),
page: pageUrl,
},
device: {
@@ -265,7 +265,7 @@ describe('mediaforce bid adapter', function () {
site: {
id: 'pub123',
publisher: {id: 'pub123'},
- ref: encodeURIComponent(refererInfo.referer),
+ ref: encodeURIComponent(refererInfo.ref),
page: pageUrl,
},
device: {
@@ -321,7 +321,7 @@ describe('mediaforce bid adapter', function () {
site: {
id: 'pub124',
publisher: {id: 'pub124'},
- ref: encodeURIComponent(refererInfo.referer),
+ ref: encodeURIComponent(refererInfo.ref),
page: pageUrl,
},
device: {
diff --git a/test/spec/modules/mediafuseBidAdapter_spec.js b/test/spec/modules/mediafuseBidAdapter_spec.js
index f4defa293e1..bb9bbd34d1d 100644
--- a/test/spec/modules/mediafuseBidAdapter_spec.js
+++ b/test/spec/modules/mediafuseBidAdapter_spec.js
@@ -822,7 +822,7 @@ describe('MediaFuseAdapter', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
@@ -939,11 +939,7 @@ describe('MediaFuseAdapter', function () {
uid2: { id: 'sample-uid2-value' },
criteoId: 'sample-criteo-userid',
netId: 'sample-netId-userid',
- idl_env: 'sample-idl-userid',
- flocId: {
- id: 'sample-flocid-value',
- version: 'chrome.1.0'
- }
+ idl_env: 'sample-idl-userid'
}
});
@@ -960,11 +956,6 @@ describe('MediaFuseAdapter', function () {
id: 'sample-criteo-userid',
});
- expect(payload.eids).to.deep.include({
- source: 'chrome.com',
- id: 'sample-flocid-value'
- });
-
expect(payload.eids).to.deep.include({
source: 'netid.de',
id: 'sample-netId-userid',
diff --git a/test/spec/modules/mediakeysBidAdapter_spec.js b/test/spec/modules/mediakeysBidAdapter_spec.js
index 38f2a3f9de3..47ac54d49df 100644
--- a/test/spec/modules/mediakeysBidAdapter_spec.js
+++ b/test/spec/modules/mediakeysBidAdapter_spec.js
@@ -561,38 +561,33 @@ describe('mediakeysBidAdapter', function () {
});
it('should set properties at payload level from FPD', function() {
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2: {
- site: {
- domain: 'domain.example',
- cat: ['IAB12'],
- ext: {
- data: {
- category: 'sport',
- }
- }
- },
- user: {
- yob: 1985,
- gender: 'm',
- geo: {
- country: 'FR',
- city: 'Marseille'
- },
- ext: {
- data: {
- registered: true
- }
- }
+ const ortb2 = {
+ site: {
+ domain: 'domain.example',
+ cat: ['IAB12'],
+ ext: {
+ data: {
+ category: 'sport',
}
}
- };
- return utils.deepAccess(config, key);
- });
+ },
+ user: {
+ yob: 1985,
+ gender: 'm',
+ geo: {
+ country: 'FR',
+ city: 'Marseille'
+ },
+ ext: {
+ data: {
+ registered: true
+ }
+ }
+ }
+ };
const bidRequests = [utils.deepClone(bid)];
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2});
const data = request.data;
expect(data.site.domain).to.equal('domain.example');
expect(data.site.cat[0]).to.equal('IAB12');
diff --git a/test/spec/microadBidAdapter_spec.js b/test/spec/modules/microadBidAdapter_spec.js
similarity index 98%
rename from test/spec/microadBidAdapter_spec.js
rename to test/spec/modules/microadBidAdapter_spec.js
index be310fb8e3c..ff0b705594b 100644
--- a/test/spec/microadBidAdapter_spec.js
+++ b/test/spec/modules/microadBidAdapter_spec.js
@@ -61,8 +61,8 @@ describe('microadBidAdapter', () => {
describe('buildRequests', () => {
const bidderRequest = {
refererInfo: {
- canonicalUrl: 'https://example.com/to',
- referer: 'https://example.com/from'
+ page: 'https://example.com/to',
+ ref: 'https://example.com/from'
}
};
const expectedResultTemplate = {
@@ -124,10 +124,10 @@ describe('microadBidAdapter', () => {
]);
});
- it('should use window.location.href if there is no canonicalUrl', () => {
+ it('should use window.location.href if there is no page', () => {
const bidderRequestWithoutCanonicalUrl = {
refererInfo: {
- referer: 'https://example.com/from'
+ ref: 'https://example.com/from'
}
};
const requests = spec.buildRequests([bidRequestTemplate], bidderRequestWithoutCanonicalUrl);
diff --git a/test/spec/modules/missenaBidAdapter_spec.js b/test/spec/modules/missenaBidAdapter_spec.js
index 86b967cca5b..2b3a271e300 100644
--- a/test/spec/modules/missenaBidAdapter_spec.js
+++ b/test/spec/modules/missenaBidAdapter_spec.js
@@ -49,7 +49,7 @@ describe('Missena Adapter', function () {
gdprApplies: true,
},
refererInfo: {
- referer: 'https://referer',
+ topmostLocation: 'https://referer',
canonicalUrl: 'https://canonical',
},
};
diff --git a/test/spec/modules/mytargetBidAdapter_spec.js b/test/spec/modules/mytargetBidAdapter_spec.js
index 62d139bb926..8880efd3d7c 100644
--- a/test/spec/modules/mytargetBidAdapter_spec.js
+++ b/test/spec/modules/mytargetBidAdapter_spec.js
@@ -46,7 +46,7 @@ describe('MyTarget Adapter', function() {
];
let bidderRequest = {
refererInfo: {
- referer: 'https://example.com?param=value'
+ page: 'https://example.com?param=value'
}
};
diff --git a/test/spec/modules/nextrollIdSystem_spec.js b/test/spec/modules/nextrollIdSystem_spec.js
deleted file mode 100644
index d89c7fe3c98..00000000000
--- a/test/spec/modules/nextrollIdSystem_spec.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import { nextrollIdSubmodule, storage } from 'modules/nextrollIdSystem.js';
-
-const LS_VALUE = `{
- "AdID":{"id":"adid","key":"AdID"},
- "AdID:1002": {"id":"adid","key":"AdID:1002","value":"id_value"}}`;
-
-describe('NextrollId module', function () {
- let sandbox = sinon.sandbox.create();
- let hasLocalStorageStub;
- let getLocalStorageStub;
-
- beforeEach(function() {
- hasLocalStorageStub = sandbox.stub(storage, 'hasLocalStorage');
- getLocalStorageStub = sandbox.stub(storage, 'getDataFromLocalStorage');
- });
-
- afterEach(function () {
- sandbox.restore();
- })
-
- const testCases = [
- {
- expect: {
- id: {nextrollId: 'id_value'},
- },
- params: {partnerId: '1002'},
- localStorage: LS_VALUE
- },
- {
- expect: {id: undefined},
- params: {partnerId: '1003'},
- localStorage: LS_VALUE
- },
- {
- expect: {id: undefined},
- params: {partnerId: ''},
- localStorage: LS_VALUE
- },
- {
- expect: {id: undefined},
- params: {partnerId: '102'},
- localStorage: undefined
- },
- {
- expect: {id: undefined},
- params: undefined,
- localStorage: undefined
- }
- ]
- testCases.forEach(
- (testCase, i) => it(`getId() (TC #${i}) should return the nextroll id if it exists`, function () {
- getLocalStorageStub.withArgs('dca0.com').returns(testCase.localStorage);
- const id = nextrollIdSubmodule.getId({params: testCase.params});
- expect(id).to.be.deep.equal(testCase.expect);
- }))
-});
diff --git a/test/spec/modules/nobidBidAdapter_spec.js b/test/spec/modules/nobidBidAdapter_spec.js
index eccf0e84031..7ea89f7dd3f 100644
--- a/test/spec/modules/nobidBidAdapter_spec.js
+++ b/test/spec/modules/nobidBidAdapter_spec.js
@@ -70,7 +70,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}, bidderCode: BIDDER_CODE
+ refererInfo: {page: REFERER}, bidderCode: BIDDER_CODE
}
const siteName = 'example';
@@ -84,22 +84,20 @@ describe('Nobid Adapter', function () {
const sitePageCat = 'IAB2-12';
it('ortb2 should exist', function () {
- config.setConfig({
- ortb2: {
- site: {
- name: siteName,
- domain: siteDomain,
- cat: [ siteCat ],
- sectioncat: [ siteSectionCat ],
- pagecat: [ sitePageCat ],
- page: sitePage,
- ref: siteRef,
- keywords: siteKeywords,
- search: siteSearch
- }
+ const ortb2 = {
+ site: {
+ name: siteName,
+ domain: siteDomain,
+ cat: [ siteCat ],
+ sectioncat: [ siteSectionCat ],
+ pagecat: [ sitePageCat ],
+ page: sitePage,
+ ref: siteRef,
+ keywords: siteKeywords,
+ search: siteSearch
}
- });
- const request = spec.buildRequests(bidRequests, bidderRequest);
+ };
+ const request = spec.buildRequests(bidRequests, {...bidderRequest, ortb2});
let payload = JSON.parse(request.data);
payload = JSON.parse(JSON.stringify(payload));
expect(payload.sid).to.equal(SITE_ID);
@@ -134,7 +132,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}, bidderCode: BIDDER_CODE
+ refererInfo: {page: REFERER}, bidderCode: BIDDER_CODE
}
it('should add source and version to the tag', function () {
@@ -308,7 +306,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}
+ refererInfo: {page: REFERER}
}
it('should add source and version to the tag', function () {
@@ -397,7 +395,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}
+ refererInfo: {page: REFERER}
}
it('should add source and version to the tag', function () {
@@ -483,7 +481,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}
+ refererInfo: {page: REFERER}
}
it('should criteo eid', function () {
@@ -517,7 +515,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}
+ refererInfo: {page: REFERER}
}
it('should add source and version to the tag', function () {
@@ -651,7 +649,7 @@ describe('Nobid Adapter', function () {
];
let bidderRequest = {
- refererInfo: {referer: REFERER}
+ refererInfo: {page: REFERER}
}
it('should refreshCount = 4', function () {
diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js
deleted file mode 100644
index d6dacb44529..00000000000
--- a/test/spec/modules/oneVideoBidAdapter_spec.js
+++ /dev/null
@@ -1,1046 +0,0 @@
-import { expect } from 'chai';
-import { spec } from 'modules/oneVideoBidAdapter.js';
-
-describe('OneVideoBidAdapter', function () {
- let bidRequest;
- let bidderRequest = {
- 'bidderCode': 'oneVideo',
- 'auctionId': 'e158486f-8c7f-472f-94ce-b0cbfbb50ab4',
- 'bidderRequestId': '1e498b84fffc39',
- 'bids': bidRequest,
- 'auctionStart': 1520001292880,
- 'timeout': 3000,
- 'start': 1520001292884,
- 'doneCbCallCount': 0,
- 'refererInfo': {
- 'numIframes': 1,
- 'reachedTop': true,
- 'referer': 'test.com'
- }
- };
- let mockConfig;
-
- beforeEach(function () {
- bidRequest = {
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480]
- }
- },
- bidder: 'oneVideo',
- sizes: [640, 480],
- bidId: '30b3efwfwe1e',
- adUnitCode: 'video1',
- params: {
- video: {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [2],
- position: 1,
- delivery: [2],
- playbackmethod: [1, 5],
- sid: 134,
- rewarded: 1,
- placement: 1,
- hp: 1,
- inventoryid: 123
- },
- site: {
- id: 1,
- page: 'https://news.yahoo.com/portfolios',
- referrer: 'http://www.yahoo.com'
- },
- pubId: 'brxd'
- }
- };
- });
-
- describe('spec.isBidRequestValid', function () {
- it('should return false when mediaTypes video OR banner not declared', function () {
- bidRequest.mediaTypes = {};
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- });
-
- it('should return true (skip validations) when e2etest = true', function () {
- bidRequest.params.video = {
- e2etest: true
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- });
-
- it('should return true when mediaTypes.video has all mandatory params', function () {
- bidRequest.mediaTypes.video = {
- context: 'instream',
- playerSize: [640, 480],
- mimes: ['video/mp4', 'application/javascript'],
- }
- bidRequest.params.video = {};
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- });
-
- it('should return true when params.video has all override params instead of mediaTypes.video', function () {
- bidRequest.mediaTypes.video = {
- context: 'instream'
- };
- bidRequest.params.video = {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript']
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- });
-
- it('should return true when playerWidth & playerHeight are passed in params.video', function () {
- bidRequest.mediaTypes.video = {
- context: 'instream',
- mimes: ['video/mp4', 'application/javascript']
- };
- bidRequest.params.video = {
- playerWidth: 640,
- playerHeight: 480,
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- });
-
- it('should return true when mimes is passed in params.video', function () {
- bidRequest.mediaTypes.video = {
- context: 'instream',
- playerSizes: [640, 480]
- };
- bidRequest.video = {
- mimes: ['video/mp4', 'application/javascript']
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- });
-
- it('should return false when both mediaTypes.video and params.video Objects are missing', function () {
- bidRequest.mediaTypes = {};
- bidRequest.params = {
- pubId: 'brxd'
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- });
-
- it('should return false when both mediaTypes.video and params.video are missing mimes and player size', function () {
- bidRequest.mediaTypes = {
- video: {
- context: 'instream'
- }
- };
- bidRequest.params = {
- pubId: 'brxd'
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- });
-
- it('should return false when the "pubId" param is missing', function () {
- bidRequest.params = {
- video: {
- playerWidth: 480,
- playerHeight: 640,
- mimes: ['video/mp4', 'application/javascript'],
- }
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- });
-
- it('should return true when the "pubId" param exists', function () {
- bidRequest.mediaTypes = {
- video: {
- playerSizes: [640, 480],
- mimes: ['video/mp4', 'application/javascript']
- },
- pubId: 'brxd'
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- });
-
- it('should return false when no bid params are passed', function () {
- bidRequest.params = {};
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- });
-
- it('should return false when the mediaType is "banner" and display="undefined" (DAP 3P)', function () {
- bidRequest = {
- mediaTypes: {
- banner: {
- sizes: [640, 480]
- }
- }
- }
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- })
-
- it('should return true when the mediaType is "banner" and display=1 (DAP 3P)', function () {
- bidRequest = {
- mediaTypes: {
- banner: {
- sizes: [640, 480]
- }
- },
- bidder: 'oneVideo',
- sizes: [640, 480],
- bidId: '30b3efwfwe1e',
- adUnitCode: 'video1',
- params: {
- video: {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [2],
- position: 1,
- delivery: [2],
- playbackmethod: [1, 5],
- sid: 134,
- rewarded: 1,
- placement: 1,
- inventoryid: 123,
- display: 1
- },
- site: {
- id: 1,
- page: 'https://news.yahoo.com/portfolios',
- referrer: 'http://www.yahoo.com'
- },
- pubId: 'brxd'
- }
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- })
-
- it('should return false when the mediaType is "video" and context="outstream" and display=1 (DAP 3P)', function () {
- bidRequest = {
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [640, 480]
- }
- },
- params: {
- video: {
- display: 1
- }
- }
- }
- expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
- })
-
- it('should return true for Multi-Format AdUnits, when the mediaTypes are both "banner" and "video" (Multi-Format Support)', function () {
- bidRequest = {
- mediaTypes: {
- banner: {
- sizes: [640, 480]
- },
- video: {
- context: 'outstream',
- playerSize: [640, 480],
- mimes: ['video/mp4', 'application/javascript']
- }
- },
- bidder: 'oneVideo',
- sizes: [640, 480],
- bidId: '30b3efwfwe1e',
- adUnitCode: 'video1',
- params: {
- video: {
- protocols: [2, 5],
- api: [2]
- },
- site: {
- page: 'https://news.yahoo.com/portfolios',
- referrer: 'http://www.yahoo.com'
- },
- pubId: 'brxd'
- }
- };
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- })
- });
-
- describe('spec.buildRequests', function () {
- it('should create a POST request for every bid', function () {
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- expect(requests[0].method).to.equal('POST');
- expect(requests[0].url).to.equal(spec.ENDPOINT + bidRequest.params.pubId);
- });
-
- it('should attach the bid request object', function () {
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- expect(requests[0].bidRequest).to.equal(bidRequest);
- });
-
- it('should attach request data', function () {
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const [width, height] = bidRequest.sizes;
- const placement = bidRequest.params.video.placement;
- const rewarded = bidRequest.params.video.rewarded;
- const inventoryid = bidRequest.params.video.inventoryid;
- const VERSION = '3.1.2';
- expect(data.imp[0].video.w).to.equal(width);
- expect(data.imp[0].video.h).to.equal(height);
- expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor);
- expect(data.imp[0].ext.rewarded).to.equal(rewarded);
- expect(data.imp[0].video.placement).to.equal(placement);
- expect(data.imp[0].ext.inventoryid).to.equal(inventoryid);
- expect(data.imp[0].ext.prebidver).to.equal('$prebid.version$');
- expect(data.imp[0].ext.adapterver).to.equal(VERSION);
- });
-
- it('must parse bid size from a nested array', function () {
- const width = 640;
- const height = 480;
- bidRequest.sizes = [
- [width, height]
- ];
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].video.w).to.equal(width);
- expect(data.imp[0].video.h).to.equal(height);
- });
-
- it('should set pubId to HBExchange when bid.params.video.e2etest = true', function () {
- bidRequest.params.video.e2etest = true;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- expect(requests[0].method).to.equal('POST');
- expect(requests[0].url).to.equal(spec.E2ETESTENDPOINT + 'HBExchange');
- });
-
- it('should attach End 2 End test data', function () {
- bidRequest.params.video.e2etest = true;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].bidfloor).to.not.exist;
- expect(data.imp[0].video.w).to.equal(300);
- expect(data.imp[0].video.h).to.equal(250);
- expect(data.imp[0].video.mimes).to.eql(['video/mp4', 'application/javascript']);
- expect(data.imp[0].video.api).to.eql([2]);
- expect(data.site.page).to.equal('https://verizonmedia.com');
- expect(data.site.ref).to.equal('https://verizonmedia.com');
- expect(data.tmax).to.equal(1000);
- });
-
- it('it should create new schain and send it if video.params.sid exists', function () {
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const schain = data.source.ext.schain;
- expect(schain.nodes.length).to.equal(1);
- expect(schain.nodes[0].sid).to.equal(bidRequest.params.video.sid);
- expect(schain.nodes[0].rid).to.equal(data.id);
- })
-
- it('should send Global or Bidder specific schain if sid is not passed in video.params.sid', function () {
- bidRequest.params.video.sid = null;
- const globalSchain = {
- ver: '1.0',
- complete: 1,
- nodes: [{
- asi: 'some-platform.com',
- sid: '111111',
- rid: bidRequest.id,
- hp: 1
- }]
- };
- bidRequest.schain = globalSchain;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const schain = data.source.ext.schain;
- expect(schain.nodes.length).to.equal(1);
- expect(schain).to.equal(globalSchain);
- });
-
- it('should ignore Global or Bidder specific schain if video.params.sid exists and send new schain', function () {
- const globalSchain = {
- ver: '1.0',
- complete: 1,
- nodes: [{
- asi: 'some-platform.com',
- sid: '111111',
- rid: bidRequest.id,
- hp: 1
- }]
- };
- bidRequest.schain = globalSchain;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const schain = data.source.ext.schain;
- expect(schain.nodes.length).to.equal(1);
- expect(schain.complete).to.equal(1);
- expect(schain.nodes[0].sid).to.equal(bidRequest.params.video.sid);
- expect(schain.nodes[0].rid).to.equal(data.id);
- })
-
- it('should append hp to new schain created by sid if video.params.hp is passed', function () {
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const schain = data.source.ext.schain;
- expect(schain.nodes[0].hp).to.equal(bidRequest.params.video.hp);
- })
- it('should not accept key values pairs if custom is Undefined ', function () {
- bidRequest.params.video.custom = null;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].ext.custom).to.be.undefined;
- });
- it('should not accept key values pairs if custom is Array ', function () {
- bidRequest.params.video.custom = [];
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].ext.custom).to.be.undefined;
- });
- it('should not accept key values pairs if custom is Number ', function () {
- bidRequest.params.video.custom = 123456;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].ext.custom).to.be.undefined;
- });
- it('should not accept key values pairs if custom is String ', function () {
- bidRequest.params.video.custom = 'keyValuePairs';
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].ext.custom).to.be.undefined;
- });
- it('should not accept key values pairs if custom is Boolean ', function () {
- bidRequest.params.video.custom = true;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].ext.custom).to.be.undefined;
- });
- it('should accept key values pairs if custom is Object ', function () {
- bidRequest.params.video.custom = {};
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.imp[0].ext.custom).to.be.a('object');
- });
- it('should accept key values pairs if custom is Object ', function () {
- bidRequest.params.video.custom = {
- key1: 'value1',
- key2: 'value2',
- key3: 4444444,
- key4: false,
- key5: {
- nested: 'object'
- },
- key6: ['string', 2, true, null],
- key7: null,
- key8: undefined
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const custom = requests[0].data.imp[0].ext.custom;
- expect(custom['key1']).to.be.a('string');
- expect(custom['key2']).to.be.a('string');
- expect(custom['key3']).to.be.a('number');
- expect(custom['key4']).to.not.exist;
- expect(custom['key5']).to.not.exist;
- expect(custom['key6']).to.not.exist;
- expect(custom['key7']).to.not.exist;
- expect(custom['key8']).to.not.exist;
- });
-
- describe('content object validations', function () {
- it('should not accept content object if value is Undefined ', function () {
- bidRequest.params.video.content = null;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.undefined;
- });
- it('should not accept content object if value is is Array ', function () {
- bidRequest.params.video.content = [];
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.undefined;
- });
- it('should not accept content object if value is Number ', function () {
- bidRequest.params.video.content = 123456;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.undefined;
- });
- it('should not accept content object if value is String ', function () {
- bidRequest.params.video.content = 'keyValuePairs';
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.undefined;
- });
- it('should not accept content object if value is Boolean ', function () {
- bidRequest.params.video.content = true;
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.undefined;
- });
- it('should accept content object if value is Object ', function () {
- bidRequest.params.video.content = {};
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.a('object');
- });
-
- it('should not append unsupported content object keys', function () {
- bidRequest.params.video.content = {
- fake: 'news',
- unreal: 'param',
- counterfit: 'data'
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.empty;
- });
-
- it('should not append content string parameters if value is not string ', function () {
- bidRequest.params.video.content = {
- id: 1234,
- title: ['Title'],
- series: ['Series'],
- season: ['Season'],
- genre: ['Genre'],
- contentrating: {1: 'C-Rating'},
- language: {1: 'EN'}
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.a('object');
- expect(data.site.content).to.be.empty
- });
- it('should not append content Number parameters if value is not Number ', function () {
- bidRequest.params.video.content = {
- episode: '1',
- context: 'context',
- livestream: {0: 'stream'},
- len: [360],
- prodq: [1],
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.a('object');
- expect(data.site.content).to.be.empty
- });
- it('should not append content Array parameters if value is not Array ', function () {
- bidRequest.params.video.content = {
- cat: 'categories',
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.a('object');
- expect(data.site.content).to.be.empty
- });
- it('should not append content ext if value is not Object ', function () {
- bidRequest.params.video.content = {
- ext: 'content.ext',
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.be.a('object');
- expect(data.site.content).to.be.empty
- });
- it('should append supported parameters if value match validations ', function () {
- bidRequest.params.video.content = {
- id: '1234',
- title: 'Title',
- series: 'Series',
- season: 'Season',
- cat: [
- 'IAB1'
- ],
- genre: 'Genre',
- contentrating: 'C-Rating',
- language: 'EN',
- episode: 1,
- prodq: 1,
- context: 1,
- livestream: 0,
- len: 360,
- ext: {}
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.site.content).to.deep.equal(bidRequest.params.video.content);
- });
- });
- });
-
- describe('price floor module validations', function () {
- beforeEach(function () {
- bidRequest.getFloor = (floorObj) => {
- return {
- floor: bidRequest.floors.values[floorObj.mediaType + '|640x480'],
- currency: floorObj.currency,
- mediaType: floorObj.mediaType
- }
- }
- });
-
- it('should get bidfloor from getFloor method', function () {
- bidRequest.params.cur = 'EUR';
- bidRequest.floors = {
- currency: 'EUR',
- values: {
- 'video|640x480': 5.55
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.cur).is.a('string');
- expect(data.cur).to.equal('EUR');
- expect(data.imp[0].bidfloor).is.a('number');
- expect(data.imp[0].bidfloor).to.equal(5.55);
- });
-
- it('should use adUnit/module currency & floor instead of bid.params.bidfloor', function () {
- bidRequest.params.cur = 'EUR';
- bidRequest.params.bidfloor = 3.33;
- bidRequest.floors = {
- currency: 'EUR',
- values: {
- 'video|640x480': 5.55
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.cur).is.a('string');
- expect(data.cur).to.equal('EUR');
- expect(data.imp[0].bidfloor).is.a('number');
- expect(data.imp[0].bidfloor).to.equal(5.55);
- });
-
- it('should load banner instead of video floor when DAP is active bid.params.video.display = 1', function () {
- bidRequest.params.video.display = 1;
- bidRequest.params.cur = 'EUR';
- bidRequest.mediaTypes = {
- banner: {
- sizes: [
- [640, 480]
- ]
- }
- };
- bidRequest.floors = {
- currency: 'EUR',
- values: {
- 'banner|640x480': 2.22,
- 'video|640x480': 9.99
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.cur).is.a('string');
- expect(data.cur).to.equal('EUR');
- expect(data.imp[0].bidfloor).is.a('number');
- expect(data.imp[0].bidfloor).to.equal(2.22);
- })
-
- it('should load video floor when multi-format adUnit is present', function () {
- bidRequest.params.cur = 'EUR';
- bidRequest.mediaTypes.banner = {
- sizes: [
- [640, 480]
- ]
- };
- bidRequest.floors = {
- currency: 'EUR',
- values: {
- 'banner|640x480': 2.22,
- 'video|640x480': 9.99
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- expect(data.cur).is.a('string');
- expect(data.cur).to.equal('EUR');
- expect(data.imp[0].bidfloor).is.a('number');
- expect(data.imp[0].bidfloor).to.equal(9.99);
- })
- })
-
- describe('spec.interpretResponse', function () {
- it('should return no bids if the response is not valid', function () {
- const bidResponse = spec.interpretResponse({
- body: null
- }, {
- bidRequest
- });
- expect(bidResponse.length).to.equal(0);
- });
-
- it('should return no bids if the response "nurl" and "adm" are missing', function () {
- const serverResponse = {
- seatbid: [{
- bid: [{
- price: 6.01
- }]
- }]
- };
- const bidResponse = spec.interpretResponse({
- body: serverResponse
- }, {
- bidRequest
- });
- expect(bidResponse.length).to.equal(0);
- });
-
- it('should return no bids if the response "price" is missing', function () {
- const serverResponse = {
- seatbid: [{
- bid: [{
- adm: ''
- }]
- }]
- };
- const bidResponse = spec.interpretResponse({
- body: serverResponse
- }, {
- bidRequest
- });
- expect(bidResponse.length).to.equal(0);
- });
-
- it('should return a valid video bid response with just "adm"', function () {
- const serverResponse = {
- seatbid: [{
- bid: [{
- id: 1,
- adid: 123,
- crid: 2,
- price: 6.01,
- adm: '',
- adomain: [
- 'verizonmedia.com'
- ],
- }]
- }],
- cur: 'USD'
- };
- const bidResponse = spec.interpretResponse({
- body: serverResponse
- }, {
- bidRequest
- });
- let o = {
- requestId: bidRequest.bidId,
- bidderCode: spec.code,
- cpm: serverResponse.seatbid[0].bid[0].price,
- creativeId: serverResponse.seatbid[0].bid[0].crid,
- vastXml: serverResponse.seatbid[0].bid[0].adm,
- width: 640,
- height: 480,
- mediaType: 'video',
- currency: 'USD',
- ttl: 300,
- netRevenue: true,
- adUnitCode: bidRequest.adUnitCode,
- renderer: (bidRequest.mediaTypes.video.context === 'outstream') ? newRenderer(bidRequest, bidResponse) : undefined,
- meta: {
- advertiserDomains: ['verizonmedia.com']
- }
- };
- expect(bidResponse).to.deep.equal(o);
- });
- // @abrowning14 check that banner DAP response is appended to o.ad + mediaType: 'banner'
- it('should return a valid DAP banner bid-response', function () {
- bidRequest = {
- mediaTypes: {
- banner: {
- sizes: [640, 480]
- }
- },
- params: {
- video: {
- display: 1
- }
- }
- }
- const serverResponse = {
- seatbid: [{
- bid: [{
- id: 1,
- adid: 123,
- crid: 2,
- price: 6.01,
- adm: 'DAP UNIT HERE
'
- }]
- }],
- cur: 'USD'
- };
- const bidResponse = spec.interpretResponse({
- body: serverResponse
- }, {
- bidRequest
- });
- expect(bidResponse.ad).to.equal('DAP UNIT HERE
');
- expect(bidResponse.mediaType).to.equal('banner');
- expect(bidResponse.renderer).to.be.undefined;
- });
-
- it('should default ttl to 300', function () {
- const serverResponse = {seatbid: [{bid: [{id: 1, adid: 123, crid: 2, price: 6.01, adm: ''}]}], cur: 'USD'};
- const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest });
- expect(bidResponse.ttl).to.equal(300);
- });
- it('should not allow ttl above 3601, default to 300', function () {
- bidRequest.params.video.ttl = 3601;
- const serverResponse = {seatbid: [{bid: [{id: 1, adid: 123, crid: 2, price: 6.01, adm: ''}]}], cur: 'USD'};
- const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest });
- expect(bidResponse.ttl).to.equal(300);
- });
- it('should not allow ttl below 1, default to 300', function () {
- bidRequest.params.video.ttl = 0;
- const serverResponse = {seatbid: [{bid: [{id: 1, adid: 123, crid: 2, price: 6.01, adm: ''}]}], cur: 'USD'};
- const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest });
- expect(bidResponse.ttl).to.equal(300);
- });
- it('should use custom ttl if under 3600', function () {
- bidRequest.params.video.ttl = 1000;
- const serverResponse = {seatbid: [{bid: [{id: 1, adid: 123, crid: 2, price: 6.01, adm: ''}]}], cur: 'USD'};
- const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest });
- expect(bidResponse.ttl).to.equal(1000);
- });
- });
-
- describe('when GDPR and uspConsent applies', function () {
- beforeEach(function () {
- bidderRequest = {
- 'gdprConsent': {
- 'consentString': 'test-gdpr-consent-string',
- 'gdprApplies': true
- },
- 'uspConsent': '1YN-',
- 'bidderCode': 'oneVideo',
- 'auctionId': 'e158486f-8c7f-472f-94ce-b0cbfbb50ab4',
- 'bidderRequestId': '1e498b84fffc39',
- 'bids': bidRequest,
- 'auctionStart': 1520001292880,
- 'timeout': 3000,
- 'start': 1520001292884,
- 'doneCbCallCount': 0,
- 'refererInfo': {
- 'numIframes': 1,
- 'reachedTop': true,
- 'referer': 'test.com'
- }
- };
-
- mockConfig = {
- consentManagement: {
- gdpr: {
- cmpApi: 'iab',
- timeout: 3000,
- allowAuctionWithoutConsent: 'cancel'
- },
- usp: {
- cmpApi: 'iab',
- timeout: 1000,
- allowAuctionWithoutConsent: 'cancel'
- }
- }
- };
- });
-
- it('should send a signal to specify that GDPR applies to this request', function () {
- const request = spec.buildRequests([bidRequest], bidderRequest);
- expect(request[0].data.regs.ext.gdpr).to.equal(1);
- });
-
- it('should send the consent string', function () {
- const request = spec.buildRequests([bidRequest], bidderRequest);
- expect(request[0].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString);
- });
-
- it('should send the uspConsent string', function () {
- const request = spec.buildRequests([bidRequest], bidderRequest);
- expect(request[0].data.regs.ext.us_privacy).to.equal(bidderRequest.uspConsent);
- });
-
- it('should send the uspConsent and GDPR ', function () {
- const request = spec.buildRequests([bidRequest], bidderRequest);
- expect(request[0].data.regs.ext.gdpr).to.equal(1);
- expect(request[0].data.regs.ext.us_privacy).to.equal(bidderRequest.uspConsent);
- });
- });
-
- describe('should send banner object', function () {
- it('should send banner object when display is 1 and context="instream" (DAP O&O)', function () {
- bidRequest = {
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480]
- }
- },
- bidder: 'oneVideo',
- sizes: [640, 480],
- bidId: '30b3efwfwe1e',
- adUnitCode: 'video1',
- params: {
- video: {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [2],
- position: 1,
- delivery: [2],
- playbackmethod: [1, 5],
- placement: 1,
- inventoryid: 123,
- sid: 134,
- display: 1,
- minduration: 10,
- maxduration: 30
- },
- site: {
- id: 1,
- page: 'https://www.yahoo.com/',
- referrer: 'http://www.yahoo.com'
- },
- pubId: 'OneMDisplay'
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const width = bidRequest.params.video.playerWidth;
- const height = bidRequest.params.video.playerHeight;
- const position = bidRequest.params.video.position;
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- expect(data.imp[0].banner.w).to.equal(width);
- expect(data.imp[0].banner.h).to.equal(height);
- expect(data.imp[0].banner.pos).to.equal(position);
- expect(data.imp[0].ext.inventoryid).to.equal(bidRequest.params.video.inventoryid);
- expect(data.imp[0].banner.mimes).to.equal(bidRequest.params.video.mimes);
- expect(data.imp[0].banner.placement).to.equal(bidRequest.params.video.placement);
- expect(data.imp[0].banner.ext.minduration).to.equal(bidRequest.params.video.minduration);
- expect(data.imp[0].banner.ext.maxduration).to.equal(bidRequest.params.video.maxduration);
- expect(data.site.id).to.equal(bidRequest.params.site.id);
- });
- it('should send video object when display is other than 1 (VAST for All)', function () {
- bidRequest = {
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480]
- }
- },
- bidder: 'oneVideo',
- sizes: [640, 480],
- bidId: '30b3efwfwe1e',
- adUnitCode: 'video1',
- params: {
- video: {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [2],
- position: 1,
- delivery: [2],
- playbackmethod: [1, 5],
- placement: 123,
- sid: 134,
- display: 12
- },
- site: {
- id: 1,
- page: 'https://www.yahoo.com/',
- referrer: 'http://www.yahoo.com'
- },
- pubId: 'OneMDisplay'
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const width = bidRequest.params.video.playerWidth;
- const height = bidRequest.params.video.playerHeight;
- const position = bidRequest.params.video.position;
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- expect(data.imp[0].video.w).to.equal(width);
- expect(data.imp[0].video.h).to.equal(height);
- expect(data.imp[0].video.pos).to.equal(position);
- expect(data.imp[0].video.mimes).to.equal(bidRequest.params.video.mimes);
- });
- it('should send video object when display is not passed (VAST for All)', function () {
- bidRequest = {
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480]
- }
- },
- bidder: 'oneVideo',
- sizes: [640, 480],
- bidId: '30b3efwfwe1e',
- adUnitCode: 'video1',
- params: {
- video: {
- playerWidth: 640,
- playerHeight: 480,
- mimes: ['video/mp4', 'application/javascript'],
- protocols: [2, 5],
- api: [2],
- position: 1,
- delivery: [2],
- playbackmethod: [1, 5],
- placement: 123,
- sid: 134,
- minduration: 10,
- maxduration: 30
- },
- site: {
- id: 1,
- page: 'https://www.yahoo.com/',
- referrer: 'http://www.yahoo.com'
- },
- pubId: 'OneMDisplay'
- }
- };
- const requests = spec.buildRequests([bidRequest], bidderRequest);
- const data = requests[0].data;
- const width = bidRequest.params.video.playerWidth;
- const height = bidRequest.params.video.playerHeight;
- const position = bidRequest.params.video.position;
- expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
- expect(data.imp[0].video.w).to.equal(width);
- expect(data.imp[0].video.h).to.equal(height);
- expect(data.imp[0].video.pos).to.equal(position);
- expect(data.imp[0].video.mimes).to.equal(bidRequest.params.video.mimes);
- expect(data.imp[0].video.protocols).to.equal(bidRequest.params.video.protocols);
- expect(data.imp[0].video.linearity).to.equal(1);
- expect(data.imp[0].video.maxduration).to.equal(bidRequest.params.video.maxduration);
- expect(data.imp[0].video.minduration).to.equal(bidRequest.params.video.minduration);
- });
- describe('getUserSyncs', function () {
- const GDPR_CONSENT_STRING = 'GDPR_CONSENT_STRING';
-
- it('should get correct user sync when iframeEnabled', function () {
- let pixel = spec.getUserSyncs({
- pixelEnabled: true
- }, {}, {
- gdprApplies: true,
- consentString: GDPR_CONSENT_STRING
- })
- expect(pixel[1].type).to.equal('image');
- expect(pixel[1].url).to.equal('https://sync-tm.everesttech.net/upi/pid/m7y5t93k?gdpr=1&gdpr_consent=' + GDPR_CONSENT_STRING + '&redir=https%3A%2F%2Fpixel.advertising.com%2Fups%2F55986%2Fsync%3Fuid%3D%24%7BUSER_ID%7D%26_origin%3D0&gdpr=1&gdpr_consent=' + encodeURI(GDPR_CONSENT_STRING));
- });
-
- it('should default to gdprApplies=0 when consentData is undefined', function () {
- let pixel = spec.getUserSyncs({
- pixelEnabled: true
- }, {}, undefined);
- expect(pixel[1].url).to.equal('https://sync-tm.everesttech.net/upi/pid/m7y5t93k?gdpr=0&gdpr_consent=&redir=https%3A%2F%2Fpixel.advertising.com%2Fups%2F55986%2Fsync%3Fuid%3D%24%7BUSER_ID%7D%26_origin%3D0&gdpr=0&gdpr_consent=');
- });
- });
-
- describe('verify sync pixels', function () {
- let pixel = spec.getUserSyncs({
- pixelEnabled: true
- }, {}, undefined);
- it('should be UPS sync pixel for DBM', function () {
- expect(pixel[0].url).to.equal('https://pixel.advertising.com/ups/57304/sync?gdpr=&gdpr_consent=&_origin=0&redir=true')
- });
-
- it('should be TTD sync pixel', function () {
- expect(pixel[2].url).to.equal('https://match.adsrvr.org/track/cmf/generic?ttd_pid=adaptv&ttd_tpi=1')
- });
- })
- });
-});
diff --git a/test/spec/modules/openxBidAdapter_spec.js b/test/spec/modules/openxBidAdapter_spec.js
index 3bc53e30eb8..cc1c2d1e607 100644
--- a/test/spec/modules/openxBidAdapter_spec.js
+++ b/test/spec/modules/openxBidAdapter_spec.js
@@ -1093,7 +1093,6 @@ describe('OpenxAdapter', function () {
tapadId: '111-tapadid',
tdid: '1111-tdid',
uid2: {id: '1111-uid2'},
- flocId: {id: '12144', version: 'chrome.1.1'},
novatiq: {snowflake: '1111-novatiqid'},
admixerId: '1111-admixerid',
deepintentId: '1111-deepintentid',
@@ -1147,9 +1146,6 @@ describe('OpenxAdapter', function () {
case 'merkleId':
userIdValue = EXAMPLE_DATA_BY_ATTR.merkleId.id;
break;
- case 'flocId':
- userIdValue = EXAMPLE_DATA_BY_ATTR.flocId.id;
- break;
case 'uid2':
userIdValue = EXAMPLE_DATA_BY_ATTR.uid2.id;
break;
@@ -1713,21 +1709,10 @@ describe('OpenxAdapter', function () {
context('in ortb2.user.data', function () {
let bidRequests;
beforeEach(function () {
- let fpdConfig = t.config
- sinon
- .stub(config, 'getConfig')
- .withArgs(sinon.match(/^ortb2\.user\.data$|^ortb2\.site\.content\.data$/))
- .callsFake((key) => {
- return utils.deepAccess(fpdConfig, key);
- });
bidRequests = [{...bidRequest, ...t.request}];
});
- afterEach(function () {
- config.getConfig.restore();
- });
-
- const mockBidderRequest = {refererInfo: {}};
+ const mockBidderRequest = {refererInfo: {}, ortb2: t.config.ortb2};
it(`${t.name} for type ${name}`, function () {
const request = spec.buildRequests(bidRequests, mockBidderRequest)
expect(request.length).to.equal(1);
diff --git a/test/spec/modules/operaadsBidAdapter_spec.js b/test/spec/modules/operaadsBidAdapter_spec.js
index 849a3eada3f..45bc8995a5c 100644
--- a/test/spec/modules/operaadsBidAdapter_spec.js
+++ b/test/spec/modules/operaadsBidAdapter_spec.js
@@ -49,7 +49,7 @@ describe('Opera Ads Bid Adapter', function () {
bidderCode: 'myBidderCode',
bidderRequestId: '15246a574e859f',
refererInfo: {
- referer: 'http://example.com',
+ page: 'http://example.com',
stack: ['http://example.com']
},
gdprConsent: {
@@ -242,7 +242,7 @@ describe('Opera Ads Bid Adapter', function () {
expect(requestData.site).to.be.an('object');
expect(requestData.site.id).to.equal(bidRequest.params.publisherId);
expect(requestData.site.domain).to.not.be.empty;
- expect(requestData.site.page).to.equal(bidderRequest.refererInfo.referer);
+ expect(requestData.site.page).to.equal(bidderRequest.refererInfo.page);
expect(requestData.at).to.equal(1);
expect(requestData.bcat).to.be.an('array').that.is.empty;
expect(requestData.cur).to.be.an('array').that.not.be.empty;
diff --git a/test/spec/modules/optoutBidAdapter_spec.js b/test/spec/modules/optoutBidAdapter_spec.js
index 4d7c25d12bc..a31becdc394 100644
--- a/test/spec/modules/optoutBidAdapter_spec.js
+++ b/test/spec/modules/optoutBidAdapter_spec.js
@@ -72,21 +72,21 @@ describe('optoutAdapterTest', function () {
}];
it('bidRequest HTTP method', function () {
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
requests.forEach(function(requestItem) {
expect(requestItem.method).to.equal('POST');
});
});
it('bidRequest url without consent', function () {
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
requests.forEach(function(requestItem) {
expect(requestItem.url).to.match(new RegExp('adscience-nocookie\\.nl/prebid/display'));
});
});
it('bidRequest id', function () {
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
expect(requests[0].data.requestId).to.equal('9304jr394ddfj');
expect(requests[1].data.requestId).to.equal('893j4f94e8jei');
});
@@ -99,7 +99,7 @@ describe('optoutAdapterTest', function () {
}
})
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
expect(requests[0].data.cur.adServerCurrency).to.equal('USD');
expect(requests[1].data.cur.adServerCurrency).to.equal('USD');
});
@@ -107,7 +107,7 @@ describe('optoutAdapterTest', function () {
it('bidRequest without config for currency', function () {
config.resetConfig();
- const requests = spec.buildRequests(bidRequests);
+ const requests = spec.buildRequests(bidRequests, {});
expect(requests[0].data.cur.adServerCurrency).to.equal('EUR');
expect(requests[1].data.cur.adServerCurrency).to.equal('EUR');
});
diff --git a/test/spec/modules/orbidderBidAdapter_spec.js b/test/spec/modules/orbidderBidAdapter_spec.js
index 750524cf47f..0d1396866e7 100644
--- a/test/spec/modules/orbidderBidAdapter_spec.js
+++ b/test/spec/modules/orbidderBidAdapter_spec.js
@@ -63,7 +63,7 @@ describe('orbidderBidAdapter', () => {
return spec.buildRequests(buildRequest, {
...bidderRequest || {},
refererInfo: {
- referer: 'https://localhost:9876/'
+ page: 'https://localhost:9876/'
}
})[0];
};
diff --git a/test/spec/modules/otmBidAdapter_spec.js b/test/spec/modules/otmBidAdapter_spec.js
index ce033d0fba5..27da17b8415 100644
--- a/test/spec/modules/otmBidAdapter_spec.js
+++ b/test/spec/modules/otmBidAdapter_spec.js
@@ -42,7 +42,7 @@ describe('otmBidAdapter', function () {
sizes: [[240, 400]]
}];
- const bidderRequest = {refererInfo: {referer: `https://github.com:3000/`}}
+ const bidderRequest = {refererInfo: {page: `https://github.com:3000/`, domain: 'github.com:3000'}}
const request = spec.buildRequests(bidRequestData, bidderRequest);
const req_data = request[0].data;
diff --git a/test/spec/modules/outbrainBidAdapter_spec.js b/test/spec/modules/outbrainBidAdapter_spec.js
index 5dbdd049d82..b55ad04eac3 100644
--- a/test/spec/modules/outbrainBidAdapter_spec.js
+++ b/test/spec/modules/outbrainBidAdapter_spec.js
@@ -180,7 +180,7 @@ describe('Outbrain Adapter', function () {
const commonBidderRequest = {
refererInfo: {
- referer: 'https://example.com/'
+ page: 'https://example.com/'
}
}
diff --git a/test/spec/modules/ozoneBidAdapter_spec.js b/test/spec/modules/ozoneBidAdapter_spec.js
index 658af310ea5..b29494e0b54 100644
--- a/test/spec/modules/ozoneBidAdapter_spec.js
+++ b/test/spec/modules/ozoneBidAdapter_spec.js
@@ -2294,7 +2294,7 @@ describe('ozone Adapter', function () {
expect(payload.ext.ozone.oz_kvp_rw).to.equal(0);
});
it('should handle ortb2 site data', function () {
- config.setConfig({'ortb2': {
+ const ortb2 = {
'site': {
'name': 'example_ortb2_name',
'domain': 'page.example.com',
@@ -2306,15 +2306,15 @@ describe('ozone Adapter', function () {
'keywords': 'power tools, drills',
'search': 'drill'
}
- }});
- const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ };
+ const request = spec.buildRequests(validBidRequests, {...validBidderRequest.bidderRequest, ortb2});
const payload = JSON.parse(request.data);
expect(payload.imp[0].ext.ozone.customData[0].targeting.name).to.equal('example_ortb2_name');
expect(payload.user.ext).to.not.have.property('gender');
config.resetConfig();
});
it('should add ortb2 site data when there is no customData already created', function () {
- config.setConfig({'ortb2': {
+ const ortb2 = {
'site': {
'name': 'example_ortb2_name',
'domain': 'page.example.com',
@@ -2326,34 +2326,34 @@ describe('ozone Adapter', function () {
'keywords': 'power tools, drills',
'search': 'drill'
}
- }});
- const request = spec.buildRequests(validBidRequestsNoCustomData, validBidderRequest.bidderRequest);
+ };
+ const request = spec.buildRequests(validBidRequestsNoCustomData, {...validBidderRequest.bidderRequest, ortb2});
const payload = JSON.parse(request.data);
expect(payload.imp[0].ext.ozone.customData[0].targeting.name).to.equal('example_ortb2_name');
expect(payload.imp[0].ext.ozone.customData[0].targeting).to.not.have.property('gender')
config.resetConfig();
});
it('should add ortb2 user data to the user object', function () {
- config.setConfig({'ortb2': {
+ const ortb2 = {
'user': {
'gender': 'who knows these days'
}
- }});
- const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ };
+ const request = spec.buildRequests(validBidRequests, {...validBidderRequest.bidderRequest, ortb2});
const payload = JSON.parse(request.data);
expect(payload.user.gender).to.equal('who knows these days');
config.resetConfig();
});
it('should not override the user.ext.consent string even if this is set in config ortb2', function () {
- config.setConfig({'ortb2': {
+ const ortb2 = {
'user': {
'ext': {
'consent': 'this is the consent override that shouldnt work',
'consent2': 'this should be set'
}
}
- }});
- const request = spec.buildRequests(validBidRequests, bidderRequestWithFullGdpr.bidderRequest);
+ };
+ const request = spec.buildRequests(validBidRequests, {...bidderRequestWithFullGdpr.bidderRequest, ortb2});
const payload = JSON.parse(request.data);
expect(payload.user.ext.consent2).to.equal('this should be set');
expect(payload.user.ext.consent).to.equal('BOh7mtYOh7mtYAcABBENCU-AAAAncgPIXJiiAoao0PxBFkgCAC8ACIAAQAQQAAIAAAIAAAhBGAAAQAQAEQgAAAAAAABAAAAAAAAAAAAAAACAAAAAAAACgAAAAABAAAAQAAAAAAA');
diff --git a/test/spec/modules/parrableIdSystem_spec.js b/test/spec/modules/parrableIdSystem_spec.js
index a6e6185bbb2..481c3289f1f 100644
--- a/test/spec/modules/parrableIdSystem_spec.js
+++ b/test/spec/modules/parrableIdSystem_spec.js
@@ -128,7 +128,7 @@ describe('Parrable ID System', function() {
expect(data).to.deep.equal({
eid: P_COOKIE_EID,
trackers: P_CONFIG_MOCK.params.partners.split(','),
- url: getRefererInfo().referer,
+ url: getRefererInfo().page,
prebidVersion: '$prebid.version$',
isIframe: true
});
diff --git a/test/spec/modules/permutiveRtdProvider_spec.js b/test/spec/modules/permutiveRtdProvider_spec.js
index 6b44ec2b065..4e59cd35741 100644
--- a/test/spec/modules/permutiveRtdProvider_spec.js
+++ b/test/spec/modules/permutiveRtdProvider_spec.js
@@ -36,16 +36,16 @@ describe('permutiveRtdProvider', function () {
it('should add ortb2 config', function () {
const moduleConfig = getConfig()
- const bidderConfig = config.getBidderConfig()
+ const bidderConfig = {};
const acBidders = moduleConfig.params.acBidders
const expectedTargetingData = transformedTargeting().ac.map(seg => {
return { id: seg }
})
- setBidderRtb({}, moduleConfig)
+ setBidderRtb(bidderConfig, moduleConfig)
acBidders.forEach(bidder => {
- expect(bidderConfig[bidder].ortb2.user.data).to.deep.include.members([{
+ expect(bidderConfig[bidder].user.data).to.deep.include.members([{
name: 'permutive.com',
segment: expectedTargetingData
}])
@@ -53,7 +53,7 @@ describe('permutiveRtdProvider', function () {
})
it('should include ortb2 user data transformation for IAB audience taxonomy', function() {
const moduleConfig = getConfig()
- const bidderConfig = config.getBidderConfig()
+ const bidderConfig = {}
const acBidders = moduleConfig.params.acBidders
const expectedTargetingData = transformedTargeting().ac.map(seg => {
return { id: seg }
@@ -75,10 +75,10 @@ describe('permutiveRtdProvider', function () {
}
)
- setBidderRtb({}, moduleConfig)
+ setBidderRtb(bidderConfig, moduleConfig)
acBidders.forEach(bidder => {
- expect(bidderConfig[bidder].ortb2.user.data).to.deep.include.members([
+ expect(bidderConfig[bidder].user.data).to.deep.include.members([
{
name: 'permutive.com',
segment: expectedTargetingData
@@ -93,30 +93,24 @@ describe('permutiveRtdProvider', function () {
})
it('should not overwrite ortb2 config', function () {
const moduleConfig = getConfig()
- const bidderConfig = config.getBidderConfig()
const acBidders = moduleConfig.params.acBidders
const sampleOrtbConfig = {
- ortb2: {
- site: {
- name: 'example'
- },
- user: {
- keywords: 'a,b',
- data: [
- {
- name: 'www.dataprovider1.com',
- ext: { taxonomyname: 'iab_audience_taxonomy' },
- segment: [{ id: '687' }, { id: '123' }]
- }
- ]
- }
+ site: {
+ name: 'example'
+ },
+ user: {
+ keywords: 'a,b',
+ data: [
+ {
+ name: 'www.dataprovider1.com',
+ ext: { taxonomyname: 'iab_audience_taxonomy' },
+ segment: [{ id: '687' }, { id: '123' }]
+ }
+ ]
}
}
- config.setBidderConfig({
- bidders: acBidders,
- config: sampleOrtbConfig
- })
+ const bidderConfig = Object.fromEntries(acBidders.map(bidder => [bidder, sampleOrtbConfig]))
const transformedUserData = {
name: 'transformation',
@@ -124,14 +118,15 @@ describe('permutiveRtdProvider', function () {
segment: [1, 2, 3]
}
- setBidderRtb({}, moduleConfig, {
+ setBidderRtb(bidderConfig, moduleConfig, {
+ // TODO: this argument is unused, is the test still valid / needed?
testTransformation: userData => transformedUserData
})
acBidders.forEach(bidder => {
- expect(bidderConfig[bidder].ortb2.site.name).to.equal(sampleOrtbConfig.ortb2.site.name)
- expect(bidderConfig[bidder].ortb2.user.keywords).to.equal(sampleOrtbConfig.ortb2.user.keywords)
- expect(bidderConfig[bidder].ortb2.user.data).to.deep.include.members([sampleOrtbConfig.ortb2.user.data[0]])
+ expect(bidderConfig[bidder].site.name).to.equal(sampleOrtbConfig.site.name)
+ expect(bidderConfig[bidder].user.keywords).to.equal(sampleOrtbConfig.user.keywords)
+ expect(bidderConfig[bidder].user.data).to.deep.include.members([sampleOrtbConfig.user.data[0]])
})
})
})
diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js
index 434f668aad0..7aa6a5c7f42 100644
--- a/test/spec/modules/prebidServerBidAdapter_spec.js
+++ b/test/spec/modules/prebidServerBidAdapter_spec.js
@@ -501,8 +501,7 @@ describe('S2S Adapter', function () {
'sizes': [300, 250],
'bidId': '123',
'bidderRequestId': '3d1063078dfcc8',
- 'auctionId': '173afb6d132ba3',
- 'storedAuctionResponse': 11111
+ 'auctionId': '173afb6d132ba3'
}
],
'auctionStart': 1510852447530,
@@ -510,7 +509,7 @@ describe('S2S Adapter', function () {
'src': 's2s',
'doneCbCallCount': 0,
'refererInfo': {
- 'referer': 'http://mytestpage.com'
+ 'page': 'http://mytestpage.com'
}
}
];
@@ -645,6 +644,14 @@ describe('S2S Adapter', function () {
expect(adapter.callBids).to.exist.and.to.be.a('function');
});
+ function mockConsent({applies = true, hasP1Consent = true} = {}) {
+ return {
+ consentString: 'mockConsent',
+ gdprApplies: applies,
+ vendorData: {purpose: {consents: {1: hasP1Consent}}},
+ }
+ }
+
describe('gdpr tests', function () {
afterEach(function () {
$$PREBID_GLOBAL$$.requestBids.removeAll();
@@ -655,16 +662,13 @@ describe('S2S Adapter', function () {
config.setConfig(consentConfig);
let gdprBidRequest = utils.deepClone(BID_REQUESTS);
- gdprBidRequest[0].gdprConsent = {
- consentString: 'abc123',
- gdprApplies: true
- };
+ gdprBidRequest[0].gdprConsent = mockConsent();
adapter.callBids(REQUEST, gdprBidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.regs.ext.gdpr).is.equal(1);
- expect(requestBid.user.ext.consent).is.equal('abc123');
+ expect(requestBid.user.ext.consent).is.equal('mockConsent');
config.resetConfig();
config.setConfig({ s2sConfig: CONFIG });
@@ -681,17 +685,15 @@ describe('S2S Adapter', function () {
config.setConfig(consentConfig);
let gdprBidRequest = utils.deepClone(BID_REQUESTS);
- gdprBidRequest[0].gdprConsent = {
- consentString: 'abc123',
+ gdprBidRequest[0].gdprConsent = Object.assign(mockConsent(), {
addtlConsent: 'superduperconsent',
- gdprApplies: true
- };
+ });
adapter.callBids(REQUEST, gdprBidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.regs.ext.gdpr).is.equal(1);
- expect(requestBid.user.ext.consent).is.equal('abc123');
+ expect(requestBid.user.ext.consent).is.equal('mockConsent');
expect(requestBid.user.ext.ConsentedProvidersSettings.consented_providers).is.equal('superduperconsent');
config.resetConfig();
@@ -713,10 +715,7 @@ describe('S2S Adapter', function () {
let gdprBidRequest = utils.deepClone(BID_REQUESTS);
- gdprBidRequest[0].gdprConsent = {
- consentString: 'abc123def',
- gdprApplies: true
- };
+ gdprBidRequest[0].gdprConsent = mockConsent();
const s2sBidRequest = utils.deepClone(REQUEST);
s2sBidRequest.s2sConfig = cookieSyncConfig;
@@ -725,7 +724,7 @@ describe('S2S Adapter', function () {
let requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.gdpr).is.equal(1);
- expect(requestBid.gdpr_consent).is.equal('abc123def');
+ expect(requestBid.gdpr_consent).is.equal('mockConsent');
expect(requestBid.bidders).to.contain('appnexus').and.to.have.lengthOf(1);
expect(requestBid.account).is.equal('1');
});
@@ -741,10 +740,7 @@ describe('S2S Adapter', function () {
s2sBidRequest.s2sConfig = cookieSyncConfig;
let gdprBidRequest = utils.deepClone(BID_REQUESTS);
- gdprBidRequest[0].gdprConsent = {
- consentString: 'xyz789abcc',
- gdprApplies: false
- };
+ gdprBidRequest[0].gdprConsent = mockConsent({applies: false});
adapter.callBids(s2sBidRequest, gdprBidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);
@@ -761,10 +757,7 @@ describe('S2S Adapter', function () {
config.setConfig(consentConfig);
let gdprBidRequest = utils.deepClone(BID_REQUESTS);
- gdprBidRequest[0].gdprConsent = {
- consentString: undefined,
- gdprApplies: false
- };
+ gdprBidRequest[0].gdprConsent = mockConsent({applies: false});
const s2sBidRequest = utils.deepClone(REQUEST);
s2sBidRequest.s2sConfig = cookieSyncConfig;
@@ -832,17 +825,14 @@ describe('S2S Adapter', function () {
let consentBidRequest = utils.deepClone(BID_REQUESTS);
consentBidRequest[0].uspConsent = '1NYN';
- consentBidRequest[0].gdprConsent = {
- consentString: 'abc123',
- gdprApplies: true
- };
+ consentBidRequest[0].gdprConsent = mockConsent();
adapter.callBids(REQUEST, consentBidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.regs.ext.us_privacy).is.equal('1NYN');
expect(requestBid.regs.ext.gdpr).is.equal(1);
- expect(requestBid.user.ext.consent).is.equal('abc123');
+ expect(requestBid.user.ext.consent).is.equal('mockConsent');
config.resetConfig();
config.setConfig({ s2sConfig: CONFIG });
@@ -861,10 +851,7 @@ describe('S2S Adapter', function () {
let consentBidRequest = utils.deepClone(BID_REQUESTS);
consentBidRequest[0].uspConsent = '1YNN';
- consentBidRequest[0].gdprConsent = {
- consentString: 'abc123def',
- gdprApplies: true
- };
+ consentBidRequest[0].gdprConsent = mockConsent();
const s2sBidRequest = utils.deepClone(REQUEST);
s2sBidRequest.s2sConfig = cookieSyncConfig
@@ -874,7 +861,7 @@ describe('S2S Adapter', function () {
expect(requestBid.us_privacy).is.equal('1YNN');
expect(requestBid.gdpr).is.equal(1);
- expect(requestBid.gdpr_consent).is.equal('abc123def');
+ expect(requestBid.gdpr_consent).is.equal('mockConsent');
expect(requestBid.bidders).to.contain('appnexus').and.to.have.lengthOf(1);
expect(requestBid.account).is.equal('1');
});
@@ -928,24 +915,6 @@ describe('S2S Adapter', function () {
});
});
- it('adds debugging value from storedAuctionResponse to OpenRTB', function () {
- const _config = {
- s2sConfig: CONFIG,
- device: { ifa: '6D92078A-8246-4BA4-AE5B-76104861E7DC' },
- app: { bundle: 'com.test.app' }
- };
-
- config.setConfig(_config);
- adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
- const requestBid = JSON.parse(server.requests[0].requestBody);
- expect(requestBid.imp).to.exist.and.to.be.a('array');
- expect(requestBid.imp).to.have.lengthOf(1);
- expect(requestBid.imp[0].ext).to.exist.and.to.be.a('object');
- expect(requestBid.imp[0].ext.prebid).to.exist.and.to.be.a('object');
- expect(requestBid.imp[0].ext.prebid.storedauctionresponse).to.exist.and.to.be.a('object');
- expect(requestBid.imp[0].ext.prebid.storedauctionresponse.id).to.equal('11111');
- });
-
describe('price floors module', function () {
function runTest(expectedFloor, expectedCur) {
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
@@ -1371,7 +1340,7 @@ describe('S2S Adapter', function () {
config.setConfig({ s2sConfig: CONFIG });
const aliasBidder = {
- bidder: 'brealtime',
+ bidder: 'beintoo',
params: { placementId: '123456' }
};
@@ -1384,7 +1353,7 @@ describe('S2S Adapter', function () {
expect(requestBid.ext).to.haveOwnProperty('prebid');
expect(requestBid.ext.prebid).to.deep.include({
aliases: {
- brealtime: 'appnexus'
+ beintoo: 'appnexus'
},
auctiontimestamp: 1510852447530,
targeting: {
@@ -1521,11 +1490,12 @@ describe('S2S Adapter', function () {
adapter.callBids(myRequest, BID_REQUESTS, addBidResponse, done, ajax);
const requestBid = JSON.parse(server.requests[0].requestBody);
- expect(requestBid.imp[0].ext.appnexus).to.exist;
- expect(requestBid.imp[0].ext.appnexus.placement_id).to.exist.and.to.equal(10433394);
- expect(requestBid.imp[0].ext.appnexus.use_pmt_rule).to.exist.and.to.be.true;
- expect(requestBid.imp[0].ext.appnexus.member).to.exist;
- expect(requestBid.imp[0].ext.appnexus.keywords).to.exist.and.to.deep.equal([{
+ const requestParams = requestBid.imp[0].ext.prebid.bidder;
+ expect(requestParams.appnexus).to.exist;
+ expect(requestParams.appnexus.placement_id).to.exist.and.to.equal(10433394);
+ expect(requestParams.appnexus.use_pmt_rule).to.exist.and.to.be.true;
+ expect(requestParams.appnexus.member).to.exist;
+ expect(requestParams.appnexus.keywords).to.exist.and.to.deep.equal([{
key: 'foo',
value: ['bar', 'baz']
}, {
@@ -1605,8 +1575,9 @@ describe('S2S Adapter', function () {
config.setConfig(_config);
adapter.callBids(s2sBidRequest, BID_REQUESTS, addBidResponse, done, ajax);
const requestBid = JSON.parse(server.requests[0].requestBody);
- expect(requestBid.imp[0].ext.appnexus).to.haveOwnProperty('key');
- expect(requestBid.imp[0].ext.appnexus.key).to.be.equal('value')
+ const requestParams = requestBid.imp[0].ext.prebid.bidder;
+ expect(requestParams.appnexus).to.haveOwnProperty('key');
+ expect(requestParams.appnexus.key).to.be.equal('value')
});
describe('config site value is added to the oRTB request', function () {
@@ -1983,7 +1954,7 @@ describe('S2S Adapter', function () {
const s2sBidRequest = utils.deepClone(REQUEST);
const bidRequests = utils.deepClone(BID_REQUESTS);
- const commonContext = {
+ const commonSite = {
keywords: ['power tools'],
search: 'drill'
};
@@ -1992,19 +1963,23 @@ describe('S2S Adapter', function () {
gender: 'M'
};
- const context = {
- content: { userrating: 4 },
- data: {
- pageType: 'article',
- category: 'tools'
+ const site = {
+ content: {userrating: 4},
+ ext: {
+ data: {
+ pageType: 'article',
+ category: 'tools'
+ }
}
};
const user = {
yob: '1984',
geo: { country: 'ca' },
- data: {
- registered: true,
- interests: ['cars']
+ ext: {
+ data: {
+ registered: true,
+ interests: ['cars']
+ }
}
};
const bcat = ['IAB25', 'IAB7-39'];
@@ -2042,11 +2017,14 @@ describe('S2S Adapter', function () {
const commonContextExpected = utils.mergeDeep({
'page': 'http://mytestpage.com',
'publisher': { 'id': '1' }
- }, commonContext);
+ }, commonSite);
- config.setConfig({ fpd: { context: commonContext, user: commonUser, badv, bcat } });
- config.setBidderConfig({ bidders: allowedBidders, config: { fpd: { context, user, bcat, badv } } });
- adapter.callBids(s2sBidRequest, bidRequests, addBidResponse, done, ajax);
+ const ortb2Fragments = {
+ global: {site: commonSite, user: commonUser, badv, bcat},
+ bidder: Object.fromEntries(allowedBidders.map(bidder => [bidder, {site, user, bcat, badv}]))
+ };
+
+ adapter.callBids({...s2sBidRequest, ortb2Fragments}, bidRequests, addBidResponse, done, ajax);
const parsedRequestBody = JSON.parse(server.requests[0].requestBody);
expect(parsedRequestBody.ext.prebid.bidderconfig).to.deep.equal(expected);
expect(parsedRequestBody.site).to.deep.equal(commonContextExpected);
diff --git a/test/spec/modules/pubgeniusBidAdapter_spec.js b/test/spec/modules/pubgeniusBidAdapter_spec.js
index 4599eb2a6fa..1d1b0e65ec8 100644
--- a/test/spec/modules/pubgeniusBidAdapter_spec.js
+++ b/test/spec/modules/pubgeniusBidAdapter_spec.js
@@ -239,17 +239,8 @@ describe('pubGENIUS adapter', () => {
expect(buildRequests([bidRequest], bidderRequest)).to.deep.equal(expectedRequest);
});
- it('should take pageUrl in config over referer in refererInfo', () => {
- config.setConfig({ pageUrl: 'http://pageurl.org' });
- bidderRequest.refererInfo.referer = 'http://referer.org';
- expectedRequest.data.site = { page: 'http://pageurl.org' };
-
- expect(buildRequests([bidRequest], bidderRequest)).to.deep.equal(expectedRequest);
- });
-
- it('should use canonical URL over referer in refererInfo', () => {
- bidderRequest.refererInfo.canonicalUrl = 'http://pageurl.org';
- bidderRequest.refererInfo.referer = 'http://referer.org';
+ it('should use page from refererInfo', () => {
+ bidderRequest.refererInfo.page = 'http://pageurl.org';
expectedRequest.data.site = { page: 'http://pageurl.org' };
expect(buildRequests([bidRequest], bidderRequest)).to.deep.equal(expectedRequest);
diff --git a/test/spec/modules/pubmaticAnalyticsAdapter_spec.js b/test/spec/modules/pubmaticAnalyticsAdapter_spec.js
index 02b4c8d1905..fa4519c84e1 100755
--- a/test/spec/modules/pubmaticAnalyticsAdapter_spec.js
+++ b/test/spec/modules/pubmaticAnalyticsAdapter_spec.js
@@ -149,7 +149,7 @@ const MOCK = {
],
'timeout': 3000,
'refererInfo': {
- 'referer': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
+ 'topmostLocation': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
}
}
],
@@ -207,7 +207,7 @@ const MOCK = {
'timeout': 5000,
'start': 1519149562216,
'refererInfo': {
- 'referer': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
+ 'topmostLocation': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
},
'gdprConsent': {
'consentString': 'here-goes-gdpr-consent-string',
diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js
index 5215afcdcd7..e8bedc851c7 100644
--- a/test/spec/modules/pubmaticBidAdapter_spec.js
+++ b/test/spec/modules/pubmaticBidAdapter_spec.js
@@ -1632,43 +1632,29 @@ describe('PubMatic adapter', function () {
let newRequest;
it('ortb2.site should be merged in the request', function() {
- let sandbox = sinon.sandbox.create();
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- 'ortb2': {
- site: {
- domain: 'page.example.com',
- cat: ['IAB2'],
- sectioncat: ['IAB2-2']
- }
- }
- };
- return config[key];
- });
- const request = spec.buildRequests(bidRequests, {});
+ const ortb2 = {
+ site: {
+ domain: 'page.example.com',
+ cat: ['IAB2'],
+ sectioncat: ['IAB2-2']
+ }
+ };
+ const request = spec.buildRequests(bidRequests, {ortb2});
let data = JSON.parse(request.data);
expect(data.site.domain).to.equal('page.example.com');
expect(data.site.cat).to.deep.equal(['IAB2']);
expect(data.site.sectioncat).to.deep.equal(['IAB2-2']);
- sandbox.restore();
});
it('ortb2.user should be merged in the request', function() {
- let sandbox = sinon.sandbox.create();
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- 'ortb2': {
- user: {
- yob: 1985
- }
- }
- };
- return config[key];
- });
- const request = spec.buildRequests(bidRequests, {});
+ const ortb2 = {
+ user: {
+ yob: 1985
+ }
+ };
+ const request = spec.buildRequests(bidRequests, {ortb2});
let data = JSON.parse(request.data);
expect(data.user.yob).to.equal(1985);
- sandbox.restore();
});
describe('ortb2Imp', function() {
@@ -2389,68 +2375,6 @@ describe('PubMatic adapter', function () {
expect(data.user.eids).to.equal(undefined);
});
});
-
- describe('FlocId', function() {
- it('send the FlocId if it is present', function() {
- bidRequests[0].userId = {};
- bidRequests[0].userId.flocId = {
- id: '1234',
- version: 'chrome1.1'
- }
- let request = spec.buildRequests(bidRequests, {});
- let data = JSON.parse(request.data);
- expect(data.user.eids).to.deep.equal([{
- 'source': 'chrome.com',
- 'uids': [{
- 'id': '1234',
- 'atype': 1,
- 'ext': {
- 'ver': 'chrome1.1'
- }
- }]
- }]);
- expect(data.user.data).to.deep.equal([{
- id: 'FLOC',
- name: 'FLOC',
- ext: {
- ver: 'chrome1.1'
- },
- segment: [{
- id: '1234',
- name: 'chrome.com',
- value: '1234'
- }]
- }]);
- });
-
- it('appnend the flocId if userIds are present', function() {
- bidRequests[0].userId = {};
- bidRequests[0].userId.netId = 'netid-user-id';
- bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
- bidRequests[0].userId.flocId = {
- id: '1234',
- version: 'chrome1.1'
- }
- let request = spec.buildRequests(bidRequests, {});
- let data = JSON.parse(request.data);
- expect(data.user.eids).to.deep.equal([{
- 'source': 'netid.de',
- 'uids': [{
- 'id': 'netid-user-id',
- 'atype': 1
- }]
- }, {
- 'source': 'chrome.com',
- 'uids': [{
- 'id': '1234',
- 'atype': 1,
- 'ext': {
- 'ver': 'chrome1.1'
- }
- }]
- }]);
- });
- });
});
it('Request params check for video ad', function () {
@@ -3212,30 +3136,24 @@ describe('PubMatic adapter', function () {
expect(data.ext.acat).to.exist.and.to.deep.equal(['IAB1', 'IAB2', 'IAB3']);
});
it('ortb2.ext.prebid.bidderparams.pubmatic.acat should be passed in request payload', function() {
- let sandbox = sinon.sandbox.create();
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- 'ortb2': {
- ext: {
- prebid: {
- bidderparams: {
- pubmatic: {
- acat: ['IAB1', 'IAB2', 'IAB1', 'IAB2', 'IAB1', 'IAB2']
- }
- }
+ const ortb2 = {
+ ext: {
+ prebid: {
+ bidderparams: {
+ pubmatic: {
+ acat: ['IAB1', 'IAB2', 'IAB1', 'IAB2', 'IAB1', 'IAB2']
}
}
}
- };
- return config[key];
- });
+ }
+ };
const request = spec.buildRequests(bidRequests, {
auctionId: 'new-auction-id',
- bidderCode: 'pubmatic'
+ bidderCode: 'pubmatic',
+ ortb2
});
let data = JSON.parse(request.data);
expect(data.ext.acat).to.deep.equal(['IAB1', 'IAB2']);
- sandbox.restore();
});
});
@@ -3344,22 +3262,16 @@ describe('PubMatic adapter', function () {
it('ortb2.bcat should merged with slot level bcat param', function() {
multipleBidRequests[0].params.bcat = ['IAB-1', 'IAB-2'];
- let sandbox = sinon.sandbox.create();
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- 'ortb2': {
- bcat: ['IAB-3', 'IAB-4']
- }
- };
- return config[key];
- });
+ const ortb2 = {
+ bcat: ['IAB-3', 'IAB-4']
+ };
const request = spec.buildRequests(multipleBidRequests, {
auctionId: 'new-auction-id',
- bidderCode: 'pubmatic'
+ bidderCode: 'pubmatic',
+ ortb2
});
let data = JSON.parse(request.data);
expect(data.bcat).to.deep.equal(['IAB-1', 'IAB-2', 'IAB-3', 'IAB-4']);
- sandbox.restore();
});
});
diff --git a/test/spec/modules/pubwiseBidAdapter_spec.js b/test/spec/modules/pubwiseBidAdapter_spec.js
index 450b028f6c7..1cf7a7dd280 100644
--- a/test/spec/modules/pubwiseBidAdapter_spec.js
+++ b/test/spec/modules/pubwiseBidAdapter_spec.js
@@ -99,13 +99,15 @@ const sampleValidBannerBidRequest = {
'crumbs': {
'pubcid': '9a62f261-3c0b-4cc8-8db3-a72ae86ec6ba'
},
- 'fpd': {
- 'context': {
- 'adServer': {
- 'name': 'gam',
- 'adSlot': '/19968336/header-bid-tag-0'
- },
- 'pbAdSlot': '/19968336/header-bid-tag-0'
+ ortb2Imp: {
+ ext: {
+ data: {
+ adserver: {
+ name: 'gam',
+ adslot: '/19968336/header-bid-tag-0'
+ },
+ pbadslot: '/19968336/header-bid-tag-0',
+ }
}
},
'mediaTypes': {
@@ -175,13 +177,15 @@ const sampleValidBidRequests = [
'required': false
}
},
- 'fpd': {
- 'context': {
- 'adServer': {
- 'name': 'gam',
- 'adSlot': '/19968336/header-bid-tag-0'
- },
- 'pbAdSlot': '/19968336/header-bid-tag-0'
+ ortb2Imp: {
+ ext: {
+ data: {
+ adserver: {
+ name: 'gam',
+ adslot: '/19968336/header-bid-tag-0'
+ },
+ pbadslot: '/19968336/header-bid-tag-0',
+ }
}
},
'mediaTypes': {
@@ -246,13 +250,15 @@ const sampleBidderBannerRequest = {
'crumbs': {
'pubcid': '9a62f261-3c0b-4cc8-8db3-a72ae86ec6ba'
},
- 'fpd': {
- 'context': {
- 'adServer': {
- 'name': 'gam',
- 'adSlot': '/19968336/header-bid-tag-0'
- },
- 'pbAdSlot': '/19968336/header-bid-tag-0'
+ ortb2Imp: {
+ ext: {
+ data: {
+ adserver: {
+ name: 'gam',
+ adslot: '/19968336/header-bid-tag-0'
+ },
+ pbadslot: '/19968336/header-bid-tag-0',
+ }
}
},
'mediaTypes': {
@@ -327,13 +333,15 @@ const sampleBidderRequest = {
'required': false
}
},
- 'fpd': {
- 'context': {
- 'adServer': {
- 'name': 'gam',
- 'adSlot': '/19968336/header-bid-tag-0'
- },
- 'pbAdSlot': '/19968336/header-bid-tag-0'
+ ortb2Imp: {
+ ext: {
+ data: {
+ adserver: {
+ name: 'gam',
+ adslot: '/19968336/header-bid-tag-0'
+ },
+ pbadslot: '/19968336/header-bid-tag-0',
+ }
}
},
'mediaTypes': {
diff --git a/test/spec/modules/pulsepointBidAdapter_spec.js b/test/spec/modules/pulsepointBidAdapter_spec.js
index c8ec0493d54..4426c91e1ec 100644
--- a/test/spec/modules/pulsepointBidAdapter_spec.js
+++ b/test/spec/modules/pulsepointBidAdapter_spec.js
@@ -195,7 +195,8 @@ describe('PulsePoint Adapter Tests', function () {
const bidderRequest = {
refererInfo: {
- referer: 'https://publisher.com/home'
+ page: 'https://publisher.com/home',
+ ref: 'https://referrer'
}
};
@@ -208,7 +209,7 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.site).to.not.equal(null);
expect(ortbRequest.site.publisher).to.not.equal(null);
expect(ortbRequest.site.publisher.id).to.equal('p10000');
- expect(ortbRequest.site.ref).to.equal(window.top.document.referrer);
+ expect(ortbRequest.site.ref).to.equal(bidderRequest.refererInfo.ref);
expect(ortbRequest.site.page).to.equal('https://publisher.com/home');
expect(ortbRequest.imp).to.have.lengthOf(2);
// device object
diff --git a/test/spec/modules/pxyzBidAdapter_spec.js b/test/spec/modules/pxyzBidAdapter_spec.js
index 21dd252c909..3a336c86e46 100644
--- a/test/spec/modules/pxyzBidAdapter_spec.js
+++ b/test/spec/modules/pxyzBidAdapter_spec.js
@@ -8,7 +8,7 @@ const GDPR_CONSENT = 'XYZ-CONSENT';
const BIDDER_REQUEST = {
refererInfo: {
- referer: 'https://example.com'
+ page: 'https://example.com',
}
};
diff --git a/test/spec/modules/quantcastBidAdapter_spec.js b/test/spec/modules/quantcastBidAdapter_spec.js
index 5e0d129581c..d10fea829bc 100644
--- a/test/spec/modules/quantcastBidAdapter_spec.js
+++ b/test/spec/modules/quantcastBidAdapter_spec.js
@@ -19,7 +19,15 @@ describe('Quantcast adapter', function () {
let bidRequest;
let bidderRequest;
+ afterEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
beforeEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ quantcast: {
+ storageAllowed: true
+ }
+ };
bidRequest = {
bidder: 'quantcast',
bidId: '2f7b179d443f14',
@@ -39,8 +47,9 @@ describe('Quantcast adapter', function () {
bidderRequest = {
refererInfo: {
- referer: 'http://example.com/hello.html',
- canonicalUrl: 'http://example.com/hello.html'
+ page: 'http://example.com/hello.html',
+ ref: 'http://example.com/hello.html',
+ domain: 'example.com'
}
};
@@ -438,74 +447,6 @@ describe('Quantcast adapter', function () {
expect(parsed.gdprConsent).to.equal('consentString');
});
- it('allows TCF v1 request with consent for purpose 1', function () {
- const bidderRequest = {
- gdprConsent: {
- gdprApplies: true,
- consentString: 'consentString',
- vendorData: {
- vendorConsents: {
- '11': true
- },
- purposeConsents: {
- '1': true
- }
- },
- apiVersion: 1
- }
- };
-
- const requests = qcSpec.buildRequests([bidRequest], bidderRequest);
- const parsed = JSON.parse(requests[0].data);
-
- expect(parsed.gdprSignal).to.equal(1);
- expect(parsed.gdprConsent).to.equal('consentString');
- });
-
- it('blocks TCF v1 request without vendor consent', function () {
- const bidderRequest = {
- gdprConsent: {
- gdprApplies: true,
- consentString: 'consentString',
- vendorData: {
- vendorConsents: {
- '11': false
- },
- purposeConsents: {
- '1': true
- }
- },
- apiVersion: 1
- }
- };
-
- const requests = qcSpec.buildRequests([bidRequest], bidderRequest);
-
- expect(requests).to.equal(undefined);
- });
-
- it('blocks TCF v1 request without consent for purpose 1', function () {
- const bidderRequest = {
- gdprConsent: {
- gdprApplies: true,
- consentString: 'consentString',
- vendorData: {
- vendorConsents: {
- '11': true
- },
- purposeConsents: {
- '1': false
- }
- },
- apiVersion: 1
- }
- };
-
- const requests = qcSpec.buildRequests([bidRequest], bidderRequest);
-
- expect(requests).to.equal(undefined);
- });
-
it('allows TCF v2 request when Quantcast has consent for purpose 1', function() {
const bidderRequest = {
gdprConsent: {
diff --git a/test/spec/modules/qwarryBidAdapter_spec.js b/test/spec/modules/qwarryBidAdapter_spec.js
index 560206681ee..5d48d92066a 100644
--- a/test/spec/modules/qwarryBidAdapter_spec.js
+++ b/test/spec/modules/qwarryBidAdapter_spec.js
@@ -89,7 +89,7 @@ describe('qwarryBidAdapter', function () {
consentString: 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='
},
refererInfo: {
- referer: 'http://test.com/path.html'
+ page: 'http://test.com/path.html',
}
})
diff --git a/test/spec/modules/radsBidAdapter_spec.js b/test/spec/modules/radsBidAdapter_spec.js
index 271f7cb1147..3ad7ada2ae7 100644
--- a/test/spec/modules/radsBidAdapter_spec.js
+++ b/test/spec/modules/radsBidAdapter_spec.js
@@ -105,13 +105,13 @@ describe('radsAdapter', function () {
// Without gdprConsent
let bidderRequest = {
refererInfo: {
- referer: 'some_referrer.net'
+ page: 'some_referrer.net'
}
}
// With gdprConsent
var bidderRequestGdprConsent = {
refererInfo: {
- referer: 'some_referrer.net'
+ page: 'some_referrer.net'
},
gdprConsent: {
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
diff --git a/test/spec/modules/readpeakBidAdapter_spec.js b/test/spec/modules/readpeakBidAdapter_spec.js
index 04358fad52b..758bef49c20 100644
--- a/test/spec/modules/readpeakBidAdapter_spec.js
+++ b/test/spec/modules/readpeakBidAdapter_spec.js
@@ -16,7 +16,8 @@ describe('ReadPeakAdapter', function() {
beforeEach(function() {
bidderRequest = {
refererInfo: {
- referer: 'https://publisher.com/home'
+ page: 'https://publisher.com/home',
+ domain: 'publisher.com'
}
};
@@ -266,8 +267,8 @@ describe('ReadPeakAdapter', function() {
expect(data.imp[0].tagId).to.equal('test-tag-1');
expect(data.site.publisher.id).to.equal(nativeBidRequest.params.publisherId);
expect(data.site.id).to.equal(nativeBidRequest.params.siteId);
- expect(data.site.page).to.equal(bidderRequest.refererInfo.referer);
- expect(data.site.domain).to.equal(parseUrl(bidderRequest.refererInfo.referer).hostname);
+ expect(data.site.page).to.equal(bidderRequest.refererInfo.page);
+ expect(data.site.domain).to.equal(bidderRequest.refererInfo.domain);
expect(data.device).to.deep.contain({
ua: navigator.userAgent,
language: navigator.language
@@ -428,8 +429,8 @@ describe('ReadPeakAdapter', function() {
expect(data.imp[0].tagId).to.equal('test-tag-1');
expect(data.site.publisher.id).to.equal(bannerBidRequest.params.publisherId);
expect(data.site.id).to.equal(bannerBidRequest.params.siteId);
- expect(data.site.page).to.equal(bidderRequest.refererInfo.referer);
- expect(data.site.domain).to.equal(parseUrl(bidderRequest.refererInfo.referer).hostname);
+ expect(data.site.page).to.equal(bidderRequest.refererInfo.page);
+ expect(data.site.domain).to.equal(bidderRequest.refererInfo.domain);
expect(data.device).to.deep.contain({
ua: navigator.userAgent,
language: navigator.language
diff --git a/test/spec/modules/relaidoBidAdapter_spec.js b/test/spec/modules/relaidoBidAdapter_spec.js
index f0d381ee3ed..cea49424b4d 100644
--- a/test/spec/modules/relaidoBidAdapter_spec.js
+++ b/test/spec/modules/relaidoBidAdapter_spec.js
@@ -51,7 +51,7 @@ describe('RelaidoAdapter', function () {
bidderRequest = {
timeout: 1000,
refererInfo: {
- referer: 'https://publisher.com/home'
+ page: 'https://publisher.com/home'
}
};
serverResponse = {
@@ -211,7 +211,7 @@ describe('RelaidoAdapter', function () {
const request = data.bids[0];
expect(bidRequests.method).to.equal('POST');
expect(bidRequests.url).to.equal('https://api.relaido.jp/bid/v1/sprebid');
- expect(data.ref).to.equal(bidderRequest.refererInfo.referer);
+ expect(data.ref).to.equal(bidderRequest.refererInfo.page);
expect(data.timeout_ms).to.equal(bidderRequest.timeout);
expect(request.ad_unit_code).to.equal(bidRequest.adUnitCode);
expect(request.auction_id).to.equal(bidRequest.auctionId);
diff --git a/test/spec/modules/revcontentBidAdapter_spec.js b/test/spec/modules/revcontentBidAdapter_spec.js
index 022dd0e1aa9..e6ef4adec87 100644
--- a/test/spec/modules/revcontentBidAdapter_spec.js
+++ b/test/spec/modules/revcontentBidAdapter_spec.js
@@ -45,7 +45,7 @@ describe('revcontent adapter', function () {
endpoint: 'trends-s0.revcontent.com'
}
}];
- let request = spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}});
+ let request = spec.buildRequests(validBidRequests, {refererInfo: {page: 'page'}});
request = request[0];
assert.equal(request.method, 'POST');
assert.equal(request.url, 'https://trends-s0.revcontent.com/rtb?apiKey=8a33fa9cf220ae685dcc3544f847cdda858d3b1c&userId=673&widgetId=33861');
@@ -66,7 +66,7 @@ describe('revcontent adapter', function () {
endpoint: 'trends-s0.revcontent.com'
}
}];
- let request = spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}});
+ let request = spec.buildRequests(validBidRequests, {refererInfo: {page: 'page'}});
request = request[0];
let data = Object.keys(request);
@@ -87,7 +87,7 @@ describe('revcontent adapter', function () {
bidfloor: 0.05
}
}];
- let request = spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}});
+ let request = spec.buildRequests(validBidRequests, {refererInfo: {page: 'page'}});
request = JSON.parse(request[0].data);
assert.equal(request.imp[0].bidfloor, 0.05);
assert.equal(request.device.ua, navigator.userAgent);
@@ -112,7 +112,7 @@ describe('revcontent adapter', function () {
currency: 'USD'
};
};
- let request = spec.buildRequests(validBidRequests, {refererInfo: {referer: 'page'}});
+ let request = spec.buildRequests(validBidRequests, {refererInfo: {page: 'page'}});
request = JSON.parse(request[0].data);
assert.equal(request.imp[0].bidfloor, 0.07);
assert.equal(request.device.ua, navigator.userAgent);
@@ -146,7 +146,7 @@ describe('revcontent adapter', function () {
endpoint: 'trends-s0.revcontent.com'
}
}];
- let refererInfo = {referer: 'page'};
+ let refererInfo = {page: 'page'};
let request = spec.buildRequests(validBidRequests, {refererInfo});
request = JSON.parse(request[0].data);
diff --git a/test/spec/modules/rhythmoneBidAdapter_spec.js b/test/spec/modules/rhythmoneBidAdapter_spec.js
index e0e58fc89cd..359b02db37e 100644
--- a/test/spec/modules/rhythmoneBidAdapter_spec.js
+++ b/test/spec/modules/rhythmoneBidAdapter_spec.js
@@ -8,7 +8,7 @@ describe('rhythmone adapter tests', function () {
beforeEach(function() {
this.defaultBidderRequest = {
'refererInfo': {
- 'referer': 'Reference Page',
+ 'ref': 'Reference Page',
'stack': [
'aodomain.dvl',
'page.dvl'
@@ -647,35 +647,6 @@ describe('rhythmone adapter tests', function () {
});
});
- it('should return empty site.domain and site.page when refererInfo.stack is empty', function() {
- this.defaultBidderRequest.refererInfo.stack = [];
- var bidRequestList = [
- {
- 'bidder': 'rhythmone',
- 'params': {
- 'placementId': 'myplacement',
- 'zone': 'myzone',
- 'path': 'mypath'
- },
- 'mediaType': 'banner',
- 'adUnitCode': 'div-gpt-ad-1438287399331-0',
- 'sizes': [[300, 250]],
- 'transactionId': 'd7b773de-ceaa-484d-89ca-d9f51b8d61ec',
- 'bidderRequestId': '418b37f85e772c',
- 'auctionId': '18fd8b8b0bd757',
- 'bidRequestsCount': 1,
- 'bidId': '51ef8751f9aead'
- }
- ];
-
- var bidRequest = r1adapter.buildRequests(bidRequestList, this.defaultBidderRequest);
- const openrtbRequest = JSON.parse(bidRequest.data);
-
- expect(openrtbRequest.site.domain).to.equal('');
- expect(openrtbRequest.site.page).to.equal('');
- expect(openrtbRequest.site.ref).to.equal('Reference Page');
- });
-
it('should secure correctly', function() {
this.defaultBidderRequest.refererInfo.stack[0] = ['https://securesite.dvl'];
var bidRequestList = [
diff --git a/test/spec/modules/richaudienceBidAdapter_spec.js b/test/spec/modules/richaudienceBidAdapter_spec.js
index 9e9366072be..86d3df8be59 100644
--- a/test/spec/modules/richaudienceBidAdapter_spec.js
+++ b/test/spec/modules/richaudienceBidAdapter_spec.js
@@ -176,7 +176,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'http://domain.com',
+ page: 'http://domain.com',
numIframes: 0
}
}
@@ -205,7 +205,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -246,7 +246,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -265,7 +265,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -296,7 +296,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -311,7 +311,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -334,7 +334,7 @@ describe('Richaudience adapter tests', function () {
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA'
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -583,7 +583,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -611,7 +611,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -640,7 +640,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
@@ -669,7 +669,7 @@ describe('Richaudience adapter tests', function () {
gdprApplies: true
},
refererInfo: {
- referer: 'https://domain.com',
+ page: 'https://domain.com',
numIframes: 0
}
});
diff --git a/test/spec/modules/rubiconAnalyticsAdapter_spec.js b/test/spec/modules/rubiconAnalyticsAdapter_spec.js
index 1f52e83dab9..bef3eda0afc 100644
--- a/test/spec/modules/rubiconAnalyticsAdapter_spec.js
+++ b/test/spec/modules/rubiconAnalyticsAdapter_spec.js
@@ -235,7 +235,7 @@ const MOCK = {
],
'timeout': 3000,
'refererInfo': {
- 'referer': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
+ 'page': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
}
}
],
@@ -319,7 +319,7 @@ const MOCK = {
'timeout': 5000,
'start': 1519149562216,
'refererInfo': {
- 'referer': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
+ 'page': 'http://www.test.com/page.html', 'reachedTop': true, 'numIframes': 0, 'stack': ['http://www.test.com/page.html']
}
},
BID_RESPONSE: [
diff --git a/test/spec/modules/rubiconBidAdapter_spec.js b/test/spec/modules/rubiconBidAdapter_spec.js
index 46b1b519a81..ebfe6689a3e 100644
--- a/test/spec/modules/rubiconBidAdapter_spec.js
+++ b/test/spec/modules/rubiconBidAdapter_spec.js
@@ -248,7 +248,6 @@ describe('the rubicon adapter', function () {
criteoId: '1111',
};
bid.userIdAsEids = createEidsArray(bid.userId);
- bid.storedAuctionResponse = 11111;
}
function createVideoBidderRequestNoVideo() {
@@ -666,7 +665,7 @@ describe('the rubicon adapter', function () {
it('should add referer info to request data', function () {
let refererInfo = {
- referer: 'https://www.prebid.org',
+ page: 'https://www.prebid.org',
reachedTop: true,
numIframes: 1,
stack: [
@@ -683,29 +682,20 @@ describe('the rubicon adapter', function () {
expect(parseQuery(request.data).rf).to.equal('https://www.prebid.org');
});
- it('page_url should use params.referrer, config.getConfig("pageUrl"), bidderRequest.refererInfo in that order', function () {
+ it('page_url should use params.referrer, bidderRequest.refererInfo in that order', function () {
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(parseQuery(request.data).rf).to.equal('localhost');
delete bidderRequest.bids[0].params.referrer;
- let refererInfo = {referer: 'https://www.prebid.org'};
+ let refererInfo = {page: 'https://www.prebid.org'};
bidderRequest = Object.assign({refererInfo}, bidderRequest);
[request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(parseQuery(request.data).rf).to.equal('https://www.prebid.org');
- let origGetConfig = config.getConfig;
- sandbox.stub(config, 'getConfig').callsFake(function (key) {
- if (key === 'pageUrl') {
- return 'https://www.rubiconproject.com';
- }
- return origGetConfig.apply(config, arguments);
- });
- [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
- expect(parseQuery(request.data).rf).to.equal('https://www.rubiconproject.com');
-
+ bidderRequest.refererInfo.page = 'http://www.prebid.org';
bidderRequest.bids[0].params.secure = true;
[request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
- expect(parseQuery(request.data).rf).to.equal('https://www.rubiconproject.com');
+ expect(parseQuery(request.data).rf).to.equal('https://www.prebid.org');
});
it('should use rubicon sizes if present (including non-mappable sizes)', function () {
@@ -927,15 +917,10 @@ describe('the rubicon adapter', function () {
}
};
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2: {
- site,
- user
- }
- };
- return utils.deepAccess(config, key);
- });
+ const ortb2 = {
+ site,
+ user
+ }
const expectedQuery = {
'kw': 'a,b,c,d',
@@ -953,7 +938,7 @@ describe('the rubicon adapter', function () {
};
// get the built request
- let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
+ let [request] = spec.buildRequests(bidderRequest.bids.map((b) => ({...b, ortb2})), bidderRequest);
let data = parseQuery(request.data);
// make sure that tg_v, tg_i, and kw values are correct
@@ -1630,6 +1615,47 @@ describe('the rubicon adapter', function () {
expect(post.ext.prebid.bidders.rubicon.integration).to.equal(PBS_INTEGRATION);
});
+ describe('ortb2imp sent to video bids', function () {
+ beforeEach(function () {
+ // initialize
+ if (bidderRequest.bids[0].hasOwnProperty('ortb2Imp')) {
+ delete bidderRequest.bids[0].ortb2Imp;
+ }
+ });
+
+ it('should add ortb values to video requests', function () {
+ createVideoBidderRequest();
+
+ sandbox.stub(Date, 'now').callsFake(() =>
+ bidderRequest.auctionStart + 100
+ );
+
+ bidderRequest.bids[0].ortb2Imp = {
+ ext: {
+ gpid: '/test/gpid',
+ data: {
+ pbadslot: '/test/pbadslot'
+ },
+ prebid: {
+ storedauctionresponse: {
+ id: 'sample_video_response'
+ }
+ }
+ }
+ }
+
+ let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
+ let post = request.data;
+
+ expect(post).to.have.property('imp');
+ // .with.length.of(1);
+ let imp = post.imp[0];
+ expect(imp.ext.gpid).to.equal('/test/gpid');
+ expect(imp.ext.data.pbadslot).to.equal('/test/pbadslot');
+ expect(imp.ext.prebid.storedauctionresponse.id).to.equal('sample_video_response');
+ });
+ });
+
it('should correctly set bidfloor on imp when getfloor in scope', function () {
createVideoBidderRequest();
// default getFloor response is empty object so should not break and not send hard_floor
@@ -2072,17 +2098,12 @@ describe('the rubicon adapter', function () {
data: [{foo: 'bar'}]
};
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2: {
- site,
- user
- }
- };
- return utils.deepAccess(config, key);
- });
+ const ortb2 = {
+ site,
+ user
+ };
- const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
+ const [request] = spec.buildRequests(bidderRequest.bids.map((b) => ({...b, ortb2})), bidderRequest);
const expected = {
site: Object.assign({}, site, {keywords: bidderRequest.bids[0].params.keywords.join(',')}),
@@ -2100,22 +2121,6 @@ describe('the rubicon adapter', function () {
expect(request.data.user.ext.data).to.deep.equal(expected.userData);
});
- it('should include storedAuctionResponse in video bid request', function () {
- createVideoBidderRequest();
-
- sandbox.stub(Date, 'now').callsFake(() =>
- bidderRequest.auctionStart + 100
- );
-
- const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
- expect(request.data.imp).to.exist.and.to.be.a('array');
- expect(request.data.imp).to.have.lengthOf(1);
- expect(request.data.imp[0].ext).to.exist.and.to.be.a('object');
- expect(request.data.imp[0].ext.prebid).to.exist.and.to.be.a('object');
- expect(request.data.imp[0].ext.prebid.storedauctionresponse).to.exist.and.to.be.a('object');
- expect(request.data.imp[0].ext.prebid.storedauctionresponse.id).to.equal('11111');
- });
-
it('should include pbadslot in bid request', function () {
createVideoBidderRequest();
bidderRequest.bids[0].ortb2Imp = {
diff --git a/test/spec/modules/seedtagBidAdapter_spec.js b/test/spec/modules/seedtagBidAdapter_spec.js
index 1e0dca68d00..fc659f4de69 100644
--- a/test/spec/modules/seedtagBidAdapter_spec.js
+++ b/test/spec/modules/seedtagBidAdapter_spec.js
@@ -196,7 +196,7 @@ describe('Seedtag Adapter', function () {
describe('buildRequests method', function () {
const bidderRequest = {
- refererInfo: { referer: 'referer' },
+ refererInfo: { page: 'referer' },
timeout: 1000,
};
const mandatoryParams = {
diff --git a/test/spec/modules/shareUserIds_spec.js b/test/spec/modules/shareUserIds_spec.js
deleted file mode 100644
index 67e39533fc7..00000000000
--- a/test/spec/modules/shareUserIds_spec.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import {userIdTargeting} from '../../../modules/userIdTargeting.js';
-import { expect } from 'chai';
-
-describe('#userIdTargeting', function() {
- let userIds;
- let config;
-
- beforeEach(function() {
- userIds = {
- tdid: 'my-tdid'
- };
- config = {
- 'GAM': true,
- 'GAM_KEYS': {
- 'tdid': 'TD_ID'
- }
- };
- });
-
- it('Do nothing if config is invaild', function() {
- let pubads = window.googletag.pubads();
- pubads.clearTargeting();
- pubads.setTargeting('test', ['TEST']);
- userIdTargeting(userIds, JSON.stringify(config));
- expect(pubads.getTargeting('test')).to.deep.equal(['TEST']);
- });
-
- it('all UserIds are passed as is with GAM: true', function() {
- let pubads = window.googletag.pubads();
- pubads.clearTargeting();
- pubads.setTargeting('test', ['TEST']);
- delete config.GAM_KEYS;
- userIdTargeting(userIds, config);
- expect(pubads.getTargeting('test')).to.deep.equal(['TEST']);
- expect(pubads.getTargeting('tdid')).to.deep.equal(['my-tdid']);
- })
-
- it('Publisher prefered key-names are used', function() {
- let pubads = window.googletag.pubads();
- pubads.clearTargeting();
- pubads.setTargeting('test', ['TEST']);
- userIdTargeting(userIds, config);
- expect(pubads.getTargeting('test')).to.deep.equal(['TEST']);
- expect(pubads.getTargeting('TD_ID')).to.deep.equal(['my-tdid']);
- });
-
- it('Publisher does not want to pass an id', function() {
- let pubads = window.googletag.pubads();
- pubads.clearTargeting();
- pubads.setTargeting('test', ['TEST']);
- config.GAM_KEYS.tdid = '';
- userIdTargeting(userIds, config);
- expect(pubads.getTargeting('tdid')).to.be.an('array').that.is.empty;
- expect(pubads.getTargeting('test')).to.deep.equal(['TEST']);
- });
-
- it('User Id Targeting is added to googletag queue when GPT is not ready', function() {
- let pubads = window.googletag.pubads;
- delete window.googletag.pubads;
- userIdTargeting(userIds, config);
- window.googletag.pubads = pubads;
- window.googletag.cmd.map(command => command());
- expect(window.googletag.pubads().getTargeting('TD_ID')).to.deep.equal(['my-tdid']);
- });
-});
diff --git a/test/spec/modules/sharethroughBidAdapter_spec.js b/test/spec/modules/sharethroughBidAdapter_spec.js
index 39238cc877f..4ef93c9b530 100644
--- a/test/spec/modules/sharethroughBidAdapter_spec.js
+++ b/test/spec/modules/sharethroughBidAdapter_spec.js
@@ -114,10 +114,6 @@ describe('sharethrough adapter spec', function () {
sharedid: {
id: 'fake-sharedid',
},
- flocId: {
- id: 'fake-flocid',
- version: '42',
- },
},
crumbs: {
pubcid: 'fake-pubcid-in-crumbs-obj',
@@ -170,7 +166,7 @@ describe('sharethrough adapter spec', function () {
bidderRequest = {
refererInfo: {
- referer: 'https://referer.com',
+ ref: 'https://referer.com',
},
};
});
@@ -222,7 +218,6 @@ describe('sharethrough adapter spec', function () {
'crwdcntrl.net': { id: 'fake-lotame' },
'parrable.com': { id: 'fake-parrable' },
'netid.de': { id: 'fake-netid' },
- 'chrome.com': { id: 'fake-flocid' },
};
expect(openRtbReq.user.ext.eids).to.be.an('array').that.have.length(Object.keys(expectedEids).length);
for (const eid of openRtbReq.user.ext.eids) {
@@ -487,19 +482,8 @@ describe('sharethrough adapter spec', function () {
},
};
- let configStub;
-
- beforeEach(() => {
- configStub = sinon.stub(config, 'getConfig');
- configStub.withArgs('ortb2').returns(firstPartyData);
- });
-
- afterEach(() => {
- configStub.restore();
- });
-
it('should include first party data in open rtb request, site section', () => {
- const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
+ const openRtbReq = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: firstPartyData})[0].data;
expect(openRtbReq.site.name).to.equal(firstPartyData.site.name);
expect(openRtbReq.site.keywords).to.equal(firstPartyData.site.keywords);
@@ -509,7 +493,7 @@ describe('sharethrough adapter spec', function () {
});
it('should include first party data in open rtb request, user section', () => {
- const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
+ const openRtbReq = spec.buildRequests(bidRequests, {...bidderRequest, ortb2: firstPartyData})[0].data;
expect(openRtbReq.user.yob).to.equal(firstPartyData.user.yob);
expect(openRtbReq.user.gender).to.equal(firstPartyData.user.gender);
diff --git a/test/spec/modules/sirdataRtdProvider_spec.js b/test/spec/modules/sirdataRtdProvider_spec.js
index a16359c50cb..9cf392ebd62 100644
--- a/test/spec/modules/sirdataRtdProvider_spec.js
+++ b/test/spec/modules/sirdataRtdProvider_spec.js
@@ -42,7 +42,7 @@ describe('sirdataRtdProvider', function() {
contextual_categories: {'333333': 100}
};
- addSegmentData(adUnits, data, config, () => {});
+ addSegmentData({adUnits}, data, config, () => {});
expect(adUnits[0].bids[0].params.keywords).to.have.deep.property('sd_rtd', ['111111', '222222', '333333']);
expect(adUnits[0].bids[1].ortb2.site.ext.data).to.have.deep.property('sd_rtd', ['333333']);
expect(adUnits[0].bids[1].ortb2.user.ext.data).to.have.deep.property('sd_rtd', ['111111', '222222']);
diff --git a/test/spec/modules/slimcutBidAdapter_spec.js b/test/spec/modules/slimcutBidAdapter_spec.js
index 300791c9658..d821627c24b 100644
--- a/test/spec/modules/slimcutBidAdapter_spec.js
+++ b/test/spec/modules/slimcutBidAdapter_spec.js
@@ -106,7 +106,7 @@ describe('slimcutBidAdapter', function() {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ page: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2
}
diff --git a/test/spec/modules/smaatoBidAdapter_spec.js b/test/spec/modules/smaatoBidAdapter_spec.js
index 38df03652b1..99592765845 100644
--- a/test/spec/modules/smaatoBidAdapter_spec.js
+++ b/test/spec/modules/smaatoBidAdapter_spec.js
@@ -18,7 +18,7 @@ const defaultBidderRequest = {
},
uspConsent: 'uspConsentString',
refererInfo: {
- referer: REFERRER,
+ ref: REFERRER,
},
timeout: 1200,
auctionId: AUCTION_ID
@@ -123,7 +123,7 @@ describe('smaatoBidAdapterTest', () => {
describe('common', () => {
const MINIMAL_BIDDER_REQUEST = {
refererInfo: {
- referer: REFERRER,
+ ref: REFERRER,
}
};
@@ -328,27 +328,22 @@ describe('smaatoBidAdapterTest', () => {
});
it('sends first party data', () => {
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2: {
- site: {
- keywords: 'power tools,drills',
- publisher: {
- id: 'otherpublisherid',
- name: 'publishername'
- }
- },
- user: {
- keywords: 'a,b',
- gender: 'M',
- yob: 1984
- }
+ const ortb2 = {
+ site: {
+ keywords: 'power tools,drills',
+ publisher: {
+ id: 'otherpublisherid',
+ name: 'publishername'
}
- };
- return utils.deepAccess(config, key);
- });
+ },
+ user: {
+ keywords: 'a,b',
+ gender: 'M',
+ yob: 1984
+ }
+ };
- const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);
+ const reqs = spec.buildRequests([singleBannerBidRequest], {...defaultBidderRequest, ortb2});
const req = extractPayloadOfFirstAndOnlyRequest(reqs);
expect(req.user.gender).to.equal('M');
diff --git a/test/spec/modules/smarthubBidAdapter_spec.js b/test/spec/modules/smarthubBidAdapter_spec.js
index 05fb1424dca..e1787dfe880 100644
--- a/test/spec/modules/smarthubBidAdapter_spec.js
+++ b/test/spec/modules/smarthubBidAdapter_spec.js
@@ -90,7 +90,7 @@ describe('SmartHubBidAdapter', function () {
uspConsent: '1---',
gdprConsent: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
refererInfo: {
- referer: 'https://test.com'
+ page: 'https://test.com'
}
};
diff --git a/test/spec/modules/smartxBidAdapter_spec.js b/test/spec/modules/smartxBidAdapter_spec.js
index ddee2fa3347..b7235eee878 100644
--- a/test/spec/modules/smartxBidAdapter_spec.js
+++ b/test/spec/modules/smartxBidAdapter_spec.js
@@ -145,7 +145,7 @@ describe('The smartx adapter', function () {
bid = getValidBidObject();
bidRequestObj = {
refererInfo: {
- referer: 'prebid.js'
+ page: 'prebid.js'
}
};
});
@@ -574,7 +574,7 @@ describe('The smartx adapter', function () {
bid = getValidBidObject();
bidRequestObj = {
refererInfo: {
- referer: 'prebid.js'
+ page: 'prebid.js'
}
};
delete bid.params.bidfloor;
diff --git a/test/spec/modules/smilewantedBidAdapter_spec.js b/test/spec/modules/smilewantedBidAdapter_spec.js
index 0359e470f9b..b9a816cf3d5 100644
--- a/test/spec/modules/smilewantedBidAdapter_spec.js
+++ b/test/spec/modules/smilewantedBidAdapter_spec.js
@@ -163,7 +163,7 @@ describe('smilewantedBidAdapterTests', function () {
it('SmileWanted - Verify build request with referrer', function () {
const request = spec.buildRequests(DISPLAY_REQUEST, {
refererInfo: {
- referer: 'https://localhost/Prebid.js/integrationExamples/gpt/hello_world.html'
+ page: 'https://localhost/Prebid.js/integrationExamples/gpt/hello_world.html'
}
});
const requestContent = JSON.parse(request[0].data);
diff --git a/test/spec/modules/sonobiBidAdapter_spec.js b/test/spec/modules/sonobiBidAdapter_spec.js
index f56f4e0c12b..a502cc3d17d 100644
--- a/test/spec/modules/sonobiBidAdapter_spec.js
+++ b/test/spec/modules/sonobiBidAdapter_spec.js
@@ -330,7 +330,7 @@ describe('SonobiBidAdapter', function () {
'refererInfo': {
'numIframes': 0,
'reachedTop': true,
- 'referer': 'https://example.com',
+ 'page': 'https://example.com',
'stack': ['https://example.com']
},
uspConsent: 'someCCPAString'
@@ -355,14 +355,7 @@ describe('SonobiBidAdapter', function () {
}
}
};
-
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2: ortb2
- };
- return utils.deepAccess(config, key);
- });
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
+ const bidRequests = spec.buildRequests(bidRequest, {...bidderRequests, ortb2});
expect(bidRequests.data.fpd).to.equal(JSON.stringify(ortb2));
});
@@ -427,7 +420,7 @@ describe('SonobiBidAdapter', function () {
'refererInfo': {
'numIframes': 0,
'reachedTop': true,
- 'referer': 'https://example.com',
+ 'page': 'https://example.com',
'stack': ['https://example.com']
}
};
@@ -447,7 +440,7 @@ describe('SonobiBidAdapter', function () {
'refererInfo': {
'numIframes': 0,
'reachedTop': true,
- 'referer': 'https://example.com',
+ 'page': 'https://example.com',
'stack': ['https://example.com']
}
};
diff --git a/test/spec/modules/sortableAnalyticsAdapter_spec.js b/test/spec/modules/sortableAnalyticsAdapter_spec.js
deleted file mode 100644
index 9300756eae2..00000000000
--- a/test/spec/modules/sortableAnalyticsAdapter_spec.js
+++ /dev/null
@@ -1,306 +0,0 @@
-import {expect} from 'chai';
-import sortableAnalyticsAdapter, {TIMEOUT_FOR_REGISTRY, DEFAULT_PBID_TIMEOUT} from 'modules/sortableAnalyticsAdapter.js';
-import * as events from 'src/events.js';
-import CONSTANTS from 'src/constants.json';
-import * as prebidGlobal from 'src/prebidGlobal.js';
-import {server} from 'test/mocks/xhr.js';
-
-describe('Sortable Analytics Adapter', function() {
- let sandbox;
- let clock;
-
- const initialConfig = {
- provider: 'sortable',
- options: {
- siteId: 'testkey'
- }
- };
-
- const TEST_DATA = {
- AUCTION_INIT: {
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- timeout: 3000
- },
- BID_REQUESTED: {
- refererInfo: {
- referer: 'test.com',
- reachedTop: true,
- numIframes: 1
- },
- bidderCode: 'sortable',
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- bids: [{
- bidder: 'sortable',
- params: {
- tagId: 'medrec_1'
- },
- adUnitCode: '300x250',
- transactionId: 'aa02b498-8a99-418e-bc59-6b6fd45f32de',
- sizes: [
- [300, 250]
- ],
- bidId: '26721042674416',
- bidderRequestId: '10141593b1d84a',
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- bidRequestsCount: 1
- }, {
- bidder: 'sortable',
- params: {
- tagId: 'lead_1'
- },
- adUnitCode: '728x90',
- transactionId: 'b7e9e957-af4f-4c47-8ca7-41f01cb4f105',
- sizes: [
- [728, 90]
- ],
- bidId: '50fa575b41e596',
- bidderRequestId: '37a8760be6db23',
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- bidRequestsCount: 1
- }],
- start: 1553529405788
- },
- BID_ADJUSTMENT_1: {
- bidderCode: 'sortable',
- adId: '88221d316425f7',
- mediaType: 'banner',
- cpm: 0.70,
- dealId: null,
- currency: 'USD',
- netRevenue: true,
- ttl: 60,
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- responseTimestamp: 1553534161763,
- bidder: 'sortable',
- adUnitCode: '300x250',
- timeToRespond: 331,
- width: '300',
- height: '250'
- },
- AUCTION_END: {
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e'
- },
- BID_ADJUSTMENT_2: {
- bidderCode: 'sortable',
- adId: '88221d316425f8',
- mediaType: 'banner',
- cpm: 0.50,
- dealId: null,
- currency: 'USD',
- netRevenue: true,
- ttl: 60,
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- responseTimestamp: 1553534161770,
- bidder: 'sortable',
- adUnitCode: '728x90',
- timeToRespond: 338,
- width: '728',
- height: '90'
- },
- BID_WON_1: {
- bidderCode: 'sortable',
- adId: '88221d316425f7',
- mediaType: 'banner',
- cpm: 0.70,
- dealId: null,
- currency: 'USD',
- netRevenue: true,
- ttl: 60,
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- responseTimestamp: 1553534161763,
- bidder: 'sortable',
- adUnitCode: '300x250',
- timeToRespond: 331
- },
- BID_WON_2: {
- bidderCode: 'sortable',
- adId: '88221d316425f8',
- mediaType: 'banner',
- cpm: 0.50,
- dealId: null,
- currency: 'USD',
- netRevenue: true,
- ttl: 60,
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- responseTimestamp: 1553534161770,
- bidder: 'sortable',
- adUnitCode: '728x90',
- timeToRespond: 338
- },
- BID_TIMEOUT: [{
- auctionId: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- adUnitCode: '300x250',
- bidder: 'sortable'
- }]
- };
-
- beforeEach(function() {
- sandbox = sinon.sandbox.create();
- clock = sandbox.useFakeTimers();
- sandbox.stub(events, 'getEvents').returns([]);
- sandbox.stub(prebidGlobal, 'getGlobal').returns({
- version: '1.0',
- bidderSettings: {
- 'sortable': {
- bidCpmAdjustment: function (number) {
- return number * 0.95;
- }
- }
- }
- });
- sortableAnalyticsAdapter.enableAnalytics(initialConfig);
- });
-
- afterEach(function() {
- sandbox.restore();
- clock.restore();
- sortableAnalyticsAdapter.disableAnalytics();
- });
-
- describe('initialize adapter', function() {
- const settings = sortableAnalyticsAdapter.getOptions();
-
- it('should init settings correctly and apply defaults', function() {
- expect(settings).to.include({
- 'disableSessionTracking': false,
- 'key': initialConfig.options.siteId,
- 'protocol': 'https',
- 'url': `https://pa.deployads.com/pae/${initialConfig.options.siteId}`,
- 'timeoutForPbid': DEFAULT_PBID_TIMEOUT
- });
- });
- it('should assign a pageview ID', function() {
- expect(settings).to.have.own.property('pageviewId');
- });
- });
-
- describe('events tracking', function() {
- beforeEach(function() {
- server.requests = [];
- });
- it('should send the PBID event', function() {
- events.emit(CONSTANTS.EVENTS.AUCTION_INIT, TEST_DATA.AUCTION_INIT);
- events.emit(CONSTANTS.EVENTS.BID_REQUESTED, TEST_DATA.BID_REQUESTED);
- events.emit(CONSTANTS.EVENTS.BID_ADJUSTMENT, TEST_DATA.BID_ADJUSTMENT_1);
- events.emit(CONSTANTS.EVENTS.BID_ADJUSTMENT, TEST_DATA.BID_ADJUSTMENT_2);
- events.emit(CONSTANTS.EVENTS.AUCTION_END, TEST_DATA.AUCTION_END);
- events.emit(CONSTANTS.EVENTS.BID_WON, TEST_DATA.BID_WON_1);
- events.emit(CONSTANTS.EVENTS.BID_WON, TEST_DATA.BID_WON_2);
-
- clock.tick(DEFAULT_PBID_TIMEOUT);
-
- expect(server.requests.length).to.equal(1);
- let result = JSON.parse(server.requests[0].requestBody);
- expect(result).to.have.own.property('pbid');
- expect(result.pbid).to.deep.include({
- ai: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- ac: ['300x250', '728x90'],
- adi: ['88221d316425f7', '88221d316425f8'],
- bs: 'sortable',
- bid: ['26721042674416', '50fa575b41e596'],
- bif: 0.95,
- brc: 1,
- brid: ['10141593b1d84a', '37a8760be6db23'],
- rs: ['300x250', '728x90'],
- btcp: [0.70, 0.50].map(n => n * 0.95),
- btcc: 'USD',
- btin: true,
- btsrc: 'sortable',
- c: [0.70, 0.50].map(n => n * 0.95),
- cc: 'USD',
- did: null,
- inr: true,
- it: true,
- iw: true,
- ito: false,
- mt: 'banner',
- rtp: true,
- nif: 1,
- pbv: '1.0',
- siz: ['300x250', '728x90'],
- st: 1553529405788,
- tgid: ['medrec_1', 'lead_1'],
- to: 3000,
- trid: ['aa02b498-8a99-418e-bc59-6b6fd45f32de', 'b7e9e957-af4f-4c47-8ca7-41f01cb4f105'],
- ttl: 60,
- ttr: [331, 338],
- u: 'test.com',
- _count: 2
- });
- });
-
- it('should track a late bidWon event', function() {
- events.emit(CONSTANTS.EVENTS.AUCTION_INIT, TEST_DATA.AUCTION_INIT);
- events.emit(CONSTANTS.EVENTS.BID_REQUESTED, TEST_DATA.BID_REQUESTED);
- events.emit(CONSTANTS.EVENTS.BID_ADJUSTMENT, TEST_DATA.BID_ADJUSTMENT_1);
- events.emit(CONSTANTS.EVENTS.AUCTION_END, TEST_DATA.AUCTION_END);
-
- clock.tick(DEFAULT_PBID_TIMEOUT);
-
- events.emit(CONSTANTS.EVENTS.BID_WON, TEST_DATA.BID_WON_1);
-
- clock.tick(TIMEOUT_FOR_REGISTRY);
-
- expect(server.requests.length).to.equal(2);
- const pbid_req = JSON.parse(server.requests[0].requestBody);
- expect(pbid_req).to.have.own.property('pbid');
- const pbwon_req = JSON.parse(server.requests[1].requestBody);
- expect(pbwon_req).to.have.own.property('pbrw');
- expect(pbwon_req.pbrw).to.deep.equal({
- ac: '300x250',
- ai: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- bif: 0.95,
- bs: 'sortable',
- s: initialConfig.options.siteId,
- cc: 'USD',
- c: 0.70,
- inr: true,
- _count: 1,
- _type: 'pbrw'
- });
- });
-
- it('should track late bidder timeouts', function() {
- events.emit(CONSTANTS.EVENTS.AUCTION_INIT, TEST_DATA.AUCTION_INIT);
- events.emit(CONSTANTS.EVENTS.BID_REQUESTED, TEST_DATA.BID_REQUESTED);
- events.emit(CONSTANTS.EVENTS.AUCTION_END, TEST_DATA.AUCTION_END);
- clock.tick(DEFAULT_PBID_TIMEOUT);
- events.emit(CONSTANTS.EVENTS.BID_TIMEOUT, TEST_DATA.BID_TIMEOUT);
-
- clock.tick(TIMEOUT_FOR_REGISTRY);
-
- expect(server.requests.length).to.equal(2);
- const pbid_req = JSON.parse(server.requests[0].requestBody);
- expect(pbid_req).to.have.own.property('pbid');
- const pbto_req = JSON.parse(server.requests[1].requestBody);
- expect(pbto_req).to.have.own.property('pbto');
- expect(pbto_req.pbto).to.deep.equal({
- ai: 'fb8d579a-5c3f-4705-ab94-3cff39005d9e',
- s: initialConfig.options.siteId,
- ac: '300x250',
- bs: 'sortable',
- _type: 'pbto',
- _count: 1
- });
- });
-
- it('should track errors', function() {
- events.emit(CONSTANTS.EVENTS.AUCTION_INIT, TEST_DATA.AUCTION_INIT);
- events.emit(CONSTANTS.EVENTS.BID_REQUESTED, {});
-
- clock.tick(TIMEOUT_FOR_REGISTRY);
-
- expect(server.requests.length).to.equal(1);
- const err_req = JSON.parse(server.requests[0].requestBody);
- expect(err_req).to.have.own.property('pber');
- expect(err_req.pber).to.include({
- args: '{}',
- s: initialConfig.options.siteId,
- _count: 1,
- ti: 'bidRequested',
- _type: 'pber'
- });
- expect(err_req.pber.msg).to.be.a('string');
- });
- });
-});
diff --git a/test/spec/modules/sortableBidAdapter_spec.js b/test/spec/modules/sortableBidAdapter_spec.js
deleted file mode 100644
index 7357fa77952..00000000000
--- a/test/spec/modules/sortableBidAdapter_spec.js
+++ /dev/null
@@ -1,547 +0,0 @@
-import { expect } from 'chai';
-import { spec } from 'modules/sortableBidAdapter.js';
-import { newBidder } from 'src/adapters/bidderFactory.js';
-import * as utils from 'src/utils.js';
-
-describe('sortableBidAdapter', function() {
- const adapter = newBidder(spec);
-
- describe('isBidRequestValid', function () {
- function makeBid() {
- return {
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403370',
- 'siteId': 'example.com',
- 'keywords': {
- 'key1': 'val1',
- 'key2': 'val2'
- }
- },
- 'adUnitCode': 'adunit-code',
- 'sizes': [
- [300, 250]
- ],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- }
-
- it('should return true when required params found', function () {
- expect(spec.isBidRequestValid(makeBid())).to.equal(true);
- });
-
- it('should return false when tagId not passed correctly', function () {
- let bid = makeBid();
- delete bid.params.tagId;
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false when sizes not passed correctly', function () {
- let bid = makeBid();
- delete bid.sizes;
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false when sizes are wrong length', function () {
- let bid = makeBid();
- bid.sizes = [[300]];
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false when sizes are empty', function () {
- let bid = makeBid();
- bid.sizes = [];
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false when require params are not passed', function () {
- let bid = makeBid();
- bid.params = {};
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false when the keywords are invalid', function () {
- let bid = makeBid();
- bid.params.keywords = {
- 'badval': 1234
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- bid.params.keywords = 'a';
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return true when the keywords are missing or empty', function () {
- let bid = makeBid();
- bid.params.keywords = {};
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- delete bid.params.keywords;
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
-
- it('should return true with video media type', () => {
- const videoBid = {
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403370',
- 'siteId': 'example.com',
- },
- 'adUnitCode': 'adunit-code',
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- 'mediaTypes': {
- 'video': {
- }
- }
- };
- expect(spec.isBidRequestValid(videoBid)).to.equal(true);
- });
- });
-
- describe('buildRequests', function () {
- const bidRequests = [{
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403370',
- 'siteId': 'example.com',
- 'floor': 0.21,
- 'keywords': {
- 'key1': 'val1',
- 'key2': 'val2'
- }
- },
- 'ortb2Imp': {
- 'ext': {
- 'data': {
- 'pbadslot': 'abc/123'
- }
- }
- },
- 'sizes': [
- [300, 250]
- ],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475'
- }, {
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403371',
- 'siteId': 'example.com',
- 'floor': 0.21
- },
- 'sizes': [
- [300, 250]
- ],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- 'mediaTypes': {
- 'native': {
- 'body': {'required': true, 'sendId': true},
- 'clickUrl': {'required': true, 'sendId': true},
- 'cta': {'required': true, 'sendId': true},
- 'icon': {'required': true, 'sendId': true},
- 'image': {'required': true, 'sendId': true},
- 'sponsoredBy': {'required': true, 'sendId': true},
- 'title': {'required': true, 'sendId': true, 'len': 100}
- }
- }
- }];
-
- const request = spec.buildRequests(bidRequests, {refererInfo: { referer: 'http://example.com/page?param=val' }});
- const requestBody = JSON.parse(request.data);
-
- it('sends bid request to our endpoint via POST', function () {
- expect(request.method).to.equal('POST');
- });
-
- it('attaches source and version to endpoint URL as query params', function () {
- const ENDPOINT = `https://c.deployads.com/openrtb2/auction?src=$$REPO_AND_VERSION$$&host=example.com`;
- expect(request.url).to.equal(ENDPOINT);
- });
-
- it('sends screen dimensions', function () {
- expect(requestBody.site.device.w).to.equal(screen.width);
- expect(requestBody.site.device.h).to.equal(screen.height);
- });
-
- it('includes the ad size in the bid request', function () {
- expect(requestBody.imp[0].banner.format[0].w).to.equal(300);
- expect(requestBody.imp[0].banner.format[0].h).to.equal(250);
- });
-
- it('includes the params in the bid request', function () {
- expect(requestBody.imp[0].ext.keywords).to.deep.equal(
- {'key1': 'val1',
- 'key2': 'val2'}
- );
- expect(requestBody.site.publisher.id).to.equal('example.com');
- expect(requestBody.imp[0].tagid).to.equal('403370');
- expect(requestBody.imp[0].floor).to.equal(0.21);
- });
-
- it('includes pbadslot in the bid request', function () {
- expect(requestBody.imp[0].ext.gpid).to.equal('abc/123');
- });
-
- it('sets domain and href correctly', function () {
- expect(requestBody.site.domain).to.equal('example.com');
- expect(requestBody.site.page).to.equal('http://example.com/page?param=val');
- });
-
- it('should have the version in native object set for native bid', function() {
- expect(requestBody.imp[1].native.ver).to.equal('1');
- });
-
- it('should have the assets set for native bid', function() {
- const assets = JSON.parse(requestBody.imp[1].native.request).assets;
- expect(assets[0]).to.deep.equal({'title': {'len': 100}, 'required': 1, 'id': 0});
- expect(assets[1]).to.deep.equal({'img': {'type': 3, 'wmin': 1, 'hmin': 1}, 'required': 1, 'id': 1});
- expect(assets[2]).to.deep.equal({'img': {'type': 1, 'wmin': 1, 'hmin': 1}, 'required': 1, 'id': 2});
- expect(assets[3]).to.deep.equal({'data': {'type': 2}, 'required': 1, 'id': 3});
- expect(assets[4]).to.deep.equal({'data': {'type': 12}, 'required': 1, 'id': 4});
- expect(assets[5]).to.deep.equal({'data': {'type': 1}, 'required': 1, 'id': 5});
- });
-
- const videoBidRequests = [{
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403370',
- 'siteId': 'example.com',
- 'video': {
- 'minduration': 5,
- 'maxduration': 10,
- 'startdelay': 0
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- 'mediaTypes': {
- 'video': {
- 'context': 'instream',
- 'mimes': ['video/x-ms-wmv'],
- 'playerSize': [[400, 300]],
- 'api': [0],
- 'protocols': [2, 3],
- 'playbackmethod': [1]
- }
- }
- }];
-
- const videoRequest = spec.buildRequests(videoBidRequests, {refererInfo: { referer: 'http://localhost:9876/' }});
- const videoRequestBody = JSON.parse(videoRequest.data);
-
- it('should include video params', () => {
- const video = videoRequestBody.imp[0].video;
- expect(video.mimes).to.deep.equal(['video/x-ms-wmv']);
- expect(video.w).to.equal(400);
- expect(video.h).to.equal(300);
- expect(video.api).to.deep.equal([0]);
- expect(video.protocols).to.deep.equal([2, 3]);
- expect(video.playbackmethod).to.deep.equal([1]);
- expect(video.minduration).to.equal(5);
- expect(video.maxduration).to.equal(10);
- expect(video.startdelay).to.equal(0);
- });
-
- it('sets domain and href correctly', function () {
- expect(videoRequestBody.site.domain).to.equal('localhost');
- expect(videoRequestBody.site.page).to.equal('http://localhost:9876/');
- });
-
- const gdprBidRequests = [{
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403370',
- 'siteId': 'example.com',
- 'floor': 0.21,
- 'keywords': {}
- },
- 'sizes': [
- [300, 250]
- ],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475'
- }];
- const consentString = 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==';
-
- function getGdprRequestBody(gdprApplies, consentString) {
- const gdprRequest = spec.buildRequests(gdprBidRequests, {'gdprConsent': {
- 'gdprApplies': gdprApplies,
- 'consentString': consentString
- },
- refererInfo: {
- referer: 'http://localhost:9876/'
- }});
- return JSON.parse(gdprRequest.data);
- }
-
- it('should handle gdprApplies being present and true', function() {
- const gdprRequestBody = getGdprRequestBody(true, consentString);
- expect(gdprRequestBody.regs.ext.gdpr).to.equal(1);
- expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
- })
-
- it('should handle gdprApplies being present and false', function() {
- const gdprRequestBody = getGdprRequestBody(false, consentString);
- expect(gdprRequestBody.regs.ext.gdpr).to.equal(0);
- expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
- })
-
- it('should handle gdprApplies being undefined', function() {
- const gdprRequestBody = getGdprRequestBody(undefined, consentString);
- expect(gdprRequestBody.regs).to.deep.equal({ext: {}});
- expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
- })
-
- it('should handle gdprConsent being undefined', function() {
- const gdprRequest = spec.buildRequests(gdprBidRequests, {refererInfo: { referer: 'http://localhost:9876/' }});
- const gdprRequestBody = JSON.parse(gdprRequest.data);
- expect(gdprRequestBody.regs).to.deep.equal({ext: {}});
- expect(gdprRequestBody.user.ext.consent).to.equal(undefined);
- })
-
- const eidsBidRequests = [{
- 'bidder': 'sortable',
- 'params': {
- 'tagId': '403370',
- 'siteId': 'example.com',
- 'floor': 0.21,
- 'keywords': {}
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475'
- }];
-
- it('should not set user ids when none present', function() {
- const eidsRequest = spec.buildRequests(eidsBidRequests, {refererInfo: {
- referer: 'http://localhost:9876/'
- }});
- const eidsRequestBody = JSON.parse(eidsRequest.data);
-
- expect(eidsRequestBody.user.ext.eids).to.equal(undefined);
- })
-
- it('should set user ids when present', function() {
- eidsBidRequests[0].userId = { criteoId: 'sample-userid' };
- const eidsRequest = spec.buildRequests(eidsBidRequests, {refererInfo: {
- referer: 'http://localhost:9876/'
- }});
- const eidsRequestBody = JSON.parse(eidsRequest.data);
-
- expect(eidsRequestBody.user.ext.eids.length).to.equal(1);
- })
- });
-
- describe('interpretResponse', function () {
- function makeResponse() {
- return {
- body: {
- 'id': '5e5c23a5ba71e78',
- 'seatbid': [
- {
- 'bid': [
- {
- 'id': '6vmb3isptf',
- 'crid': 'sortablescreative',
- 'impid': '322add653672f68',
- 'price': 1.22,
- 'adm': '',
- 'attr': [5],
- 'h': 90,
- 'nurl': 'http://nurl',
- 'w': 728
- }
- ],
- 'seat': 'MOCK'
- }
- ],
- 'bidid': '5e5c23a5ba71e78'
- }
- };
- }
-
- function makeNativeResponse() {
- return {
- body: {
- 'id': '5e5c23a5ba71e77',
- 'seatbid': [
- {
- 'bid': [
- {
- 'id': '6vmb3isptf',
- 'crid': 'sortablescreative',
- 'impid': '322add653672f67',
- 'price': 1.55,
- 'adm': '{"native":{"link":{"clicktrackers":[],"url":"https://www.sortable.com/"},"assets":[{"title":{"text":"Ads With Sortable"},"id":1},{"img":{"w":790,"url":"https://path.to/image","h":294},"id":2},{"img":{"url":"https://path.to/icon"},"id":3},{"data":{"value":"Body here"},"id":4},{"data":{"value":"Learn More"},"id":5},{"data":{"value":"Sortable"},"id":6}],"imptrackers":[],"ver":1}}',
- 'ext': {'ad_format': 'native'},
- 'h': 90,
- 'nurl': 'http://nurl',
- 'w': 728
- }
- ],
- 'seat': 'MOCK'
- }
- ],
- 'bidid': '5e5c23a5ba71e77'
- }
- };
- }
-
- const expectedBid = {
- 'requestId': '322add653672f68',
- 'cpm': 1.22,
- 'width': 728,
- 'height': 90,
- 'creativeId': 'sortablescreative',
- 'dealId': null,
- 'currency': 'USD',
- 'netRevenue': true,
- 'mediaType': 'banner',
- 'meta': { 'advertiserDomains': [] },
- 'ttl': 60,
- 'ad': ''
- };
-
- const expectedNativeBid = {
- 'requestId': '322add653672f67',
- 'cpm': 1.55,
- 'width': 728,
- 'height': 90,
- 'creativeId': 'sortablescreative',
- 'dealId': null,
- 'currency': 'USD',
- 'netRevenue': true,
- 'sortable': { 'ad_format': 'native' },
- 'mediaType': 'native',
- 'meta': { 'advertiserDomains': [] },
- 'ttl': 60,
- 'native': {
- 'clickUrl': 'https://www.sortable.com/',
- 'title': 'Ads With Sortable',
- 'image': {'url': 'https://path.to/image', 'height': 294, 'width': 790},
- 'icon': 'https://path.to/icon',
- 'body': 'Body here',
- 'cta': 'Learn More',
- 'sponsoredBy': 'Sortable'
- }
- };
-
- it('should get the correct bid response', function () {
- let result = spec.interpretResponse(makeResponse());
- expect(result.length).to.equal(1);
- expect(result[0]).to.deep.equal(expectedBid);
- });
-
- it('should handle a missing crid', function () {
- let noCridResponse = makeResponse();
- delete noCridResponse.body.seatbid[0].bid[0].crid;
- const fallbackCrid = noCridResponse.body.seatbid[0].bid[0].id;
- let noCridResult = Object.assign({}, expectedBid, {'creativeId': fallbackCrid});
- let result = spec.interpretResponse(noCridResponse);
- expect(result.length).to.equal(1);
- expect(result[0]).to.deep.equal(noCridResult);
- });
-
- it('should handle a missing nurl', function () {
- let noNurlResponse = makeResponse();
- delete noNurlResponse.body.seatbid[0].bid[0].nurl;
- let noNurlResult = Object.assign({}, expectedBid);
- noNurlResult.ad = '';
- let result = spec.interpretResponse(noNurlResponse);
- expect(result.length).to.equal(1);
- expect(result[0]).to.deep.equal(noNurlResult);
- });
-
- it('should handle a missing adm', function () {
- let noAdmResponse = makeResponse();
- delete noAdmResponse.body.seatbid[0].bid[0].adm;
- let noAdmResult = Object.assign({}, expectedBid);
- delete noAdmResult.ad;
- noAdmResult.adUrl = 'http://nurl';
- let result = spec.interpretResponse(noAdmResponse);
- expect(result.length).to.equal(1);
- expect(result[0]).to.deep.equal(noAdmResult);
- });
-
- it('handles empty bid response', function () {
- let response = {
- body: {
- 'id': '5e5c23a5ba71e78',
- 'seatbid': []
- }
- };
- let result = spec.interpretResponse(response);
- expect(result.length).to.equal(0);
- });
-
- it('should get the correct native bid response', function () {
- let result = spec.interpretResponse(makeNativeResponse());
- expect(result.length).to.equal(1);
- expect(result[0]).to.deep.equal(expectedNativeBid);
- });
-
- it('fail to parse invalid native bid response', function () {
- let response = makeNativeResponse();
- response.body.seatbid[0].bid[0].adm = '';
- let result = spec.interpretResponse(response);
- expect(result.length).to.equal(0);
- });
-
- it('should keep custom properties', () => {
- const customProperties = {test: 'a test message', param: {testParam: 1}};
- const expectedResult = Object.assign({}, expectedBid, {[spec.code]: customProperties});
- const response = makeResponse();
- response.body.seatbid[0].bid[0].ext = customProperties;
- const result = spec.interpretResponse(response);
- expect(result.length).to.equal(1);
- expect(result[0]).to.deep.equal(expectedResult);
- });
-
- it('should handle instream response', () => {
- const response = makeResponse();
- const bid = response.body.seatbid[0].bid[0];
- delete bid.nurl;
- bid.ext = {ad_format: 'instream'};
- const result = spec.interpretResponse(response)[0];
- expect(result.mediaType).to.equal('video');
- expect(result.vastXml).to.equal(bid.adm);
- });
-
- it('should return iframe syncs', () => {
- const syncResponse = {
- ext: {
- sync_dsps: [
- ['iframe', 'http://example-dsp/sync-iframe'],
- ['image', 'http://example-dsp/sync-image']
- ]
- }
- };
- expect(spec.getUserSyncs({iframeEnabled: true}, [{body: syncResponse}])).to.deep.equal([{
- type: 'iframe',
- url: 'http://example-dsp/sync-iframe'
- }]);
- });
-
- it('should return image syncs', () => {
- const syncResponse = {
- ext: {
- sync_dsps: [
- ['iframe', 'http://example-dsp/sync-iframe'],
- ['image', 'http://example-dsp/sync-image']
- ]
- }
- };
- expect(spec.getUserSyncs({pixelEnabled: true}, [{body: syncResponse}])).to.deep.equal([{
- type: 'image',
- url: 'http://example-dsp/sync-image'
- }]);
- });
- });
-});
diff --git a/test/spec/modules/sovrnBidAdapter_spec.js b/test/spec/modules/sovrnBidAdapter_spec.js
index c515f302c32..261a868f5a0 100644
--- a/test/spec/modules/sovrnBidAdapter_spec.js
+++ b/test/spec/modules/sovrnBidAdapter_spec.js
@@ -21,7 +21,8 @@ const baseBidRequest = {
}
const baseBidderRequest = {
refererInfo: {
- referer: 'http://example.com/page.html',
+ page: 'http://example.com/page.html',
+ domain: 'example.com',
}
}
@@ -307,30 +308,17 @@ describe('sovrnBidAdapter', function() {
expect(impression.bidfloor).to.equal(2.00)
})
describe('First Party Data', function () {
- let sandbox
-
- beforeEach(function() {
- sandbox = sinon.sandbox.create()
- })
- afterEach(function() {
- sandbox.restore()
- })
it('should provide first party data if provided', function() {
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const cfg = {
- ortb2: {
- site: {
- keywords: 'test keyword'
- },
- user: {
- data: 'some user data'
- }
- }
+ const ortb2 = {
+ site: {
+ keywords: 'test keyword'
+ },
+ user: {
+ data: 'some user data'
}
- return utils.deepAccess(cfg, key)
- })
+ };
- const request = spec.buildRequests([baseBidRequest], baseBidderRequest)
+ const request = spec.buildRequests([baseBidRequest], {...baseBidderRequest, ortb2})
const { user, site } = JSON.parse(request.data)
expect(user.data).to.equal('some user data')
diff --git a/test/spec/modules/spotxBidAdapter_spec.js b/test/spec/modules/spotxBidAdapter_spec.js
index d536976092b..9d961657ac2 100644
--- a/test/spec/modules/spotxBidAdapter_spec.js
+++ b/test/spec/modules/spotxBidAdapter_spec.js
@@ -96,7 +96,11 @@ describe('the spotx adapter', function () {
beforeEach(function() {
bid = getValidBidObject();
- bidRequestObj = {refererInfo: {referer: 'prebid.js'}};
+ bidRequestObj = {
+ refererInfo: {
+ page: 'prebid.js'
+ }
+ };
});
it('should build a very basic request', function() {
@@ -353,24 +357,7 @@ describe('the spotx adapter', function () {
config.getConfig.restore();
});
- it('should use pageUrl from config if page param is not passed', function() {
- var request;
-
- var origGetConfig = config.getConfig;
- sinon.stub(config, 'getConfig').callsFake(function (key) {
- if (key === 'pageUrl') {
- return 'https://www.spotx.tv';
- }
- return origGetConfig.apply(config, arguments);
- });
-
- request = spec.buildRequests([bid], bidRequestObj)[0];
-
- expect(request.data.site.page).to.equal('https://www.spotx.tv');
- config.getConfig.restore();
- });
-
- it('should use refererInfo.referer if no page or pageUrl are passed', function() {
+ it('should use refererInfo.referer if no page is passed', function() {
var request;
request = spec.buildRequests([bid], bidRequestObj)[0];
diff --git a/test/spec/modules/sspBCBidAdapter_spec.js b/test/spec/modules/sspBCBidAdapter_spec.js
index 257d6815709..f286eb3a1ff 100644
--- a/test/spec/modules/sspBCBidAdapter_spec.js
+++ b/test/spec/modules/sspBCBidAdapter_spec.js
@@ -209,7 +209,8 @@ describe('SSPBC adapter', function () {
gdprConsent,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -221,7 +222,8 @@ describe('SSPBC adapter', function () {
gdprConsent,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -233,7 +235,8 @@ describe('SSPBC adapter', function () {
gdprConsent,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -245,7 +248,8 @@ describe('SSPBC adapter', function () {
gdprConsent,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -257,7 +261,8 @@ describe('SSPBC adapter', function () {
gdprConsent,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -269,7 +274,8 @@ describe('SSPBC adapter', function () {
gdprConsent,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -280,7 +286,8 @@ describe('SSPBC adapter', function () {
bids: bids_test,
refererInfo: {
reachedTop: true,
- referer: 'https://test.site.pl/',
+ page: 'https://test.site.pl/',
+ domain: 'test.site.pl',
stack: ['https://test.site.pl/'],
}
};
@@ -511,7 +518,7 @@ describe('SSPBC adapter', function () {
});
it('should send page url from refererInfo', function () {
- expect(payload.site.page).to.equal(bidRequest.refererInfo.referer);
+ expect(payload.site.page).to.equal(bidRequest.refererInfo.page);
});
it('should send gdpr data', function () {
diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js
index 1c4f0fa4c32..cc7f5574fc3 100644
--- a/test/spec/modules/taboolaBidAdapter_spec.js
+++ b/test/spec/modules/taboolaBidAdapter_spec.js
@@ -99,8 +99,9 @@ describe('Taboola Adapter', function () {
const commonBidderRequest = {
refererInfo: {
- referer: 'https://example.com/ref',
- canonicalUrl: 'https://example.com/'
+ page: 'https://example.com/ref',
+ ref: 'https://ref',
+ domain: 'example.com',
}
}
@@ -126,9 +127,9 @@ describe('Taboola Adapter', function () {
'site': {
'id': commonBidRequest.params.publisherId,
'name': commonBidRequest.params.publisherId,
- 'domain': window.location.host,
- 'page': commonBidderRequest.refererInfo.canonicalUrl,
- 'ref': commonBidderRequest.refererInfo.referer,
+ 'domain': commonBidderRequest.refererInfo.domain,
+ 'page': commonBidderRequest.refererInfo.page,
+ 'ref': commonBidderRequest.refererInfo.ref,
'publisher': {'id': commonBidRequest.params.publisherId},
'content': {'language': navigator.language}
},
@@ -393,62 +394,36 @@ describe('Taboola Adapter', function () {
describe('internal functions', function () {
describe('getPageUrl', function () {
- let origPageUrl;
const bidderRequest = {
refererInfo: {
- canonicalUrl: 'http://canonical.url'
+ page: 'http://canonical.url'
}
};
- beforeEach(function () {
- // remember original pageUrl in config
- origPageUrl = config.getConfig('pageUrl');
-
- // unset pageUrl in config
- config.setConfig({pageUrl: null});
- });
-
- afterEach(function () {
- // set original pageUrl to config
- config.setConfig({pageUrl: origPageUrl});
- });
-
it('should handle empty or missing data', function () {
- expect(internal.getPageUrl(undefined)).to.equal(utils.getWindowTop().location.href);
- expect(internal.getPageUrl('')).to.equal(utils.getWindowTop().location.href);
+ expect(internal.getPageUrl(undefined)).to.equal(utils.getWindowSelf().location.href);
+ expect(internal.getPageUrl('')).to.equal(utils.getWindowSelf().location.href);
});
- it('should use "pageUrl" from config', function () {
- config.setConfig({pageUrl: 'http://page.url'});
-
- expect(internal.getPageUrl(undefined)).to.equal(config.getConfig('pageUrl'));
- });
-
- it('should use bidderRequest.refererInfo.canonicalUrl', function () {
- expect(internal.getPageUrl(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.canonicalUrl);
- });
-
- it('should prefer bidderRequest.refererInfo.canonicalUrl over "pageUrl" from config', () => {
- config.setConfig({pageUrl: 'https://page.url'});
-
- expect(internal.getPageUrl(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.canonicalUrl);
+ it('should use bidderRequest.refererInfo.page', function () {
+ expect(internal.getPageUrl(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.page);
});
});
describe('getReferrer', function () {
it('should handle empty or missing data', function () {
- expect(internal.getReferrer(undefined)).to.equal(utils.getWindowTop().document.referrer);
- expect(internal.getReferrer('')).to.equal(utils.getWindowTop().document.referrer);
+ expect(internal.getReferrer(undefined)).to.equal(utils.getWindowSelf().document.referrer);
+ expect(internal.getReferrer('')).to.equal(utils.getWindowSelf().document.referrer);
});
- it('should use bidderRequest.refererInfo.referer', () => {
+ it('should use bidderRequest.refererInfo.ref', () => {
const bidderRequest = {
refererInfo: {
- referer: 'foobar'
+ ref: 'foobar'
}
};
- expect(internal.getReferrer(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.referer);
+ expect(internal.getReferrer(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.ref);
});
});
})
diff --git a/test/spec/modules/tappxBidAdapter_spec.js b/test/spec/modules/tappxBidAdapter_spec.js
index 8866670df77..58a62fb2869 100644
--- a/test/spec/modules/tappxBidAdapter_spec.js
+++ b/test/spec/modules/tappxBidAdapter_spec.js
@@ -17,14 +17,16 @@ const c_BIDREQUEST = {
crumbs: {
pubcid: 'df2144f7-673f-4440-83f5-cd4a73642d99'
},
- fpd: {
- context: {
- adServer: {
- name: 'gam',
- adSlot: '/19968336/header-bid-tag-0'
- },
- pbAdSlot: '/19968336/header-bid-tag-0',
- },
+ ortb2Imp: {
+ ext: {
+ data: {
+ adserver: {
+ name: 'gam',
+ adslot: '/19968336/header-bid-tag-0'
+ },
+ pbadslot: '/19968336/header-bid-tag-0',
+ }
+ }
},
mediaTypes: {
banner: {
@@ -121,7 +123,7 @@ const c_SERVERRESPONSE_V = {
const c_CONSENTSTRING = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
const c_VALIDBIDREQUESTS = [{'bidder': 'tappx', 'params': {'host': 'testing.ssp.tappx.com\/rtb\/v2\/', 'tappxkey': 'pub-1234-android-1234', 'endpoint': 'ZZ1234PBJS', 'bidfloor': 0.005, 'test': 1}, 'userId': {'haloId': '0000x179MZAzMqUWsFonu7Drm3eDDBMYtj5SPoWQnl89Upk3WTlCvEnKI9SshX0p6eFJ7otPYix179MZAzMqUWsFonu7Drm3eDDBMYtj5SPoWQnl89Upk3WTlCvEnKI9SshX0p6e', 'id5id': {'uid': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_rEXbz6UYtYEJelYrDaZOLkh8WcF9J0ZHmEHFKZEBlLXsgP6xqXU3BCj4Ay0Z6fw_jSOaHxMHwd-voRHqFA4Q9NwAxFcVLyPWnNGZ9VbcSAPos1wupq7Xu3MIm-Bw_0vxjhZdWNy4chM9x3i', 'ext': {'linkType': 0}}, 'intentIqId': 'GIF89a\u0000\u0000\u0000\u0000�\u0000\u0000���\u0000\u0000\u0000?�\u0000\u0000\u0000\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000A\u0000\u0000;', 'lotamePanoramaId': 'xTtLUY7GwqX2MMqSHo9RQ2YUOIBFhlASOR43I9KjvgtcrxIys3RxME96M02LTjWR', 'parrableId': {'eid': '02.YoqC9lWZh8.C8QTSiJTNgI6Pp0KCM5zZgEgwVMSsVP5W51X8cmiUHQESq9WRKB4nreqZJwsWIcNKlORhG4u25Wm6lmDOBmQ0B8hv0KP6uVQ97aouuH52zaz2ctVQTORUKkErPRPcaCJ7dKFcrNoF2i6WOR0S5Nk'}, 'pubcid': 'b1254-152f-12F5-5698-dI1eljK6C7WA', 'pubProvidedId': [{'source': 'domain.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 1, 'ext': {'stype': 'ppuid'}}]}, {'source': '3rdpartyprovided.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 3, 'ext': {'stype': 'sha256email'}}]}]}, 'userIdAsEids': [{'source': 'audigent.com', 'uids': [{'id': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'atype': 1}]}, {'source': 'id5-sync.com', 'uids': [{'id': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'atype': 1, 'ext': {'linkType': 0}}]}], 'ortb2Imp': {'ext': {'data': {'adserver': {'name': 'gam', 'adslot': '/19968336/header-bid-tag-0'}, 'pbadslot': '/19968336/header-bid-tag-0'}}}, 'mediaTypes': {'banner': {'sizes': [[320, 480], [320, 50]]}}, 'adUnitCode': 'div-gpt-ad-1460505748561-0', 'transactionId': '71c0d86b-4b47-4aff-a6da-1af0b1712439', 'sizes': [[320, 480], [320, 50]], 'bidId': '264d7969b125a5', 'bidderRequestId': '1c674c14a3889c', 'auctionId': '13a8a3a9-ed3a-4101-9435-4699ee77bb62', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0}];
const c_VALIDBIDAPPREQUESTS = [{'bidder': 'tappx', 'params': {'host': 'testing.ssp.tappx.com\/rtb\/v2\/', 'tappxkey': 'pub-1234-android-1234', 'endpoint': 'ZZ1234PBJS', 'bidfloor': 0.005, 'test': 1, 'app': {'name': 'Tappx Test', 'bundle': 'com.test.tappx', 'domain': 'tappx.com', 'publisher': { 'name': 'Tappx', 'domain': 'tappx.com' }}}, 'userId': {'haloId': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'id5id': {'uid': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'ext': {'linkType': 0}}, 'intentIqId': 'GIF89a\u0001\u0000\u0001\u0000�\u0000\u0000���\u0000\u0000\u0000!�\u0004\u0001\u0000\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0002\u0002D\u0001\u0000;', 'lotamePanoramaId': '8003916b61a95b185690ec103bdf4945a70213e01818a5e5d8690b542730755a', 'parrableId': {'eid': '01.1617088921.7faa68d9570a50ea8e4f359e9b99ca4b7509e948a6175b3e5b0b8cbaf5b62424104ccfb0191ca79366de8368ed267b89a68e236df5f41f96f238e4301659e9023fec05e46399fb1ad0a0'}, 'pubcid': 'b7143795-852f-42f0-8864-5ecbea1ade4e', 'pubProvidedId': [{'source': 'domain.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 1, 'ext': {'stype': 'ppuid'}}]}, {'source': '3rdpartyprovided.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 3, 'ext': {'stype': 'sha256email'}}]}]}, 'userIdAsEids': [{'source': 'audigent.com', 'uids': [{'id': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'atype': 1}]}, {'source': 'id5-sync.com', 'uids': [{'id': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'atype': 1, 'ext': {'linkType': 0}}]}, {'source': 'intentiq.com', 'uids': [{'id': 'GIF89a\u0001\u0000\u0001\u0000�\u0000\u0000���\u0000\u0000\u0000!�\u0004\u0001\u0000\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0002\u0002D\u0001\u0000;', 'atype': 1}]}, {'source': 'crwdcntrl.net', 'uids': [{'id': '8003916b61a95b185690ec103bdf4945a70213e01818a5e5d8690b542730755a', 'atype': 1}]}, {'source': 'parrable.com', 'uids': [{'id': '01.1617088921.7faa68d9570a50ea8e4f359e9b99ca4b7509e948a6175b3e5b0b8cbaf5b62424104ccfb0191ca79366de8368ed267b89a68e236df5f41f96f238e4301659e9023fec05e46399fb1ad0a0', 'atype': 1}]}, {'source': 'pubcid.org', 'uids': [{'id': 'b7143795-852f-42f0-8864-5ecbea1ade4e', 'atype': 1}]}, {'source': 'domain.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 1, 'ext': {'stype': 'ppuid'}}]}, {'source': '3rdpartyprovided.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 3, 'ext': {'stype': 'sha256email'}}]}], 'ortb2Imp': {'ext': {'data': {'adserver': {'name': 'gam', 'adslot': '/19968336/header-bid-tag-0'}, 'pbadslot': '/19968336/header-bid-tag-0'}}}, 'mediaTypes': {'banner': {'sizes': [[320, 480], [320, 50]]}}, 'adUnitCode': 'div-gpt-ad-1460505748561-0', 'transactionId': '71c0d86b-4b47-4aff-a6da-1af0b1712439', 'sizes': [[320, 480], [320, 50]], 'bidId': '264d7969b125a5', 'bidderRequestId': '1c674c14a3889c', 'auctionId': '13a8a3a9-ed3a-4101-9435-4699ee77bb62', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0}];
-const c_BIDDERREQUEST_B = {'bidderCode': 'tappx', 'auctionId': '13a8a3a9-ed3a-4101-9435-4699ee77bb62', 'bidderRequestId': '1c674c14a3889c', 'bids': [{'bidder': 'tappx', 'params': {'host': 'testing.ssp.tappx.com\/rtb\/v2\/', 'tappxkey': 'pub-1234-android-1234', 'endpoint': 'ZZ1234PBJS', 'bidfloor': 0.005, 'test': 1}, 'userId': {'haloId': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'id5id': {'uid': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'ext': {'linkType': 0}}, 'intentIqId': 'GIF89a\u0000\u0000\u0000\u0000�\u0000\u0000���\u0000\u0000\u0000?�\u0000\u0000\u0000\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000A\u0000\u0000;', 'lotamePanoramaId': '8003916b61a95b185690ec103bdf4945a70213e01818a5e5d8690b542730755a', 'parrableId': {'eid': '01.1617088921.7faa68d9570a50ea8e4f359e9b99ca4b7509e948a6175b3e5b0b8cbaf5b62424104ccfb0191ca79366de8368ed267b89a68e236df5f41f96f238e4301659e9023fec05e46399fb1ad0a0'}, 'pubcid': 'b7143795-852f-42f0-8864-5ecbea1ade4e', 'pubProvidedId': [{'source': 'domain.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 1, 'ext': {'stype': 'ppuid'}}]}, {'source': '3rdpartyprovided.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 3, 'ext': {'stype': 'sha256email'}}]}]}, 'userIdAsEids': [{'source': 'audigent.com', 'uids': [{'id': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'atype': 1}]}, {'source': 'id5-sync.com', 'uids': [{'id': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'atype': 1, 'ext': {'linkType': 0}}]}], 'ortb2Imp': {'ext': {'data': {'adserver': {'name': 'gam', 'adslot': '/19968336/header-bid-tag-0'}, 'pbadslot': '/19968336/header-bid-tag-0'}}}, 'mediaTypes': {'banner': {'sizes': [[320, 480], [320, 50]]}}, 'adUnitCode': 'div-gpt-ad-1460505748561-0', 'transactionId': '71c0d86b-4b47-4aff-a6da-1af0b1712439', 'sizes': [[320, 480], [320, 50]], 'bidId': '264d7969b125a5', 'bidderRequestId': '1c674c14a3889c', 'auctionId': '13a8a3a9-ed3a-4101-9435-4699ee77bb62', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0}], 'auctionStart': 1617088922120, 'timeout': 700, 'refererInfo': {'referer': 'http://localhost:9999/integrationExamples/gpt/gdpr_hello_world.html?pbjs_debug=true', 'reachedTop': true, 'isAmp': false, 'numIframes': 0, 'stack': ['http://localhost:9999/integrationExamples/gpt/gdpr_hello_world.html?pbjs_debug=true'], 'canonicalUrl': null}, 'gdprConsent': {'consentString': c_CONSENTSTRING, 'vendorData': {'metadata': 'BO-JeiTPABAOkAAABAENABA', 'gdprApplies': true, 'hasGlobalScope': false, 'cookieVersion': 1, 'created': '2020-12-09T09:22:09.900Z', 'lastUpdated': '2021-01-14T15:44:03.600Z', 'cmpId': 0, 'cmpVersion': 1, 'consentScreen': 0, 'consentLanguage': 'EN', 'vendorListVersion': 1, 'maxVendorId': 0, 'purposeConsents': {}, 'vendorConsents': {}}, 'gdprApplies': true, 'apiVersion': 1}, 'uspConsent': '1YCC', 'start': 1611308859099};
+const c_BIDDERREQUEST_B = {'bidderCode': 'tappx', 'auctionId': '13a8a3a9-ed3a-4101-9435-4699ee77bb62', 'bidderRequestId': '1c674c14a3889c', 'bids': [{'bidder': 'tappx', 'params': {'host': 'testing.ssp.tappx.com\/rtb\/v2\/', 'tappxkey': 'pub-1234-android-1234', 'endpoint': 'ZZ1234PBJS', 'bidfloor': 0.005, 'test': 1}, 'userId': {'haloId': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'id5id': {'uid': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'ext': {'linkType': 0}}, 'intentIqId': 'GIF89a\u0000\u0000\u0000\u0000�\u0000\u0000���\u0000\u0000\u0000?�\u0000\u0000\u0000\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000A\u0000\u0000;', 'lotamePanoramaId': '8003916b61a95b185690ec103bdf4945a70213e01818a5e5d8690b542730755a', 'parrableId': {'eid': '01.1617088921.7faa68d9570a50ea8e4f359e9b99ca4b7509e948a6175b3e5b0b8cbaf5b62424104ccfb0191ca79366de8368ed267b89a68e236df5f41f96f238e4301659e9023fec05e46399fb1ad0a0'}, 'pubcid': 'b7143795-852f-42f0-8864-5ecbea1ade4e', 'pubProvidedId': [{'source': 'domain.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 1, 'ext': {'stype': 'ppuid'}}]}, {'source': '3rdpartyprovided.com', 'uids': [{'id': 'value read from cookie or local storage', 'atype': 3, 'ext': {'stype': 'sha256email'}}]}]}, 'userIdAsEids': [{'source': 'audigent.com', 'uids': [{'id': '0000fgclxw05ycn0608xiyi90bwpa0c0evvlif0hv1x0i0ku88il0ntek0o0qskvir0trr70u0wqxiix0zq3u1012pa5j315ogh1618nmsj91bmt41c1elzfjf1hl5r1i1kkc2jl', 'atype': 1}]}, {'source': 'id5-sync.com', 'uids': [{'id': 'ID5@iu-PJX_OQ0d6FJjKS8kYfUpHriD_qpoXJUngedfpNva812If1fHEqHHkamLC89txVxk1i9WGqeQrTX97HFCgv9QDa1M_bkHUBsAWFm-D5r1rYrsfMFFiyqwCAEzqNbvsUZXOYCAQSjPcLxR4of22w-U9_JDRThCGRDV3Fmvc38E', 'atype': 1, 'ext': {'linkType': 0}}]}], 'ortb2Imp': {'ext': {'data': {'adserver': {'name': 'gam', 'adslot': '/19968336/header-bid-tag-0'}, 'pbadslot': '/19968336/header-bid-tag-0'}}}, 'mediaTypes': {'banner': {'sizes': [[320, 480], [320, 50]]}}, 'adUnitCode': 'div-gpt-ad-1460505748561-0', 'transactionId': '71c0d86b-4b47-4aff-a6da-1af0b1712439', 'sizes': [[320, 480], [320, 50]], 'bidId': '264d7969b125a5', 'bidderRequestId': '1c674c14a3889c', 'auctionId': '13a8a3a9-ed3a-4101-9435-4699ee77bb62', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0}], 'auctionStart': 1617088922120, 'timeout': 700, 'refererInfo': {'page': 'http://localhost:9999/integrationExamples/gpt/gdpr_hello_world.html?pbjs_debug=true', 'reachedTop': true, 'isAmp': false, 'numIframes': 0, 'stack': ['http://localhost:9999/integrationExamples/gpt/gdpr_hello_world.html?pbjs_debug=true'], 'canonicalUrl': null}, 'gdprConsent': {'consentString': c_CONSENTSTRING, 'vendorData': {'metadata': 'BO-JeiTPABAOkAAABAENABA', 'gdprApplies': true, 'hasGlobalScope': false, 'cookieVersion': 1, 'created': '2020-12-09T09:22:09.900Z', 'lastUpdated': '2021-01-14T15:44:03.600Z', 'cmpId': 0, 'cmpVersion': 1, 'consentScreen': 0, 'consentLanguage': 'EN', 'vendorListVersion': 1, 'maxVendorId': 0, 'purposeConsents': {}, 'vendorConsents': {}}, 'gdprApplies': true, 'apiVersion': 1}, 'uspConsent': '1YCC', 'start': 1611308859099};
const c_BIDDERREQUEST_V = {'method': 'POST', 'url': 'https://testing.ssp.tappx.com/rtb/v2//VZ12TESTCTV?type_cnn=prebidjs&v=0.1.10329', 'data': '{"site":{"name":"localhost","bundle":"localhost","domain":"localhost"},"user":{"ext":{}},"id":"0fecfa84-c541-49f8-8c45-76b90fddc30e","test":1,"at":1,"tmax":1000,"bidder":"tappx","imp":[{"video":{"mimes":["video/mp4","application/javascript"],"minduration":3,"maxduration":30,"startdelay":5,"playbackmethod":[1,3],"api":[1,2],"protocols":[2,3],"battr":[13,14],"linearity":1,"placement":2,"minbitrate":10,"maxbitrate":10,"w":320,"h":250},"id":"2398241a5a860b","tagid":"localhost_typeAdBanVid_windows","secure":1,"bidfloor":0.005,"ext":{"bidder":{"tappxkey":"pub-1234-desktop-1234","endpoint":"vz34906po","host":"https://vz34906po.pub.tappx.com/rtb/","bidfloor":0.005}}}],"device":{"os":"windows","ip":"peer","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","h":864,"w":1536,"dnt":0,"language":"en","make":"Google Inc."},"params":{"host":"tappx.com","bidfloor":0.005},"regs":{"gdpr":0,"ext":{}}}', 'bids': {'bidder': 'tappx', 'params': {'host': 'testing.ssp.tappx.com/rtb/v2/', 'tappxkey': 'pub-1234-desktop-1234', 'endpoint': 'VZ12TESTCTV', 'bidfloor': 0.005, 'test': true}, 'crumbs': {'pubcid': 'dccfe922-3823-4676-b7b2-e5ed8743154e'}, 'ortb2Imp': {'ext': {'data': {'pbadslot': 'video-ad-div'}}}, 'renderer': {'options': {'text': 'Tappx Outstream Video'}}, 'mediaTypes': {'video': {'mimes': ['video/mp4', 'application/javascript'], 'minduration': 3, 'maxduration': 30, 'startdelay': 5, 'playbackmethod': [1, 3], 'api': [1, 2], 'protocols': [2, 3], 'battr': [13, 14], 'linearity': 1, 'placement': 2, 'minbitrate': 10, 'maxbitrate': 10, 'w': 320, 'h': 250}}, 'adUnitCode': 'video-ad-div', 'transactionId': 'ed41c805-d14c-49c3-954d-26b98b2aa2c2', 'sizes': [[320, 250]], 'bidId': '28f49c71b13f2f', 'bidderRequestId': '1401710496dc7', 'auctionId': 'e807363f-3095-43a8-a4a6-f44196cb7318', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0}}
const c_BIDDERREQUEST_VOutstream = {'method': 'POST', 'url': 'https://testing.ssp.tappx.com/rtb/v2//VZ12TESTCTV?type_cnn=prebidjs&v=0.1.10329', 'data': '{"site":{"name":"localhost","bundle":"localhost","domain":"localhost"},"user":{"ext":{}},"id":"0fecfa84-c541-49f8-8c45-76b90fddc30e","test":1,"at":1,"tmax":1000,"bidder":"tappx","imp":[{"video":{"context": "outstream","playerSize":[640, 480],"mimes":["video/mp4","application/javascript"],"minduration":3,"maxduration":30,"startdelay":5,"playbackmethod":[1,3],"api":[1,2],"protocols":[2,3],"battr":[13,14],"linearity":1,"placement":2,"minbitrate":10,"maxbitrate":10,"w":320,"h":250},"id":"2398241a5a860b","tagid":"localhost_typeAdBanVid_windows","secure":1,"bidfloor":0.005,"ext":{"bidder":{"tappxkey":"pub-1234-desktop-1234","endpoint":"vz34906po","host":"https://vz34906po.pub.tappx.com/rtb/","bidfloor":0.005}}}],"device":{"os":"windows","ip":"peer","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","h":864,"w":1536,"dnt":0,"language":"en","make":"Google Inc."},"params":{"host":"tappx.com","bidfloor":0.005},"regs":{"gdpr":0,"ext":{}}}', 'bids': {'bidder': 'tappx', 'params': {'host': 'testing.ssp.tappx.com/rtb/v2/', 'tappxkey': 'pub-1234-desktop-1234', 'endpoint': 'VZ12TESTCTV', 'bidfloor': 0.005, 'test': true}, 'crumbs': {'pubcid': 'dccfe922-3823-4676-b7b2-e5ed8743154e'}, 'ortb2Imp': {'ext': {'data': {'pbadslot': 'video-ad-div'}}}, 'renderer': {'options': {'text': 'Tappx Outstream Video'}}, 'mediaTypes': {'video': {'mimes': ['video/mp4', 'application/javascript'], 'minduration': 3, 'maxduration': 30, 'startdelay': 5, 'playbackmethod': [1, 3], 'api': [1, 2], 'protocols': [2, 3], 'battr': [13, 14], 'linearity': 1, 'placement': 2, 'minbitrate': 10, 'maxbitrate': 10, 'w': 320, 'h': 250}}, 'adUnitCode': 'video-ad-div', 'transactionId': 'ed41c805-d14c-49c3-954d-26b98b2aa2c2', 'sizes': [[320, 250]], 'bidId': '28f49c71b13f2f', 'bidderRequestId': '1401710496dc7', 'auctionId': 'e807363f-3095-43a8-a4a6-f44196cb7318', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0}}
diff --git a/test/spec/modules/teadsBidAdapter_spec.js b/test/spec/modules/teadsBidAdapter_spec.js
index 75ed7452b57..c0845d93bde 100644
--- a/test/spec/modules/teadsBidAdapter_spec.js
+++ b/test/spec/modules/teadsBidAdapter_spec.js
@@ -147,9 +147,9 @@ describe('teadsBidAdapter', () => {
'consentString': consentString,
'gdprApplies': true,
'vendorData': {
- 'hasGlobalConsent': false
+ 'isServiceSpecific': true
},
- 'apiVersion': 1
+ 'apiVersion': 2
}
};
@@ -159,14 +159,14 @@ describe('teadsBidAdapter', () => {
expect(payload.gdpr_iab).to.exist;
expect(payload.gdpr_iab.consent).to.equal(consentString);
expect(payload.gdpr_iab.status).to.equal(12);
- expect(payload.gdpr_iab.apiVersion).to.equal(1);
+ expect(payload.gdpr_iab.apiVersion).to.equal(2);
});
it('should add referer info to payload', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ page: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2
}
@@ -245,9 +245,9 @@ describe('teadsBidAdapter', () => {
'consentString': consentString,
'gdprApplies': true,
'vendorData': {
- 'hasGlobalScope': true
+ 'isServiceSpecific': false,
},
- 'apiVersion': 1
+ 'apiVersion': 2
}
};
@@ -257,7 +257,7 @@ describe('teadsBidAdapter', () => {
expect(payload.gdpr_iab).to.exist;
expect(payload.gdpr_iab.consent).to.equal(consentString);
expect(payload.gdpr_iab.status).to.equal(11);
- expect(payload.gdpr_iab.apiVersion).to.equal(1);
+ expect(payload.gdpr_iab.apiVersion).to.equal(2);
});
it('should send GDPR TCF2 to endpoint with 12 status', function() {
@@ -294,7 +294,7 @@ describe('teadsBidAdapter', () => {
'consentString': undefined,
'gdprApplies': undefined,
'vendorData': undefined,
- 'apiVersion': 1
+ 'apiVersion': 2
}
};
@@ -304,7 +304,7 @@ describe('teadsBidAdapter', () => {
expect(payload.gdpr_iab).to.exist;
expect(payload.gdpr_iab.consent).to.equal('');
expect(payload.gdpr_iab.status).to.equal(22);
- expect(payload.gdpr_iab.apiVersion).to.equal(1);
+ expect(payload.gdpr_iab.apiVersion).to.equal(2);
});
it('should send GDPR to endpoint with 0 status', function() {
@@ -319,7 +319,7 @@ describe('teadsBidAdapter', () => {
'vendorData': {
'hasGlobalScope': false
},
- 'apiVersion': 1
+ 'apiVersion': 2
}
};
@@ -329,7 +329,7 @@ describe('teadsBidAdapter', () => {
expect(payload.gdpr_iab).to.exist;
expect(payload.gdpr_iab.consent).to.equal(consentString);
expect(payload.gdpr_iab.status).to.equal(0);
- expect(payload.gdpr_iab.apiVersion).to.equal(1);
+ expect(payload.gdpr_iab.apiVersion).to.equal(2);
});
it('should send GDPR to endpoint with 0 status when gdprApplies = false (vendorData = undefined)', function() {
@@ -341,7 +341,7 @@ describe('teadsBidAdapter', () => {
'consentString': undefined,
'gdprApplies': false,
'vendorData': undefined,
- 'apiVersion': 1
+ 'apiVersion': 2
}
};
@@ -351,7 +351,7 @@ describe('teadsBidAdapter', () => {
expect(payload.gdpr_iab).to.exist;
expect(payload.gdpr_iab.consent).to.equal('');
expect(payload.gdpr_iab.status).to.equal(0);
- expect(payload.gdpr_iab.apiVersion).to.equal(1);
+ expect(payload.gdpr_iab.apiVersion).to.equal(2);
});
it('should send GDPR to endpoint with 12 status when apiVersion = 0', function() {
@@ -364,7 +364,7 @@ describe('teadsBidAdapter', () => {
'consentString': consentString,
'gdprApplies': true,
'vendorData': {
- 'hasGlobalScope': false
+ 'isServiceSpecific': true
},
'apiVersion': 0
}
@@ -470,56 +470,6 @@ describe('teadsBidAdapter', () => {
'deviceWidth': 1680
};
- describe('FLoC ID', function () {
- it('should not add cohortId and cohortVersion params to payload if FLoC ID system is not enabled', function () {
- const bidRequest = {
- ...baseBidRequest,
- userId: {} // no "flocId" property -> assumption that the FLoC ID system is disabled
- };
-
- const request = spec.buildRequests([bidRequest], bidderResquestDefault);
- const payload = JSON.parse(request.data);
-
- expect(payload).not.to.have.property('cohortId');
- expect(payload).not.to.have.property('cohortVersion');
- });
-
- it('should add cohortId param to payload if FLoC ID system is enabled and ID available, but not version', function () {
- const bidRequest = {
- ...baseBidRequest,
- userId: {
- flocId: {
- id: 'my-floc-id'
- }
- }
- };
-
- const request = spec.buildRequests([bidRequest], bidderResquestDefault);
- const payload = JSON.parse(request.data);
-
- expect(payload.cohortId).to.equal('my-floc-id');
- expect(payload).not.to.have.property('cohortVersion');
- });
-
- it('should add cohortId and cohortVersion params to payload if FLoC ID system is enabled', function () {
- const bidRequest = {
- ...baseBidRequest,
- userId: {
- flocId: {
- id: 'my-floc-id',
- version: 'chrome.1.1'
- }
- }
- };
-
- const request = spec.buildRequests([bidRequest], bidderResquestDefault);
- const payload = JSON.parse(request.data);
-
- expect(payload.cohortId).to.equal('my-floc-id');
- expect(payload.cohortVersion).to.equal('chrome.1.1');
- });
- });
-
describe('Unified ID v2', function () {
it('should not add unifiedId2 param to payload if uid2 system is not enabled', function () {
const bidRequest = {
diff --git a/test/spec/modules/tpmnBidAdapter_spec.js b/test/spec/modules/tpmnBidAdapter_spec.js
index 468769c2573..e2b14b18f61 100644
--- a/test/spec/modules/tpmnBidAdapter_spec.js
+++ b/test/spec/modules/tpmnBidAdapter_spec.js
@@ -98,7 +98,7 @@ describe('tpmnAdapterTests', function () {
const tempBidRequests = [bid];
const tempBidderRequest = {
refererInfo: {
- referer: 'http://localhost/test',
+ page: 'http://localhost/test',
site: {
domain: 'localhost',
page: 'http://localhost/test'
diff --git a/test/spec/modules/trionBidAdapter_spec.js b/test/spec/modules/trionBidAdapter_spec.js
index 0fc03caa563..d7f09c2a057 100644
--- a/test/spec/modules/trionBidAdapter_spec.js
+++ b/test/spec/modules/trionBidAdapter_spec.js
@@ -71,10 +71,16 @@ describe('Trion adapter tests', function () {
beforeEach(function () {
// adapter = trionAdapter.createNew();
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ trion: {
+ storageAllowed: true
+ }
+ };
sinon.stub(document.body, 'appendChild');
});
afterEach(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
document.body.appendChild.restore();
});
diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js
index fc33a7cd676..733265b0bae 100644
--- a/test/spec/modules/tripleliftBidAdapter_spec.js
+++ b/test/spec/modules/tripleliftBidAdapter_spec.js
@@ -370,7 +370,7 @@ describe('triplelift adapter', function () {
}
],
refererInfo: {
- referer: 'https://examplereferer.com'
+ page: 'https://examplereferer.com'
},
gdprConsent: {
consentString: GDPR_CONSENT_STR,
@@ -814,13 +814,7 @@ describe('triplelift adapter', function () {
sens: sens,
}
}
- sandbox.stub(config, 'getConfig').callsFake(key => {
- const config = {
- ortb2
- };
- return utils.deepAccess(config, key);
- });
- const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, {...bidderRequest, ortb2});
const { data: payload } = request;
expect(payload.ext.fpd.user).to.not.exist;
expect(payload.ext.fpd.context.ext.data).to.haveOwnProperty('category');
diff --git a/test/spec/modules/trustxBidAdapter_spec.js b/test/spec/modules/trustxBidAdapter_spec.js
deleted file mode 100644
index b34813948fc..00000000000
--- a/test/spec/modules/trustxBidAdapter_spec.js
+++ /dev/null
@@ -1,1372 +0,0 @@
-import { expect } from 'chai';
-import { spec } from 'modules/trustxBidAdapter.js';
-import { newBidder } from 'src/adapters/bidderFactory.js';
-import { config } from 'src/config.js';
-
-describe('TrustXAdapter', function () {
- const adapter = newBidder(spec);
-
- describe('inherited functions', function () {
- it('exists and is a function', function () {
- expect(adapter.callBids).to.exist.and.to.be.a('function');
- });
- });
-
- describe('isBidRequestValid', function () {
- let bid = {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '44'
- },
- 'adUnitCode': 'adunit-code',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
-
- it('should return true when required params found', function () {
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
-
- it('should return false when required params are not passed', function () {
- let bid = Object.assign({}, bid);
- delete bid.params;
- bid.params = {
- 'uid': 0
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
- });
-
- describe('buildRequests', function () {
- function parseRequest(data) {
- return JSON.parse(data);
- }
- const bidderRequest = {
- refererInfo: {referer: 'https://example.com'},
- bidderRequestId: '22edbae2733bf6',
- auctionId: '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
- timeout: 3000
- };
- const referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
-
- let bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43',
- 'bidFloor': 1.25,
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [300, 600]]
- }
- },
- 'bidId': '42dbe3a7168a6a',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '44',
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '45',
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[728, 90]],
- 'mediaTypes': {
- 'video': {
- 'playerSize': [[400, 600]],
- 'mimes': ['video/mp4', 'video/webm', 'application/javascript', 'video/ogg']
- }
- },
- 'bidId': '3150ccb55da321',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '41',
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[728, 90]],
- 'mediaTypes': {
- 'video': {
- 'playerSize': [[400, 600]],
- 'protocols': [1, 2, 3]
- },
- 'banner': {
- 'sizes': [[728, 90]]
- }
- },
- 'bidId': '3150ccb55da321',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
- }
- ];
-
- it('should attach valid params to the tag', function () {
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.deep.equal({
- 'id': bidderRequest.bidderRequestId,
- 'site': {
- 'page': referrer
- },
- 'tmax': bidderRequest.timeout,
- 'source': {
- 'tid': bidderRequest.auctionId,
- 'ext': {'wrapper': 'Prebid_js', 'wrapper_version': '$prebid.version$'}
- },
- 'imp': [{
- 'id': bidRequests[0].bidId,
- 'tagid': bidRequests[0].params.uid,
- 'ext': {'divid': bidRequests[0].adUnitCode},
- 'bidfloor': bidRequests[0].params.bidFloor,
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }]
- });
- });
-
- it('make possible to process request without mediaTypes', function () {
- const request = spec.buildRequests([bidRequests[0], bidRequests[1]], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.deep.equal({
- 'id': bidderRequest.bidderRequestId,
- 'site': {
- 'page': referrer
- },
- 'tmax': bidderRequest.timeout,
- 'source': {
- 'tid': bidderRequest.auctionId,
- 'ext': {'wrapper': 'Prebid_js', 'wrapper_version': '$prebid.version$'}
- },
- 'imp': [{
- 'id': bidRequests[0].bidId,
- 'tagid': bidRequests[0].params.uid,
- 'ext': {'divid': bidRequests[0].adUnitCode},
- 'bidfloor': bidRequests[0].params.bidFloor,
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }, {
- 'id': bidRequests[1].bidId,
- 'tagid': bidRequests[1].params.uid,
- 'ext': {'divid': bidRequests[1].adUnitCode},
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }]
- });
- });
-
- it('should attach valid params to the video tag', function () {
- const request = spec.buildRequests(bidRequests.slice(0, 3), bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.deep.equal({
- 'id': bidderRequest.bidderRequestId,
- 'site': {
- 'page': referrer
- },
- 'tmax': bidderRequest.timeout,
- 'source': {
- 'tid': bidderRequest.auctionId,
- 'ext': {'wrapper': 'Prebid_js', 'wrapper_version': '$prebid.version$'}
- },
- 'imp': [{
- 'id': bidRequests[0].bidId,
- 'tagid': bidRequests[0].params.uid,
- 'ext': {'divid': bidRequests[0].adUnitCode},
- 'bidfloor': bidRequests[0].params.bidFloor,
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }, {
- 'id': bidRequests[1].bidId,
- 'tagid': bidRequests[1].params.uid,
- 'ext': {'divid': bidRequests[1].adUnitCode},
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }, {
- 'id': bidRequests[2].bidId,
- 'tagid': bidRequests[2].params.uid,
- 'ext': {'divid': bidRequests[2].adUnitCode},
- 'video': {
- 'w': 400,
- 'h': 600,
- 'mimes': ['video/mp4', 'video/webm', 'application/javascript', 'video/ogg']
- }
- }]
- });
- });
-
- it('should support mixed mediaTypes', function () {
- const request = spec.buildRequests(bidRequests, bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.deep.equal({
- 'id': bidderRequest.bidderRequestId,
- 'site': {
- 'page': referrer
- },
- 'tmax': bidderRequest.timeout,
- 'source': {
- 'tid': bidderRequest.auctionId,
- 'ext': {'wrapper': 'Prebid_js', 'wrapper_version': '$prebid.version$'}
- },
- 'imp': [{
- 'id': bidRequests[0].bidId,
- 'tagid': bidRequests[0].params.uid,
- 'ext': {'divid': bidRequests[0].adUnitCode},
- 'bidfloor': bidRequests[0].params.bidFloor,
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }, {
- 'id': bidRequests[1].bidId,
- 'tagid': bidRequests[1].params.uid,
- 'ext': {'divid': bidRequests[1].adUnitCode},
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }, {
- 'id': bidRequests[2].bidId,
- 'tagid': bidRequests[2].params.uid,
- 'ext': {'divid': bidRequests[2].adUnitCode},
- 'video': {
- 'w': 400,
- 'h': 600,
- 'mimes': ['video/mp4', 'video/webm', 'application/javascript', 'video/ogg'],
- }
- }, {
- 'id': bidRequests[3].bidId,
- 'tagid': bidRequests[3].params.uid,
- 'ext': {'divid': bidRequests[3].adUnitCode},
- 'banner': {
- 'w': 728,
- 'h': 90,
- 'format': [{'w': 728, 'h': 90}]
- },
- 'video': {
- 'w': 400,
- 'h': 600,
- 'protocols': [1, 2, 3]
- }
- }]
- });
- });
-
- it('if gdprConsent is present payload must have gdpr params', function () {
- const gdprBidderRequest = Object.assign({gdprConsent: {consentString: 'AAA', gdprApplies: true}}, bidderRequest);
- const request = spec.buildRequests(bidRequests, gdprBidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.have.property('user');
- expect(payload.user).to.have.property('ext');
- expect(payload.user.ext).to.have.property('consent', 'AAA');
- expect(payload).to.have.property('regs');
- expect(payload.regs).to.have.property('ext');
- expect(payload.regs.ext).to.have.property('gdpr', 1);
- });
-
- it('if usPrivacy is present payload must have us_privacy param', function () {
- const bidderRequestWithUSP = Object.assign({uspConsent: '1YNN'}, bidderRequest);
- const request = spec.buildRequests(bidRequests, bidderRequestWithUSP);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.have.property('regs');
- expect(payload.regs).to.have.property('ext');
- expect(payload.regs.ext).to.have.property('us_privacy', '1YNN');
- });
-
- it('if userId is present payload must have user.ext param with right keys', function () {
- const eids = [
- {
- source: 'pubcid.org',
- uids: [{
- id: 'some-random-id-value',
- atype: 1
- }]
- },
- {
- source: 'adserver.org',
- uids: [{
- id: 'some-random-id-value',
- atype: 1,
- ext: {
- rtiPartner: 'TDID'
- }
- }]
- }
- ];
- const bidRequestsWithUserIds = bidRequests.map((bid) => {
- return Object.assign({
- userIdAsEids: eids
- }, bid);
- });
- const request = spec.buildRequests(bidRequestsWithUserIds, bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.have.property('user');
- expect(payload.user).to.have.property('ext');
- expect(payload.user.ext.eids).to.deep.equal(eids);
- });
-
- it('if schain is present payload must have source.ext.schain param', function () {
- const schain = {
- complete: 1,
- nodes: [
- {
- asi: 'indirectseller.com',
- sid: '00001',
- hp: 1
- }
- ]
- };
- const bidRequestsWithSChain = bidRequests.map((bid) => {
- return Object.assign({
- schain: schain
- }, bid);
- });
- const request = spec.buildRequests(bidRequestsWithSChain, bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.have.property('source');
- expect(payload.source).to.have.property('ext');
- expect(payload.source.ext).to.have.property('schain');
- expect(payload.source.ext.schain).to.deep.equal(schain);
- });
-
- it('if content and segment is present in jwTargeting, payload must have right params', function () {
- const jsContent = {id: 'test_jw_content_id'};
- const jsSegments = ['test_seg_1', 'test_seg_2'];
- const bidRequestsWithJwTargeting = bidRequests.map((bid) => {
- return Object.assign({
- rtd: {
- jwplayer: {
- targeting: {
- segments: jsSegments,
- content: jsContent
- }
- }
- }
- }, bid);
- });
- const request = spec.buildRequests(bidRequestsWithJwTargeting, bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.have.property('user');
- expect(payload.user.data).to.deep.equal([{
- name: 'iow_labs_pub_data',
- segment: [
- {name: 'jwpseg', value: jsSegments[0]},
- {name: 'jwpseg', value: jsSegments[1]}
- ]
- }]);
- expect(payload).to.have.property('site');
- expect(payload.site.content).to.deep.equal(jsContent);
- });
-
- it('should have user.data filled from config ortb2.user.data', function () {
- const userData = [
- {
- name: 'someName',
- segment: [1, 2, { anyKey: 'anyVal' }, 'segVal', { id: 'segId' }, { value: 'segValue' }, { id: 'segId2', name: 'segName' }]
- },
- {
- name: 'permutive.com',
- segment: [1, 2, 'segVal', { id: 'segId' }, { anyKey: 'anyVal' }, { value: 'segValue' }, { id: 'segId2', name: 'segName' }]
- },
- {
- someKey: 'another data'
- }
- ];
-
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user.data' ? userData : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
- const payload = parseRequest(request.data);
- expect(payload.user.data).to.deep.equal(userData);
- getConfigStub.restore();
- });
-
- it('should have right value in user.data when jwpsegments are present', function () {
- const userData = [
- {
- name: 'someName',
- segment: [1, 2, { anyKey: 'anyVal' }, 'segVal', { id: 'segId' }, { value: 'segValue' }, { id: 'segId2', name: 'segName' }]
- },
- {
- name: 'permutive.com',
- segment: [1, 2, 'segVal', { id: 'segId' }, { anyKey: 'anyVal' }, { value: 'segValue' }, { id: 'segId2', name: 'segName' }]
- },
- {
- someKey: 'another data'
- }
- ];
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user.data' ? userData : null);
-
- const jsContent = {id: 'test_jw_content_id'};
- const jsSegments = ['test_seg_1', 'test_seg_2'];
- const bidRequestsWithJwTargeting = Object.assign({}, bidRequests[0], {
- rtd: {
- jwplayer: {
- targeting: {
- segments: jsSegments,
- content: jsContent
- }
- }
- }
- });
- const request = spec.buildRequests([bidRequestsWithJwTargeting], bidderRequest);
- const payload = parseRequest(request.data);
- expect(payload.user.data).to.deep.equal([{
- name: 'iow_labs_pub_data',
- segment: [
- {name: 'jwpseg', value: jsSegments[0]},
- {name: 'jwpseg', value: jsSegments[1]}
- ]
- }, ...userData]);
- getConfigStub.restore();
- });
-
- it('should contain the keyword values if it present in ortb2.(site/user)', function () {
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'ortb2.user' ? {'keywords': 'foo,any'} : (arg === 'ortb2.site' ? {'keywords': 'bar'} : null));
- const keywords = {
- 'site': {
- 'somePublisher': [
- {
- 'name': 'someName',
- 'brandsafety': ['disaster'],
- 'topic': ['stress', 'fear']
- }
- ]
- },
- 'user': {
- 'formatedPublisher': [
- {
- 'name': 'fomatedName',
- 'segments': [
- { 'name': 'segName1', 'value': 'segVal1' },
- { 'name': 'segName2', 'value': 'segVal2' }
- ]
- }
- ]
- }
- };
- const bidRequestWithKW = { ...bidRequests[0], params: { ...bidRequests[0].params, keywords } }
- const request = spec.buildRequests([bidRequestWithKW], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.ext.keywords).to.deep.equal({
- 'site': {
- 'somePublisher': [
- {
- 'name': 'someName',
- 'segments': [
- { 'name': 'brandsafety', 'value': 'disaster' },
- { 'name': 'topic', 'value': 'stress' },
- { 'name': 'topic', 'value': 'fear' }
- ]
- }
- ],
- 'ortb2': [
- {
- 'name': 'keywords',
- 'segments': [
- { 'name': 'keywords', 'value': 'bar' }
- ]
- }
- ]
- },
- 'user': {
- 'formatedPublisher': [
- {
- 'name': 'fomatedName',
- 'segments': [
- { 'name': 'segName1', 'value': 'segVal1' },
- { 'name': 'segName2', 'value': 'segVal2' }
- ]
- }
- ],
- 'ortb2': [
- {
- 'name': 'keywords',
- 'segments': [
- { 'name': 'keywords', 'value': 'foo' },
- { 'name': 'keywords', 'value': 'any' }
- ]
- }
- ]
- }
- });
- getConfigStub.restore();
- });
-
- it('should be right tmax when timeout in config is less then timeout in bidderRequest', function() {
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'bidderTimeout' ? 2000 : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.tmax).to.equal(2000);
- getConfigStub.restore();
- });
- it('should be right tmax when timeout in bidderRequest is less then timeout in config', function() {
- const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
- arg => arg === 'bidderTimeout' ? 5000 : null);
- const request = spec.buildRequests([bidRequests[0]], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.tmax).to.equal(3000);
- getConfigStub.restore();
- });
- it('should contain imp[].ext.data.adserver if available', function() {
- const ortb2Imp = [{
- ext: {
- data: {
- adserver: {
- name: 'ad_server_name',
- adslot: '/111111/slot'
- },
- pbadslot: '/111111/slot'
- }
- }
- }, {
- ext: {
- data: {
- adserver: {
- name: 'ad_server_name',
- adslot: '/222222/slot'
- },
- pbadslot: '/222222/slot'
- }
- }
- }];
- const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 3).map((bid, ind) => {
- return Object.assign(ortb2Imp[ind] ? { ortb2Imp: ortb2Imp[ind] } : {}, bid);
- });
- const request = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.imp[0].ext).to.deep.equal({
- divid: bidRequests[0].adUnitCode,
- data: ortb2Imp[0].ext.data,
- gpid: ortb2Imp[0].ext.data.adserver.adslot
- });
- expect(payload.imp[1].ext).to.deep.equal({
- divid: bidRequests[1].adUnitCode,
- data: ortb2Imp[1].ext.data,
- gpid: ortb2Imp[1].ext.data.adserver.adslot
- });
- expect(payload.imp[2].ext).to.deep.equal({
- divid: bidRequests[2].adUnitCode
- });
- });
- it('should contain imp[].instl if available', function() {
- const ortb2Imp = [{
- instl: 1
- }, {
- instl: 2,
- ext: {
- data: {
- adserver: {
- name: 'ad_server_name',
- adslot: '/222222/slot'
- },
- pbadslot: '/222222/slot'
- }
- }
- }];
- const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 3).map((bid, ind) => {
- return Object.assign(ortb2Imp[ind] ? { ortb2Imp: ortb2Imp[ind] } : {}, bid);
- });
- const request = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.imp[0].instl).to.equal(1);
- expect(payload.imp[1].ext).to.deep.equal({
- divid: bidRequests[1].adUnitCode,
- data: ortb2Imp[1].ext.data,
- gpid: ortb2Imp[1].ext.data.adserver.adslot
- });
- expect(payload.imp[1].instl).to.equal(2);
- expect(payload.imp[2].ext).to.deep.equal({
- divid: bidRequests[2].adUnitCode
- });
- expect(payload.imp[2].instl).to.be.undefined;
- });
- it('all id like request fields must be a string', function () {
- const bidderRequestWithNumId = Object.assign({}, bidderRequest, { bidderRequestId: 123123, auctionId: 345345543 });
-
- let bidRequestWithNumId = {
- 'bidder': 'trustx',
- 'params': {
- 'uid': 43,
- },
- 'adUnitCode': 111111,
- 'sizes': [[300, 250], [300, 600]],
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [300, 600]]
- }
- },
- 'bidId': 23423423,
- 'bidderRequestId': 123123,
- 'auctionId': 345345543,
- };
-
- const request = spec.buildRequests([bidRequestWithNumId], bidderRequestWithNumId);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload).to.deep.equal({
- 'id': '123123',
- 'site': {
- 'page': referrer
- },
- 'tmax': bidderRequest.timeout,
- 'source': {
- 'tid': '345345543',
- 'ext': {'wrapper': 'Prebid_js', 'wrapper_version': '$prebid.version$'}
- },
- 'imp': [{
- 'id': '23423423',
- 'tagid': '43',
- 'ext': {'divid': '111111'},
- 'banner': {
- 'w': 300,
- 'h': 250,
- 'format': [{'w': 300, 'h': 250}, {'w': 300, 'h': 600}]
- }
- }]
- });
- });
-
- describe('floorModule', function () {
- const floorTestData = {
- 'currency': 'USD',
- 'floor': 1.50
- };
- const bidRequest = Object.assign({
- getFloor: (_) => {
- return floorTestData;
- }
- }, bidRequests[1]);
- it('should return the value from getFloor if present', function () {
- const request = spec.buildRequests([bidRequest], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.imp[0].bidfloor).to.equal(floorTestData.floor);
- });
- it('should return the getFloor.floor value if it is greater than bidfloor', function () {
- const bidfloor = 0.80;
- const bidRequestsWithFloor = { ...bidRequest };
- bidRequestsWithFloor.params = Object.assign({bidFloor: bidfloor}, bidRequestsWithFloor.params);
- const request = spec.buildRequests([bidRequestsWithFloor], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.imp[0].bidfloor).to.equal(floorTestData.floor);
- });
- it('should return the bidfloor value if it is greater than getFloor.floor', function () {
- const bidfloor = 1.80;
- const bidRequestsWithFloor = { ...bidRequest };
- bidRequestsWithFloor.params = Object.assign({bidFloor: bidfloor}, bidRequestsWithFloor.params);
- const request = spec.buildRequests([bidRequestsWithFloor], bidderRequest);
- expect(request.data).to.be.an('string');
- const payload = parseRequest(request.data);
- expect(payload.imp[0].bidfloor).to.equal(bidfloor);
- });
- });
- });
-
- describe('interpretResponse', function () {
- const responses = [
- {'bid': [{'impid': '659423fff799cb', 'price': 1.15, 'adm': 'test content 1
', 'auid': 43, 'h': 250, 'w': 300, 'adomain': ['somedomain.com']}], 'seat': '1'},
- {'bid': [{'impid': '4dff80cc4ee346', 'price': 0.5, 'adm': 'test content 2
', 'auid': 44, 'h': 600, 'w': 300}], 'seat': '1'},
- {'bid': [{'impid': '5703af74d0472a', 'price': 0.15, 'adm': 'test content 3
', 'auid': 43, 'h': 90, 'w': 728}], 'seat': '1'},
- {'bid': [{'impid': '659423faac49cb', 'price': 0, 'auid': 45, 'h': 250, 'w': 300}], 'seat': '1'},
- {'bid': [{'price': 0, 'adm': 'test content 5
', 'h': 250, 'w': 300}], 'seat': '1'},
- undefined,
- {'bid': [], 'seat': '1'},
- {'seat': '1'},
- ];
-
- it('should get correct bid response', function () {
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '659423fff799cb',
- 'bidderRequestId': '5f2009617a7c0a',
- 'auctionId': '1cbd2feafe5e8b',
- }
- ];
- const request = spec.buildRequests(bidRequests);
- const expectedResponse = [
- {
- 'requestId': '659423fff799cb',
- 'cpm': 1.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'ad': 'test content 1
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': ['somedomain.com']
- },
- }
- ];
-
- const result = spec.interpretResponse({'body': {'seatbid': [responses[0]]}}, request);
- expect(result).to.deep.equal(expectedResponse);
- });
-
- it('should get correct multi bid response', function () {
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '659423fff799cb',
- 'bidderRequestId': '2c2bb1972df9a',
- 'auctionId': '1fa09aee5c8c99',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '44'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '4dff80cc4ee346',
- 'bidderRequestId': '2c2bb1972df9a',
- 'auctionId': '1fa09aee5c8c99',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[728, 90]],
- 'bidId': '5703af74d0472a',
- 'bidderRequestId': '2c2bb1972df9a',
- 'auctionId': '1fa09aee5c8c99',
- }
- ];
- const request = spec.buildRequests(bidRequests);
- const expectedResponse = [
- {
- 'requestId': '659423fff799cb',
- 'cpm': 1.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'ad': 'test content 1
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': ['somedomain.com']
- },
- },
- {
- 'requestId': '4dff80cc4ee346',
- 'cpm': 0.5,
- 'creativeId': 44,
- 'dealId': undefined,
- 'width': 300,
- 'height': 600,
- 'ad': 'test content 2
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- },
- {
- 'requestId': '5703af74d0472a',
- 'cpm': 0.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 728,
- 'height': 90,
- 'ad': 'test content 3
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- }
- ];
-
- const result = spec.interpretResponse({'body': {'seatbid': responses.slice(0, 3)}}, request);
- expect(result).to.deep.equal(expectedResponse);
- });
-
- it('handles wrong and nobid responses', function () {
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '45'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '300bfeb0d7190gf',
- 'bidderRequestId': '2c2bb1972d23af',
- 'auctionId': '1fa09aee5c84d34',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '46'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '300bfeb0d71321',
- 'bidderRequestId': '2c2bb1972d23af',
- 'auctionId': '1fa09aee5c84d34',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '50'
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[728, 90]],
- 'bidId': '300bfeb0d7183bb',
- 'bidderRequestId': '2c2bb1972d23af',
- 'auctionId': '1fa09aee5c84d34',
- }
- ];
- const request = spec.buildRequests(bidRequests);
- const result = spec.interpretResponse({'body': {'seatbid': responses.slice(3)}}, request);
- expect(result.length).to.equal(0);
- });
-
- it('complicated case', function () {
- const fullResponse = [
- {'bid': [{'impid': '2164be6358b9', 'price': 1.15, 'adm': 'test content 1
', 'auid': 43, 'h': 250, 'w': 300}], 'seat': '1'},
- {'bid': [{'impid': '4e111f1b66e4', 'price': 0.5, 'adm': 'test content 2
', 'auid': 44, 'h': 600, 'w': 300}], 'seat': '1'},
- {'bid': [{'impid': '26d6f897b516', 'price': 0.15, 'adm': 'test content 3
', 'auid': 43, 'h': 90, 'w': 728}], 'seat': '1'},
- {'bid': [{'impid': '326bde7fbf69', 'price': 0.15, 'adm': 'test content 4
', 'auid': 43, 'h': 600, 'w': 300}], 'seat': '1'},
- {'bid': [{'impid': '1751cd90161', 'price': 0.5, 'adm': 'test content 5
', 'auid': 44, 'h': 600, 'w': 350}], 'seat': '1'},
- ];
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '2164be6358b9',
- 'bidderRequestId': '106efe3247',
- 'auctionId': '32a1f276cb87cb8',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '326bde7fbf69',
- 'bidderRequestId': '106efe3247',
- 'auctionId': '32a1f276cb87cb8',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '44'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '4e111f1b66e4',
- 'bidderRequestId': '106efe3247',
- 'auctionId': '32a1f276cb87cb8',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[728, 90]],
- 'bidId': '26d6f897b516',
- 'bidderRequestId': '106efe3247',
- 'auctionId': '32a1f276cb87cb8',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '44'
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[728, 90]],
- 'bidId': '1751cd90161',
- 'bidderRequestId': '106efe3247',
- 'auctionId': '32a1f276cb87cb8',
- }
- ];
- const request = spec.buildRequests(bidRequests);
- const expectedResponse = [
- {
- 'requestId': '2164be6358b9',
- 'cpm': 1.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'ad': 'test content 1
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- },
- {
- 'requestId': '4e111f1b66e4',
- 'cpm': 0.5,
- 'creativeId': 44,
- 'dealId': undefined,
- 'width': 300,
- 'height': 600,
- 'ad': 'test content 2
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- },
- {
- 'requestId': '26d6f897b516',
- 'cpm': 0.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 728,
- 'height': 90,
- 'ad': 'test content 3
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- },
- {
- 'requestId': '326bde7fbf69',
- 'cpm': 0.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 300,
- 'height': 600,
- 'ad': 'test content 4
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- },
- {
- 'requestId': '1751cd90161',
- 'cpm': 0.5,
- 'creativeId': 44,
- 'dealId': undefined,
- 'width': 350,
- 'height': 600,
- 'ad': 'test content 5
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- }
- ];
-
- const result = spec.interpretResponse({'body': {'seatbid': fullResponse}}, request);
- expect(result).to.deep.equal(expectedResponse);
- });
-
- it('dublicate uids and sizes in one slot', function () {
- const fullResponse = [
- {'bid': [{'impid': '5126e301f4be', 'price': 1.15, 'adm': 'test content 1
', 'auid': 43, 'h': 250, 'w': 300}], 'seat': '1'},
- {'bid': [{'impid': '57b2ebe70e16', 'price': 0.5, 'adm': 'test content 2
', 'auid': 43, 'h': 250, 'w': 300}], 'seat': '1'},
- ];
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '5126e301f4be',
- 'bidderRequestId': '171c5405a390',
- 'auctionId': '35bcbc0f7e79c',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '57b2ebe70e16',
- 'bidderRequestId': '171c5405a390',
- 'auctionId': '35bcbc0f7e79c',
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '43'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '225fcd44b18c',
- 'bidderRequestId': '171c5405a390',
- 'auctionId': '35bcbc0f7e79c',
- }
- ];
- const request = spec.buildRequests(bidRequests);
- const expectedResponse = [
- {
- 'requestId': '5126e301f4be',
- 'cpm': 1.15,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'ad': 'test content 1
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- },
- {
- 'requestId': '57b2ebe70e16',
- 'cpm': 0.5,
- 'creativeId': 43,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'ad': 'test content 2
',
- 'currency': 'USD',
- 'mediaType': 'banner',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- }
- ];
-
- const result = spec.interpretResponse({'body': {'seatbid': fullResponse}}, request);
- expect(result).to.deep.equal(expectedResponse);
- });
- });
-
- it('should get correct video bid response', function () {
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '50'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '57dfefb80eca',
- 'bidderRequestId': '20394420a762a2',
- 'auctionId': '140132d07b031',
- 'mediaTypes': {
- 'video': {
- 'context': 'instream'
- }
- }
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '51'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': 'e893c787c22dd',
- 'bidderRequestId': '20394420a762a2',
- 'auctionId': '140132d07b031',
- 'mediaTypes': {
- 'video': {
- 'context': 'instream'
- }
- }
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '52'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '23312a43bc42',
- 'bidderRequestId': '20394420a762a2',
- 'auctionId': '140132d07b031',
- 'mediaTypes': {
- 'video': {
- 'context': 'instream'
- }
- }
- }
- ];
- const response = [
- {'bid': [{'impid': '57dfefb80eca', 'price': 1.15, 'adm': '\n<\/Ad>\n<\/VAST>', 'auid': 50, content_type: 'video', w: 300, h: 600}], 'seat': '2'},
- {'bid': [{'impid': '5126e301f4be', 'price': 1.00, 'adm': '\n<\/Ad>\n<\/VAST>', 'auid': 51, content_type: 'video'}], 'seat': '2'},
- {'bid': [{'impid': '23312a43bc42', 'price': 2.00, 'nurl': 'https://some_test_vast_url.com', 'auid': 52, content_type: 'video', w: 300, h: 600}], 'seat': '2'},
- ];
- const request = spec.buildRequests(bidRequests);
- const expectedResponse = [
- {
- 'requestId': '57dfefb80eca',
- 'cpm': 1.15,
- 'creativeId': 50,
- 'dealId': undefined,
- 'width': 300,
- 'height': 600,
- 'currency': 'USD',
- 'mediaType': 'video',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- 'vastXml': '\n<\/Ad>\n<\/VAST>',
- 'adResponse': {
- 'content': '\n<\/Ad>\n<\/VAST>'
- }
- },
- {
- 'requestId': '23312a43bc42',
- 'cpm': 2.00,
- 'creativeId': 52,
- 'dealId': undefined,
- 'width': 300,
- 'height': 600,
- 'currency': 'USD',
- 'mediaType': 'video',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- 'vastUrl': 'https://some_test_vast_url.com',
- },
- ];
-
- const result = spec.interpretResponse({'body': {'seatbid': response}}, request);
- expect(result).to.deep.equal(expectedResponse);
- });
-
- it('should have right renderer in the bid response', function () {
- const spySetRenderer = sinon.spy();
- const stubRenderer = {
- setRender: spySetRenderer
- };
- const spyRendererInstall = sinon.spy(function() { return stubRenderer; });
- const stubRendererConst = {
- install: spyRendererInstall
- };
- const bidRequests = [
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '50'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': 'e6e65553fc8',
- 'bidderRequestId': '1380f393215dc7',
- 'auctionId': '10b8d2f3c697e3',
- 'mediaTypes': {
- 'video': {
- 'context': 'outstream'
- }
- }
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '51'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': 'c8fdcb3f269f',
- 'bidderRequestId': '1380f393215dc7',
- 'auctionId': '10b8d2f3c697e3'
- },
- {
- 'bidder': 'trustx',
- 'params': {
- 'uid': '52'
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '1de036c37685',
- 'bidderRequestId': '1380f393215dc7',
- 'auctionId': '10b8d2f3c697e3',
- 'renderer': {}
- }
- ];
- const response = [
- {'bid': [{'impid': 'e6e65553fc8', 'price': 1.15, 'adm': '\n<\/Ad>\n<\/VAST>', 'auid': 50, content_type: 'video', w: 300, h: 600}], 'seat': '2'},
- {'bid': [{'impid': 'c8fdcb3f269f', 'price': 1.00, 'adm': '\n<\/Ad>\n<\/VAST>', 'auid': 51, content_type: 'video', w: 300, h: 250}], 'seat': '2'},
- {'bid': [{'impid': '1de036c37685', 'price': 1.20, 'adm': '\n<\/Ad>\n<\/VAST>', 'auid': 52, content_type: 'video', w: 300, h: 250}], 'seat': '2'}
- ];
- const request = spec.buildRequests(bidRequests);
- const expectedResponse = [
- {
- 'requestId': 'e6e65553fc8',
- 'cpm': 1.15,
- 'creativeId': 50,
- 'dealId': undefined,
- 'width': 300,
- 'height': 600,
- 'currency': 'USD',
- 'mediaType': 'video',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- 'vastXml': '\n<\/Ad>\n<\/VAST>',
- 'adResponse': {
- 'content': '\n<\/Ad>\n<\/VAST>'
- },
- 'renderer': stubRenderer
- },
- {
- 'requestId': 'c8fdcb3f269f',
- 'cpm': 1.00,
- 'creativeId': 51,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'currency': 'USD',
- 'mediaType': 'video',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- 'vastXml': '\n<\/Ad>\n<\/VAST>',
- 'adResponse': {
- 'content': '\n<\/Ad>\n<\/VAST>'
- },
- 'renderer': stubRenderer
- },
- {
- 'requestId': '1de036c37685',
- 'cpm': 1.20,
- 'creativeId': 52,
- 'dealId': undefined,
- 'width': 300,
- 'height': 250,
- 'currency': 'USD',
- 'mediaType': 'video',
- 'netRevenue': false,
- 'ttl': 360,
- 'meta': {
- 'advertiserDomains': []
- },
- 'vastXml': '\n<\/Ad>\n<\/VAST>',
- 'adResponse': {
- 'content': '\n<\/Ad>\n<\/VAST>'
- }
- }
- ];
-
- const result = spec.interpretResponse({'body': {'seatbid': response}}, request, stubRendererConst);
-
- expect(spySetRenderer.calledTwice).to.equal(true);
- expect(spySetRenderer.getCall(0).args[0]).to.be.a('function');
- expect(spySetRenderer.getCall(1).args[0]).to.be.a('function');
-
- expect(spyRendererInstall.calledTwice).to.equal(true);
- expect(spyRendererInstall.getCall(0).args[0]).to.deep.equal({
- id: 'e6e65553fc8',
- url: 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js',
- loaded: false
- });
- expect(spyRendererInstall.getCall(1).args[0]).to.deep.equal({
- id: 'c8fdcb3f269f',
- url: 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js',
- loaded: false
- });
-
- expect(result).to.deep.equal(expectedResponse);
- });
-});
diff --git a/test/spec/modules/ttdBidAdapter_spec.js b/test/spec/modules/ttdBidAdapter_spec.js
index 099e5e56c33..b933a5dd0c9 100644
--- a/test/spec/modules/ttdBidAdapter_spec.js
+++ b/test/spec/modules/ttdBidAdapter_spec.js
@@ -212,7 +212,7 @@ describe('ttdBidAdapter', function () {
'auctionStart': 1540945362095,
'timeout': 3000,
'refererInfo': {
- 'referer': 'https://www.example.com/test',
+ 'page': 'https://www.example.com/test',
'reachedTop': true,
'numIframes': 0,
'stack': [
@@ -285,12 +285,12 @@ describe('ttdBidAdapter', function () {
it('sets keywords properly if sent', function () {
let clonedBannerRequests = deepClone(baseBannerBidRequests);
- config.setConfig({ortb2: {
+ const ortb2 = {
site: {
keywords: 'highViewability, clothing, holiday shopping'
}
- }});
- const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
+ };
+ const requestBody = testBuildRequests(clonedBannerRequests, {...baseBidderRequest, ortb2}).data;
config.resetConfig();
expect(requestBody.ext.ttdprebid.keywords).to.deep.equal(['highViewability', 'clothing', 'holiday shopping']);
});
@@ -404,9 +404,7 @@ describe('ttdBidAdapter', function () {
});
it('adds first party site data to the request', function () {
- let clonedBidderRequest = deepClone(baseBidderRequest);
-
- config.setConfig({ortb2: {
+ const ortb2 = {
site: {
name: 'example',
domain: 'page.example.com',
@@ -417,9 +415,9 @@ describe('ttdBidAdapter', function () {
ref: 'https://ref.example.com',
keywords: 'power tools, drills'
}
- }});
+ };
+ let clonedBidderRequest = {...deepClone(baseBidderRequest), ortb2};
const requestBody = testBuildRequests(baseBannerBidRequests, clonedBidderRequest).data;
- config.resetConfig();
expect(requestBody.site.name).to.equal('example');
expect(requestBody.site.domain).to.equal('page.example.com');
expect(requestBody.site.cat[0]).to.equal('IAB2');
diff --git a/test/spec/modules/ucfunnelBidAdapter_spec.js b/test/spec/modules/ucfunnelBidAdapter_spec.js
index ac788e537e2..76e448b7694 100644
--- a/test/spec/modules/ucfunnelBidAdapter_spec.js
+++ b/test/spec/modules/ucfunnelBidAdapter_spec.js
@@ -17,7 +17,6 @@ const userId = {
'tdid': 'D6885E90-2A7A-4E0F-87CB-7734ED1B99A3',
'haloId': {},
'uid2': {'id': 'eb33b0cb-8d35-4722-b9c0-1a31d4064888'},
- 'flocId': {'id': '12144', 'version': 'chrome.1.1'},
'connectid': '4567'
}
@@ -160,7 +159,6 @@ describe('ucfunnel Adapter', function () {
expect(data.w).to.equal(width);
expect(data.h).to.equal(height);
expect(data.eids).to.equal('uid2,eb33b0cb-8d35-4722-b9c0-1a31d4064888!verizonMediaId,4567');
- expect(data.cid).to.equal('12144');
expect(data.schain).to.equal('1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com');
});
diff --git a/test/spec/modules/undertoneBidAdapter_spec.js b/test/spec/modules/undertoneBidAdapter_spec.js
index c24f63c0b99..8766307b3bd 100644
--- a/test/spec/modules/undertoneBidAdapter_spec.js
+++ b/test/spec/modules/undertoneBidAdapter_spec.js
@@ -152,13 +152,13 @@ const bidReqUserIds = [{
const bidderReq = {
refererInfo: {
- referer: 'http://prebid.org/dev-docs/bidder-adaptor.html'
+ topmostLocation: 'http://prebid.org/dev-docs/bidder-adaptor.html'
}
};
const bidderReqGdpr = {
refererInfo: {
- referer: 'http://prebid.org/dev-docs/bidder-adaptor.html'
+ topmostLocation: 'http://prebid.org/dev-docs/bidder-adaptor.html'
},
gdprConsent: {
gdprApplies: true,
@@ -168,14 +168,14 @@ const bidderReqGdpr = {
const bidderReqCcpa = {
refererInfo: {
- referer: 'http://prebid.org/dev-docs/bidder-adaptor.html'
+ topmostLocation: 'http://prebid.org/dev-docs/bidder-adaptor.html'
},
uspConsent: 'NY12'
};
const bidderReqCcpaAndGdpr = {
refererInfo: {
- referer: 'http://prebid.org/dev-docs/bidder-adaptor.html'
+ topmostLocation: 'http://prebid.org/dev-docs/bidder-adaptor.html'
},
gdprConsent: {
gdprApplies: true,
@@ -343,18 +343,18 @@ describe('Undertone Adapter', () => {
});
it('should send request to correct url via POST not in GDPR or CCPA', function () {
const request = spec.buildRequests(bidReq, bidderReq);
- const domainStart = bidderReq.refererInfo.referer.indexOf('//');
- const domainEnd = bidderReq.refererInfo.referer.indexOf('/', domainStart + 2);
- const domain = bidderReq.refererInfo.referer.substring(domainStart + 2, domainEnd);
+ const domainStart = bidderReq.refererInfo.topmostLocation.indexOf('//');
+ const domainEnd = bidderReq.refererInfo.topmostLocation.indexOf('/', domainStart + 2);
+ const domain = bidderReq.refererInfo.topmostLocation.substring(domainStart + 2, domainEnd);
const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}`;
expect(request.url).to.equal(REQ_URL);
expect(request.method).to.equal('POST');
});
it('should send request to correct url via POST when in GDPR', function () {
const request = spec.buildRequests(bidReq, bidderReqGdpr);
- const domainStart = bidderReq.refererInfo.referer.indexOf('//');
- const domainEnd = bidderReq.refererInfo.referer.indexOf('/', domainStart + 2);
- const domain = bidderReq.refererInfo.referer.substring(domainStart + 2, domainEnd);
+ const domainStart = bidderReq.refererInfo.topmostLocation.indexOf('//');
+ const domainEnd = bidderReq.refererInfo.topmostLocation.indexOf('/', domainStart + 2);
+ const domain = bidderReq.refererInfo.topmostLocation.substring(domainStart + 2, domainEnd);
let gdpr = bidderReqGdpr.gdprConsent.gdprApplies ? 1 : 0;
const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}&gdpr=${gdpr}&gdprstr=${bidderReqGdpr.gdprConsent.consentString}`;
expect(request.url).to.equal(REQ_URL);
@@ -362,9 +362,9 @@ describe('Undertone Adapter', () => {
});
it('should send request to correct url via POST when in CCPA', function () {
const request = spec.buildRequests(bidReq, bidderReqCcpa);
- const domainStart = bidderReq.refererInfo.referer.indexOf('//');
- const domainEnd = bidderReq.refererInfo.referer.indexOf('/', domainStart + 2);
- const domain = bidderReq.refererInfo.referer.substring(domainStart + 2, domainEnd);
+ const domainStart = bidderReq.refererInfo.topmostLocation.indexOf('//');
+ const domainEnd = bidderReq.refererInfo.topmostLocation.indexOf('/', domainStart + 2);
+ const domain = bidderReq.refererInfo.topmostLocation.substring(domainStart + 2, domainEnd);
let ccpa = bidderReqCcpa.uspConsent;
const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}&ccpa=${ccpa}`;
expect(request.url).to.equal(REQ_URL);
@@ -372,9 +372,9 @@ describe('Undertone Adapter', () => {
});
it('should send request to correct url via POST when in GDPR and CCPA', function () {
const request = spec.buildRequests(bidReq, bidderReqCcpaAndGdpr);
- const domainStart = bidderReq.refererInfo.referer.indexOf('//');
- const domainEnd = bidderReq.refererInfo.referer.indexOf('/', domainStart + 2);
- const domain = bidderReq.refererInfo.referer.substring(domainStart + 2, domainEnd);
+ const domainStart = bidderReq.refererInfo.topmostLocation.indexOf('//');
+ const domainEnd = bidderReq.refererInfo.topmostLocation.indexOf('/', domainStart + 2);
+ const domain = bidderReq.refererInfo.topmostLocation.substring(domainStart + 2, domainEnd);
let ccpa = bidderReqCcpaAndGdpr.uspConsent;
let gdpr = bidderReqCcpaAndGdpr.gdprConsent.gdprApplies ? 1 : 0;
const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}&gdpr=${gdpr}&gdprstr=${bidderReqGdpr.gdprConsent.consentString}&ccpa=${ccpa}`;
diff --git a/test/spec/modules/unicornBidAdapter_spec.js b/test/spec/modules/unicornBidAdapter_spec.js
index 1ab428d58b6..0abb09bfb78 100644
--- a/test/spec/modules/unicornBidAdapter_spec.js
+++ b/test/spec/modules/unicornBidAdapter_spec.js
@@ -270,7 +270,7 @@ const bidderRequest = {
auctionStart: 1581064124172,
timeout: 1000,
refererInfo: {
- referer: 'https://uni-corn.net/',
+ ref: 'https://uni-corn.net/',
reachedTop: true,
numIframes: 0,
stack: ['https://uni-corn.net/']
@@ -496,6 +496,16 @@ describe('unicornBidAdapterTest', () => {
});
describe('buildBidRequest', () => {
+ before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ unicorn: {
+ storageAllowed: true
+ }
+ };
+ });
+ after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
it('buildBidRequest', () => {
const req = spec.buildRequests(validBidRequests, bidderRequest);
const removeUntestableAttrs = data => {
diff --git a/test/spec/modules/userId_spec.js b/test/spec/modules/userId_spec.js
index 35242b92c0c..035c86a3cc1 100644
--- a/test/spec/modules/userId_spec.js
+++ b/test/spec/modules/userId_spec.js
@@ -30,7 +30,6 @@ import {dmdIdSubmodule} from 'modules/dmdIdSystem.js';
import {liveIntentIdSubmodule} from 'modules/liveIntentIdSystem.js';
import {merkleIdSubmodule} from 'modules/merkleIdSystem.js';
import {netIdSubmodule} from 'modules/netIdSystem.js';
-import {nextrollIdSubmodule} from 'modules/nextrollIdSystem.js';
import {intentIqIdSubmodule} from 'modules/intentIqIdSystem.js';
import {zeotapIdPlusSubmodule} from 'modules/zeotapIdPlusIdSystem.js';
import {sharedIdSystemSubmodule} from 'modules/sharedIdSystem.js';
@@ -43,16 +42,15 @@ import {getPrebidInternal} from 'src/utils.js';
import {uid2IdSubmodule} from 'modules/uid2IdSystem.js';
import {admixerIdSubmodule} from 'modules/admixerIdSystem.js';
import {deepintentDpesSubmodule} from 'modules/deepintentDpesIdSystem.js';
-import {flocIdSubmodule} from 'modules/flocIdSystem.js'
import {amxIdSubmodule} from '../../../modules/amxIdSystem.js';
-import {akamaiDAPIdSubmodule} from 'modules/akamaiDAPIdSystem.js'
-import {kinessoIdSubmodule} from 'modules/kinessoIdSystem.js'
+import {kinessoIdSubmodule} from 'modules/kinessoIdSystem.js';
import {adqueryIdSubmodule} from 'modules/adqueryIdSystem.js';
import * as mockGpt from '../integration/faker/googletag.js';
import 'src/prebid.js';
import {hook} from '../../../src/hook.js';
import {mockGdprConsent} from '../../helpers/consentData.js';
import {getPPID} from '../../../src/adserver.js';
+import {uninstall as uninstallGdprEnforcement} from 'modules/gdprEnforcement.js';
let assert = require('chai').assert;
let expect = require('chai').expect;
@@ -145,6 +143,7 @@ describe('User ID', function () {
before(function () {
hook.ready();
+ uninstallGdprEnforcement();
localStorage.removeItem(PBJS_USER_ID_OPTOUT_NAME);
});
@@ -722,7 +721,7 @@ describe('User ID', function () {
it('handles config with no usersync object', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({});
// usersync is undefined, and no logInfo message for 'User ID - usersync config updated'
expect(typeof utils.logInfo.args[0]).to.equal('undefined');
@@ -730,14 +729,14 @@ describe('User ID', function () {
it('handles config with empty usersync object', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({userSync: {}});
expect(typeof utils.logInfo.args[0]).to.equal('undefined');
});
it('handles config with usersync and userIds that are empty objs', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
userIds: [{}]
@@ -748,7 +747,7 @@ describe('User ID', function () {
it('handles config with usersync and userIds with empty names or that dont match a submodule.name', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
userIds: [{
@@ -765,7 +764,7 @@ describe('User ID', function () {
it('config with 1 configurations should create 1 submodules', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig(getConfigMock(['unifiedId', 'unifiedid', 'cookie']));
expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 1 submodules');
@@ -785,9 +784,9 @@ describe('User ID', function () {
expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 1 submodules');
});
- it('config with 24 configurations should result in 24 submodules add', function () {
+ it('config with 21 configurations should result in 21 submodules add', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, liveIntentIdSubmodule, britepoolIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, liveIntentIdSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
syncDelay: 0,
@@ -813,8 +812,6 @@ describe('User ID', function () {
}, {
name: 'netId',
storage: {name: 'netId', type: 'cookie'}
- }, {
- name: 'nextrollId'
}, {
name: 'intentIqId',
storage: {name: 'intentIqId', type: 'cookie'}
@@ -838,10 +835,6 @@ describe('User ID', function () {
}, {
name: 'deepintentId',
storage: {name: 'deepintentId', type: 'cookie'}
- }, {
- name: 'flocId'
- }, {
- name: 'akamaiDAPId'
}, {
name: 'dmdId',
storage: {name: 'dmdId', type: 'cookie'}
@@ -857,12 +850,12 @@ describe('User ID', function () {
}]
}
});
- expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 24 submodules');
+ expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 21 submodules');
});
it('config syncDelay updates module correctly', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
syncDelay: 99,
@@ -877,7 +870,7 @@ describe('User ID', function () {
it('config auctionDelay updates module correctly', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
auctionDelay: 100,
@@ -892,7 +885,7 @@ describe('User ID', function () {
it('config auctionDelay defaults to 0 if not a number', function () {
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
auctionDelay: '',
@@ -2221,7 +2214,7 @@ describe('User ID', function () {
localStorage.setItem('qid_exp', new Date(Date.now() + 5000).toUTCString())
init(config);
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, hadronIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
config.setConfig({
userSync: {
diff --git a/test/spec/modules/ventesBidAdapter_spec.js b/test/spec/modules/ventesBidAdapter_spec.js
index 219c24deced..ffe4ef79cfb 100644
--- a/test/spec/modules/ventesBidAdapter_spec.js
+++ b/test/spec/modules/ventesBidAdapter_spec.js
@@ -28,7 +28,8 @@ describe('Ventes Adapter', function () {
adUnitContext: {
refererInfo: {
- referer: 'https://ventesavenues.in',
+ page: 'https://ventesavenues.in',
+ domain: 'ventesavenues.in',
}
},
@@ -373,7 +374,7 @@ describe('Ventes Adapter', function () {
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
expect(serverRequests[0].data.site).to.exist.and.to.be.an('object');
- expect(serverRequests[0].data.site.page).to.exist.and.to.be.an('string').and.to.equal(adUnitContext.refererInfo.referer);
+ expect(serverRequests[0].data.site.page).to.exist.and.to.be.an('string').and.to.equal(adUnitContext.refererInfo.page);
expect(serverRequests[0].data.site.domain).to.exist.and.to.be.an('string').and.to.equal('ventesavenues.in');
expect(serverRequests[0].data.site.name).to.exist.and.to.be.an('string').and.to.equal('ventesavenues.in');
});
diff --git a/test/spec/modules/vidazooBidAdapter_spec.js b/test/spec/modules/vidazooBidAdapter_spec.js
index 13c73636dc7..9e61768264f 100644
--- a/test/spec/modules/vidazooBidAdapter_spec.js
+++ b/test/spec/modules/vidazooBidAdapter_spec.js
@@ -48,7 +48,7 @@ const BIDDER_REQUEST = {
},
'uspConsent': 'consent_string',
'refererInfo': {
- 'referer': 'https://www.greatsite.com'
+ 'page': 'https://www.greatsite.com'
}
};
@@ -137,12 +137,17 @@ describe('VidazooBidAdapter', function () {
describe('build requests', function () {
let sandbox;
before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ vidazoo: {
+ storageAllowed: true
+ }
+ };
sandbox = sinon.sandbox.create();
sandbox.stub(Date, 'now').returns(1000);
});
it('should build request for each size', function () {
- const hashUrl = hashCode(BIDDER_REQUEST.refererInfo.referer);
+ const hashUrl = hashCode(BIDDER_REQUEST.refererInfo.page);
const requests = adapter.buildRequests([BID], BIDDER_REQUEST);
expect(requests).to.have.length(1);
expect(requests[0]).to.deep.equal({
@@ -173,6 +178,7 @@ describe('VidazooBidAdapter', function () {
});
after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
sandbox.restore();
});
});
@@ -247,7 +253,6 @@ describe('VidazooBidAdapter', function () {
const userId = (function () {
switch (idSystemProvider) {
- case 'digitrustid': return { data: { id: id } };
case 'lipb': return { lipbid: id };
case 'parrableId': return { eid: id };
case 'id5id': return { uid: id };
@@ -287,6 +292,16 @@ describe('VidazooBidAdapter', function () {
});
describe('vidazoo session id', function () {
+ before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ vidazoo: {
+ storageAllowed: true
+ }
+ };
+ });
+ after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
it('should get undefined vidazoo session id', function () {
const sessionId = getVidazooSessionId();
expect(sessionId).to.be.empty;
@@ -301,6 +316,16 @@ describe('VidazooBidAdapter', function () {
});
describe('deal id', function () {
+ before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ vidazoo: {
+ storageAllowed: true
+ }
+ };
+ });
+ after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
const key = 'myDealKey';
it('should get the next deal id', function () {
@@ -320,6 +345,16 @@ describe('VidazooBidAdapter', function () {
});
describe('unique deal id', function () {
+ before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ vidazoo: {
+ storageAllowed: true
+ }
+ };
+ });
+ after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
const key = 'myKey';
let uniqueDealId;
beforeEach(() => {
@@ -345,6 +380,16 @@ describe('VidazooBidAdapter', function () {
});
describe('storage utils', function () {
+ before(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {
+ vidazoo: {
+ storageAllowed: true
+ }
+ };
+ });
+ after(function () {
+ $$PREBID_GLOBAL$$.bidderSettings = {};
+ });
it('should get value from storage with create param', function () {
const now = Date.now();
const clock = useFakeTimers({
diff --git a/test/spec/modules/vidoomyBidAdapter_spec.js b/test/spec/modules/vidoomyBidAdapter_spec.js
index 8aa127faef2..61b7f2fad7d 100644
--- a/test/spec/modules/vidoomyBidAdapter_spec.js
+++ b/test/spec/modules/vidoomyBidAdapter_spec.js
@@ -95,7 +95,8 @@ describe('vidoomyBidAdapter', function() {
refererInfo: {
numIframes: 0,
reachedTop: true,
- referer: 'http://example.com',
+ domain: 'example.com',
+ page: 'http://example.com',
stack: ['http://example.com']
}
};
diff --git a/test/spec/modules/visxBidAdapter_spec.js b/test/spec/modules/visxBidAdapter_spec.js
index 4aaaf996f58..b8a66e7c3b9 100755
--- a/test/spec/modules/visxBidAdapter_spec.js
+++ b/test/spec/modules/visxBidAdapter_spec.js
@@ -85,10 +85,10 @@ describe('VisxAdapter', function () {
const bidderRequest = {
timeout: 3000,
refererInfo: {
- referer: 'https://example.com'
+ page: 'https://example.com'
}
};
- const referrer = bidderRequest.refererInfo.referer;
+ const referrer = bidderRequest.refererInfo.page;
const schainObject = {
ver: '1.0',
nodes: [
@@ -425,10 +425,10 @@ describe('VisxAdapter', function () {
const bidderRequest = {
timeout: 3000,
refererInfo: {
- referer: 'https://example.com'
+ page: 'https://example.com'
}
};
- const referrer = bidderRequest.refererInfo.referer;
+ const referrer = bidderRequest.refererInfo.page;
const bidRequests = [
{
'bidder': 'visx',
@@ -489,10 +489,10 @@ describe('VisxAdapter', function () {
const bidderRequest = {
timeout: 3000,
refererInfo: {
- referer: 'https://example.com'
+ page: 'https://example.com'
}
};
- const referrer = bidderRequest.refererInfo.referer;
+ const referrer = bidderRequest.refererInfo.page;
const bidRequests = [
{
'bidder': 'visx',
diff --git a/test/spec/modules/voxBidAdapter_spec.js b/test/spec/modules/voxBidAdapter_spec.js
index 6906c7dbba4..923b0465e6c 100644
--- a/test/spec/modules/voxBidAdapter_spec.js
+++ b/test/spec/modules/voxBidAdapter_spec.js
@@ -15,7 +15,7 @@ function getSlotConfigs(mediaTypes, params) {
describe('VOX Adapter', function() {
const PLACE_ID = '5af45ad34d506ee7acad0c26';
const bidderRequest = {
- refererInfo: { referer: 'referer' }
+ refererInfo: { page: 'referer' }
}
const bannerMandatoryParams = {
placementId: PLACE_ID,
diff --git a/test/spec/modules/weboramaRtdProvider_spec.js b/test/spec/modules/weboramaRtdProvider_spec.js
index 4dff3db5c18..523406dc492 100644
--- a/test/spec/modules/weboramaRtdProvider_spec.js
+++ b/test/spec/modules/weboramaRtdProvider_spec.js
@@ -88,6 +88,10 @@ describe('weboramaRtdProvider', function() {
};
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -132,7 +136,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
inventory: data
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: data
@@ -195,6 +199,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -252,7 +260,7 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[2].params.keywords).to.deep.equal(data);
expect(adUnit.bids[3].params).to.be.undefined;
- expect(adUnit.bids[4].ortb2).to.be.undefined;
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
expect(onDataResponse).to.deep.equal({
@@ -304,6 +312,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -407,6 +419,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -511,7 +527,7 @@ describe('weboramaRtdProvider', function() {
}
});
- expect(adUnit.bids[4].ortb2).to.be.undefined;
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
});
});
@@ -545,6 +561,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -649,7 +669,7 @@ describe('weboramaRtdProvider', function() {
}
});
- expect(adUnit.bids[4].ortb2).to.be.undefined;
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
});
});
@@ -680,6 +700,9 @@ describe('weboramaRtdProvider', function() {
};
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -739,6 +762,10 @@ describe('weboramaRtdProvider', function() {
};
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -812,7 +839,7 @@ describe('weboramaRtdProvider', function() {
baz: 'bam',
}
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: data
@@ -845,6 +872,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -888,7 +919,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
inventory: defaultProfile
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: defaultProfile
@@ -941,6 +972,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -1003,7 +1038,7 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[3].params).to.deep.equal({
inventory: data
});
- expect(adUnit.bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: data
@@ -1062,6 +1097,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -1097,7 +1136,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
visitor: data
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
user: {
ext: {
data: data
@@ -1168,6 +1207,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -1216,8 +1259,8 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[2].params.keywords).to.deep.equal(data);
expect(adUnit.bids[3].params).to.be.undefined;
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
expect(onDataResponse).to.deep.equal({
data: data,
@@ -1276,6 +1319,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -1323,8 +1370,8 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[0].params).to.be.undefined;
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[3].params).to.be.undefined;
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(data);
expect(reqBidsConfigObj.adUnits[1].bids[2].params).to.be.undefined;
@@ -1379,6 +1426,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -1474,8 +1525,8 @@ describe('weboramaRtdProvider', function() {
baz: 'bam'
}
});
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
});
});
@@ -1517,6 +1568,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -1612,8 +1667,8 @@ describe('weboramaRtdProvider', function() {
baz: 'bam'
}
});
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
});
});
@@ -1712,6 +1767,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -1777,7 +1836,7 @@ describe('weboramaRtdProvider', function() {
webo_audiences: ['baz'],
}
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
user: {
ext: {
data: data
@@ -1804,6 +1863,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -1839,7 +1902,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
visitor: defaultProfile
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
user: {
ext: {
data: defaultProfile
@@ -1873,6 +1936,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {}
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -1908,7 +1975,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
visitor: defaultProfile
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
user: {
ext: {
data: defaultProfile
@@ -1970,6 +2037,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -2024,7 +2095,7 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[3].params).to.deep.equal({
visitor: data
});
- expect(adUnit.bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
user: {
ext: {
data: data
@@ -2082,6 +2153,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -2117,7 +2192,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
inventory: data,
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: data,
@@ -2187,6 +2262,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -2235,8 +2314,8 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[2].params.keywords).to.deep.equal(data);
expect(adUnit.bids[3].params).to.be.undefined;
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
expect(onDataResponse).to.deep.equal({
data: data,
@@ -2294,6 +2373,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -2341,8 +2424,8 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[0].params).to.be.undefined;
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[3].params).to.be.undefined;
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(data);
expect(reqBidsConfigObj.adUnits[1].bids[2].params).to.be.undefined;
@@ -2396,6 +2479,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -2491,8 +2578,8 @@ describe('weboramaRtdProvider', function() {
baz: 'bam'
}
});
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
});
});
@@ -2533,6 +2620,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -2628,8 +2719,8 @@ describe('weboramaRtdProvider', function() {
baz: 'bam'
}
});
- expect(adUnit.bids[4].ortb2).to.be.undefined;
});
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.be.undefined;
});
});
});
@@ -2667,6 +2758,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -2726,6 +2821,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -2791,7 +2890,7 @@ describe('weboramaRtdProvider', function() {
baz: 'bam',
}
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: data,
@@ -2817,6 +2916,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -2852,7 +2955,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
inventory: defaultProfile,
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: defaultProfile,
@@ -2885,6 +2988,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode = 'adunit1';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode,
bids: [{
@@ -2920,7 +3027,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
inventory: defaultProfile,
});
- expect(reqBidsConfigObj.adUnits[0].bids[4].ortb2).to.deep.equal({
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
site: {
ext: {
data: defaultProfile,
@@ -2981,6 +3088,10 @@ describe('weboramaRtdProvider', function() {
const adUnitCode1 = 'adunit1';
const adUnitCode2 = 'adunit2';
const reqBidsConfigObj = {
+ ortb2Fragments: {
+ global: {},
+ bidder: {},
+ },
adUnits: [{
code: adUnitCode1,
bids: [{
@@ -3035,13 +3146,13 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids[3].params).to.deep.equal({
inventory: data,
});
- expect(adUnit.bids[4].ortb2).to.deep.equal({
- site: {
- ext: {
- data: data,
- },
+ });
+ expect(reqBidsConfigObj.ortb2Fragments.bidder.other).to.deep.equal({
+ site: {
+ ext: {
+ data: data,
},
- });
+ },
});
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal({
diff --git a/test/spec/modules/winrBidAdapter_spec.js b/test/spec/modules/winrBidAdapter_spec.js
index 03e441df727..174f600fa06 100644
--- a/test/spec/modules/winrBidAdapter_spec.js
+++ b/test/spec/modules/winrBidAdapter_spec.js
@@ -434,7 +434,7 @@ describe('WinrAdapter', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
- referer: 'https://example.com/page.html',
+ topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
@@ -563,11 +563,7 @@ describe('WinrAdapter', function () {
uid2: { id: 'sample-uid2-value' },
criteoId: 'sample-criteo-userid',
netId: 'sample-netId-userid',
- idl_env: 'sample-idl-userid',
- flocId: {
- id: 'sample-flocid-value',
- version: 'chrome.1.0'
- }
+ idl_env: 'sample-idl-userid'
}
});
@@ -584,11 +580,6 @@ describe('WinrAdapter', function () {
id: 'sample-criteo-userid',
});
- expect(payload.eids).to.deep.include({
- source: 'chrome.com',
- id: 'sample-flocid-value'
- });
-
expect(payload.eids).to.deep.include({
source: 'netid.de',
id: 'sample-netId-userid',
diff --git a/test/spec/modules/yahoosspBidAdapter_spec.js b/test/spec/modules/yahoosspBidAdapter_spec.js
index e301218741c..4dce1358fae 100644
--- a/test/spec/modules/yahoosspBidAdapter_spec.js
+++ b/test/spec/modules/yahoosspBidAdapter_spec.js
@@ -16,7 +16,7 @@ const PREBID_VERSION = '$prebid.version$';
const INTEGRATION_METHOD = 'prebid.js';
// Utility functions
-const generateBidRequest = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode}) => {
+const generateBidRequest = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode, ortb2}) => {
const bidRequest = {
adUnitCode,
auctionId: 'b06c5141-fe8f-4cdf-9d7d-54415490a917',
@@ -30,7 +30,8 @@ const generateBidRequest = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObje
bidOverride: bidOverrideObject
},
src: 'client',
- transactionId: '5b17b67d-7704-4732-8cc9-5b1723e9bcf9'
+ transactionId: '5b17b67d-7704-4732-8cc9-5b1723e9bcf9',
+ ortb2
};
const bannerObj = {
@@ -71,7 +72,7 @@ const generateBidRequest = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObje
return bidRequest;
}
-let generateBidderRequest = (bidRequestArray, adUnitCode) => {
+let generateBidderRequest = (bidRequestArray, adUnitCode, ortb2 = {}) => {
const bidderRequest = {
adUnitCode: adUnitCode || 'default-adUnitCode',
auctionId: 'd4c83a3b-18e4-4208-b98b-63848449c7aa',
@@ -80,7 +81,7 @@ let generateBidderRequest = (bidRequestArray, adUnitCode) => {
bidderRequestId: '112f1c7c5d399a',
bids: bidRequestArray,
refererInfo: {
- referer: 'https://publisher-test.com',
+ page: 'https://publisher-test.com',
reachedTop: true,
isAmp: false,
numIframes: 0,
@@ -93,12 +94,13 @@ let generateBidderRequest = (bidRequestArray, adUnitCode) => {
},
start: new Date().getTime(),
timeout: 1000,
+ ortb2
};
return bidderRequest;
};
-const generateBuildRequestMock = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode}) => {
+const generateBuildRequestMock = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode, ortb2}) => {
const bidRequestConfig = {
bidId: bidId || DEFAULT_BID_ID,
pos: pos || DEFAULT_BID_POS,
@@ -106,11 +108,12 @@ const generateBuildRequestMock = ({bidId, pos, adUnitCode, adUnitType, bidOverri
adUnitType: adUnitType || DEFAULT_AD_UNIT_TYPE,
bidOverrideObject: bidOverrideObject || DEFAULT_PARAMS_BID_OVERRIDE,
videoContext: videoContext || DEFAULT_VIDEO_CONTEXT,
- pubIdMode: pubIdMode || false
+ pubIdMode: pubIdMode || false,
+ ortb2: ortb2 || {}
};
const bidRequest = generateBidRequest(bidRequestConfig);
const validBidRequests = [bidRequest];
- const bidderRequest = generateBidderRequest(validBidRequests, adUnitCode);
+ const bidderRequest = generateBidderRequest(validBidRequests, adUnitCode, ortb2);
return { bidRequest, validBidRequests, bidderRequest }
};
@@ -355,10 +358,9 @@ describe('YahooSSP Bid Adapter:', () => {
// Should not allow invalid "site" data types
const INVALID_ORTB2_TYPES = [ null, [], 123, 'unsupportedKeyName', true, false, undefined ];
INVALID_ORTB2_TYPES.forEach(param => {
- const ortb2 = { site: param }
- config.setConfig({ortb2});
it(`should not allow invalid site types to be added to bid-request: ${JSON.stringify(param)}`, () => {
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const ortb2 = { site: param }
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site[param]).to.be.undefined;
});
@@ -375,8 +377,7 @@ describe('YahooSSP Bid Adapter:', () => {
[param]: 'something'
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site[param]).to.exist;
expect(data.site[param]).to.be.a('string');
@@ -391,8 +392,7 @@ describe('YahooSSP Bid Adapter:', () => {
[param]: ['something']
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site[param]).to.exist;
expect(data.site[param]).to.be.a('array');
@@ -408,8 +408,7 @@ describe('YahooSSP Bid Adapter:', () => {
content: param
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content).to.be.undefined;
});
@@ -426,8 +425,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content).to.be.a('object');
});
@@ -443,8 +441,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content[param]).to.exist;
expect(data.site.content[param]).to.be.a('string');
@@ -462,8 +459,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content[param]).to.be.a('number');
expect(data.site.content[param]).to.be.equal(ortb2.site.content[param]);
@@ -480,8 +476,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content[param]).to.be.a('array');
expect(data.site.content[param]).to.be.equal(ortb2.site.content[param]);
@@ -498,8 +493,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.content[param]).to.be.a('object');
expect(data.site.content[param]).to.be.equal(ortb2.site.content[param]);
@@ -513,10 +507,9 @@ describe('YahooSSP Bid Adapter:', () => {
// Should not allow invalid "user" data types
const INVALID_ORTB2_TYPES = [ null, [], 'unsupportedKeyName', true, false, undefined ];
INVALID_ORTB2_TYPES.forEach(param => {
- const ortb2 = { user: param }
- config.setConfig({ortb2});
it(`should not allow invalid site types to be added to bid-request: ${JSON.stringify(param)}`, () => {
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const ortb2 = { user: param }
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user[param]).to.be.undefined;
});
@@ -531,8 +524,7 @@ describe('YahooSSP Bid Adapter:', () => {
[param]: 'something'
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user[param]).to.exist;
expect(data.user[param]).to.be.a('string');
@@ -548,8 +540,7 @@ describe('YahooSSP Bid Adapter:', () => {
[param]: 1982
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user[param]).to.exist;
expect(data.user[param]).to.be.a('number');
@@ -565,8 +556,7 @@ describe('YahooSSP Bid Adapter:', () => {
[param]: ['something']
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user[param]).to.exist;
expect(data.user[param]).to.be.a('array');
@@ -582,8 +572,7 @@ describe('YahooSSP Bid Adapter:', () => {
[param]: {a: '123', b: '456'}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user[param]).to.be.a('object');
expect(data.user[param]).to.be.deep.include({[param]: {a: '123', b: '456'}});
@@ -605,8 +594,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user.data[0][param]).to.exist;
expect(data.user.data[0][param]).to.be.a('string');
@@ -625,8 +613,7 @@ describe('YahooSSP Bid Adapter:', () => {
data: [{[param]: [{id: 1}]}]
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user.data[0][param]).to.exist;
expect(data.user.data[0][param]).to.be.a('array');
@@ -642,8 +629,7 @@ describe('YahooSSP Bid Adapter:', () => {
data: [{[param]: {id: 'ext'}}]
}
};
- config.setConfig({ortb2});
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user.data[0][param]).to.exist;
expect(data.user.data[0][param]).to.be.a('object');
@@ -823,6 +809,7 @@ describe('YahooSSP Bid Adapter:', () => {
describe('Request Headers validation:', () => {
it('should return request objects with the relevant custom headers and content type declaration', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
+ bidderRequest.gdprConsent.gdprApplies = false;
const options = spec.buildRequests(validBidRequests, bidderRequest).options;
expect(options).to.deep.equal(
{
@@ -841,7 +828,7 @@ describe('YahooSSP Bid Adapter:', () => {
const data = spec.buildRequests(validBidRequests, bidderRequest).data;
expect(data.site).to.deep.equal({
id: bidderRequest.bids[0].params.dcn,
- page: bidderRequest.refererInfo.referer
+ page: bidderRequest.refererInfo.page
});
expect(data.device).to.deep.equal({
diff --git a/test/spec/modules/yandexBidAdapter_spec.js b/test/spec/modules/yandexBidAdapter_spec.js
index 833f883fb7c..f4b15d6dbc4 100644
--- a/test/spec/modules/yandexBidAdapter_spec.js
+++ b/test/spec/modules/yandexBidAdapter_spec.js
@@ -56,8 +56,6 @@ describe('Yandex adapter', function () {
});
describe('buildRequests', function () {
- const refererUrl = 'https://yandex.ru/secure-ads';
-
const gdprConsent = {
gdprApplies: 1,
consentString: 'concent-string',
@@ -66,7 +64,7 @@ describe('Yandex adapter', function () {
const bidderRequest = {
refererInfo: {
- referer: refererUrl
+ domain: 'yandex.ru'
},
gdprConsent
};
diff --git a/test/spec/modules/yieldlabBidAdapter_spec.js b/test/spec/modules/yieldlabBidAdapter_spec.js
index e4d258ecdea..6ec1e995bfc 100644
--- a/test/spec/modules/yieldlabBidAdapter_spec.js
+++ b/test/spec/modules/yieldlabBidAdapter_spec.js
@@ -229,10 +229,8 @@ describe('yieldlabBidAdapter', function () {
'supplyId': '2222'
}
}
- config.setConfig(siteConfig);
- const request = spec.buildRequests([requestWithoutIabContent])
+ const request = spec.buildRequests([{...requestWithoutIabContent, ...siteConfig}])
expect(request.url).to.include('iab_content=id%3Aid_from_config')
- config.resetConfig();
})
const refererRequest = spec.buildRequests(bidRequests, {
@@ -240,7 +238,7 @@ describe('yieldlabBidAdapter', function () {
canonicalUrl: undefined,
numIframes: 0,
reachedTop: true,
- referer: 'https://www.yieldlab.de/test?with=querystring',
+ page: 'https://www.yieldlab.de/test?with=querystring',
stack: ['https://www.yieldlab.de/test?with=querystring']
}
})
diff --git a/test/spec/modules/yieldoneAnalyticsAdapter_spec.js b/test/spec/modules/yieldoneAnalyticsAdapter_spec.js
index 81a6365bba2..f77bc7bc7ba 100644
--- a/test/spec/modules/yieldoneAnalyticsAdapter_spec.js
+++ b/test/spec/modules/yieldoneAnalyticsAdapter_spec.js
@@ -46,7 +46,7 @@ describe('Yieldone Prebid Analytic', function () {
{
bidderCode: 'biddertest_1',
auctionId: auctionId,
- refererInfo: {referer: testReferrer},
+ refererInfo: {page: testReferrer},
bids: [
{
adUnitCode: '0000',
@@ -71,7 +71,7 @@ describe('Yieldone Prebid Analytic', function () {
{
bidderCode: 'biddertest_2',
auctionId: auctionId,
- refererInfo: {referer: testReferrer},
+ refererInfo: {page: testReferrer},
bids: [
{
adUnitCode: '0000',
@@ -87,7 +87,7 @@ describe('Yieldone Prebid Analytic', function () {
{
bidderCode: 'biddertest_3',
auctionId: auctionId,
- refererInfo: {referer: testReferrer},
+ refererInfo: {page: testReferrer},
bids: [
{
adUnitCode: '0000',
diff --git a/test/spec/modules/zetaBidAdapter_spec.js b/test/spec/modules/zetaBidAdapter_spec.js
index 25350725dee..529fb8e8d31 100644
--- a/test/spec/modules/zetaBidAdapter_spec.js
+++ b/test/spec/modules/zetaBidAdapter_spec.js
@@ -10,7 +10,7 @@ describe('Zeta Bid Adapter', function() {
}
},
refererInfo: {
- referer: 'testprebid.com'
+ page: 'testprebid.com'
},
params: {
placement: 12345,
diff --git a/test/spec/modules/zeta_global_sspBidAdapter_spec.js b/test/spec/modules/zeta_global_sspBidAdapter_spec.js
index d439da8e711..e67629cb4f7 100644
--- a/test/spec/modules/zeta_global_sspBidAdapter_spec.js
+++ b/test/spec/modules/zeta_global_sspBidAdapter_spec.js
@@ -53,7 +53,8 @@ describe('Zeta Ssp Bid Adapter', function () {
}
},
refererInfo: {
- referer: 'http://www.zetaglobal.com/page?param=value'
+ page: 'http://www.zetaglobal.com/page?param=value',
+ domain: 'www.zetaglobal.com',
},
gdprConsent: {
gdprApplies: 1,
@@ -108,7 +109,7 @@ describe('Zeta Ssp Bid Adapter', function () {
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
const payload = JSON.parse(request.data);
expect(payload.site.page).to.eql('http://www.zetaglobal.com/page?param=value');
- expect(payload.site.domain).to.eql(window.location.origin); // config.js -> DEFAULT_PUBLISHER_DOMAIN
+ expect(payload.site.domain).to.eql('zetaglobal.com');
});
it('Test the request processing function', function () {
diff --git a/test/spec/refererDetection_spec.js b/test/spec/refererDetection_spec.js
index a404e4f883e..3f33d1646a1 100644
--- a/test/spec/refererDetection_spec.js
+++ b/test/spec/refererDetection_spec.js
@@ -1,6 +1,6 @@
-import { detectReferer } from 'src/refererDetection.js';
-import { config } from 'src/config.js';
-import { expect } from 'chai';
+import {detectReferer, ensureProtocol, parseDomain} from 'src/refererDetection.js';
+import {config} from 'src/config.js';
+import {expect} from 'chai';
/**
* Build a walkable linked list of window-like objects for testing.
@@ -11,13 +11,13 @@ import { expect } from 'chai';
* @param {boolean} [ancestorOrigins]
* @returns {Object}
*/
-function buildWindowTree(urls, topReferrer = '', canonicalUrl = null, ancestorOrigins = false) {
+function buildWindowTree(urls, topReferrer = null, canonicalUrl = null, ancestorOrigins = false) {
/**
- * Find the origin from a given fully-qualified URL.
- *
- * @param {string} url The fully qualified URL
- * @returns {string|null}
- */
+ * Find the origin from a given fully-qualified URL.
+ *
+ * @param {string} url The fully qualified URL
+ * @returns {string|null}
+ */
function getOrigin(url) {
const originRegex = new RegExp('^(https?://[^/]+/?)');
@@ -30,83 +30,89 @@ function buildWindowTree(urls, topReferrer = '', canonicalUrl = null, ancestorOr
return null;
}
- let previousWindow;
- const myOrigin = getOrigin(urls[urls.length - 1]);
+ const inaccessibles = [];
- const windowList = urls.map((url, index) => {
- const theirOrigin = getOrigin(url),
- sameOrigin = (myOrigin === theirOrigin);
-
- const win = {};
-
- if (sameOrigin) {
- win.location = {
- href: url
- };
+ let previousWindow, topWindow;
+ const topOrigin = getOrigin(urls[0]);
- if (ancestorOrigins) {
- win.location.ancestorOrigins = urls.slice(0, index).reverse().map(getOrigin);
+ const windowList = urls.map((url, index) => {
+ const thisOrigin = getOrigin(url),
+ sameOriginAsPrevious = index === 0 ? true : (getOrigin(urls[index - 1]) === thisOrigin),
+ sameOriginAsTop = thisOrigin === topOrigin;
+
+ const win = {
+ location: {
+ href: url,
+ },
+ document: {
+ referrer: index === 0 ? topReferrer : urls[index - 1]
}
-
- if (index === 0) {
- win.document = {
- referrer: topReferrer
- };
-
- if (canonicalUrl) {
- win.document.querySelector = function(selector) {
- if (selector === "link[rel='canonical']") {
- return {
- href: canonicalUrl
- };
- }
-
- return null;
+ };
+
+ if (topWindow == null) {
+ topWindow = win;
+ win.document.querySelector = function (selector) {
+ if (selector === 'link[rel=\'canonical\']') {
+ return {
+ href: canonicalUrl
};
}
- } else {
- win.document = {
- referrer: urls[index - 1]
- };
- }
+ return null;
+ };
}
+ if (sameOriginAsPrevious) {
+ win.parent = previousWindow;
+ } else {
+ win.parent = inaccessibles[inaccessibles.length - 1];
+ }
+ if (ancestorOrigins) {
+ win.location.ancestorOrigins = urls.slice(0, index).reverse().map(getOrigin);
+ }
+ win.top = sameOriginAsTop ? topWindow : inaccessibles[0];
+
+ const inWin = {parent: inaccessibles[inaccessibles.length - 1], top: inaccessibles[0]};
+ if (index === 0) {
+ inWin.top = inWin;
+ }
+ ['document', 'location'].forEach((prop) => {
+ Object.defineProperty(inWin, prop, {
+ get: function () {
+ throw new Error('cross-origin access');
+ }
+ });
+ });
+ inaccessibles.push(inWin);
previousWindow = win;
return win;
});
- const topWindow = windowList[0];
-
- previousWindow = null;
-
- windowList.forEach((win) => {
- win.top = topWindow;
- win.parent = previousWindow || topWindow;
- previousWindow = win;
- });
-
return windowList[windowList.length - 1];
}
describe('Referer detection', () => {
+ afterEach(function () {
+ config.resetConfig();
+ });
+
describe('Non cross-origin scenarios', () => {
describe('No iframes', () => {
- afterEach(function () {
- config.resetConfig();
- });
-
it('Should return the current window location and no canonical URL', () => {
const testWindow = buildWindowTree(['https://example.com/some/page'], 'https://othersite.com/'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page',
+ location: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 0,
stack: ['https://example.com/some/page'],
- canonicalUrl: null
+ canonicalUrl: null,
+ page: 'https://example.com/some/page',
+ ref: 'https://othersite.com/',
+ domain: 'example.com',
});
});
@@ -114,13 +120,17 @@ describe('Referer detection', () => {
const testWindow = buildWindowTree(['https://example.com/some/page'], 'https://othersite.com/', 'https://example.com/canonical/page'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page',
+ location: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 0,
stack: ['https://example.com/some/page'],
- canonicalUrl: 'https://example.com/canonical/page'
+ canonicalUrl: 'https://example.com/canonical/page',
+ page: 'https://example.com/canonical/page',
+ ref: 'https://othersite.com/',
+ domain: 'example.com'
});
});
});
@@ -130,8 +140,9 @@ describe('Referer detection', () => {
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://example.com/other/page', 'https://example.com/third/page'], 'https://othersite.com/'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page',
+ location: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 2,
@@ -140,7 +151,10 @@ describe('Referer detection', () => {
'https://example.com/other/page',
'https://example.com/third/page'
],
- canonicalUrl: null
+ canonicalUrl: null,
+ page: 'https://example.com/some/page',
+ ref: 'https://othersite.com/',
+ domain: 'example.com'
});
});
@@ -148,8 +162,9 @@ describe('Referer detection', () => {
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://example.com/other/page', 'https://example.com/third/page'], 'https://othersite.com/', 'https://example.com/canonical/page'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page',
+ location: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 2,
@@ -158,18 +173,22 @@ describe('Referer detection', () => {
'https://example.com/other/page',
'https://example.com/third/page'
],
- canonicalUrl: 'https://example.com/canonical/page'
+ canonicalUrl: 'https://example.com/canonical/page',
+ page: 'https://example.com/canonical/page',
+ ref: 'https://othersite.com/',
+ domain: 'example.com'
});
});
- it('Should override canonical URL with config pageUrl', () => {
- config.setConfig({'pageUrl': 'testUrl.com'});
+ it('Should override canonical URL (and page) with config pageUrl', () => {
+ config.setConfig({'pageUrl': 'https://testurl.com'});
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://example.com/other/page', 'https://example.com/third/page'], 'https://othersite.com/', 'https://example.com/canonical/page'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page',
+ location: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 2,
@@ -178,7 +197,10 @@ describe('Referer detection', () => {
'https://example.com/other/page',
'https://example.com/third/page'
],
- canonicalUrl: 'testUrl.com'
+ canonicalUrl: 'https://testurl.com',
+ page: 'https://testurl.com',
+ ref: 'https://othersite.com/',
+ domain: 'testurl.com'
});
});
});
@@ -189,8 +211,9 @@ describe('Referer detection', () => {
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://safe.frame/ad'], 'https://othersite.com/', 'https://canonical.example.com/'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ location: 'https://example.com/some/page',
+ topmostLocation: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 1,
@@ -198,7 +221,10 @@ describe('Referer detection', () => {
'https://example.com/some/page',
'https://safe.frame/ad'
],
- canonicalUrl: null
+ canonicalUrl: null,
+ page: 'https://example.com/some/page',
+ ref: null,
+ domain: 'example.com'
});
});
@@ -206,8 +232,9 @@ describe('Referer detection', () => {
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://safe.frame/ad', 'https://safe.frame/ad'], 'https://othersite.com/', 'https://canonical.example.com/'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page',
+ location: 'https://example.com/some/page',
reachedTop: true,
isAmp: false,
numIframes: 2,
@@ -216,16 +243,20 @@ describe('Referer detection', () => {
'https://safe.frame/ad',
'https://safe.frame/ad'
],
- canonicalUrl: null
+ canonicalUrl: null,
+ page: 'https://example.com/some/page',
+ ref: null,
+ domain: 'example.com',
});
});
- it('Should return the second iframe location with three cross-origin windows and no ancessorOrigins', () => {
+ it('Should return the second iframe location with three cross-origin windows and no ancestorOrigins', () => {
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://safe.frame/ad', 'https://otherfr.ame/ad'], 'https://othersite.com/', 'https://canonical.example.com/'),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://safe.frame/ad',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://safe.frame/ad',
+ location: null,
reachedTop: false,
isAmp: false,
numIframes: 2,
@@ -234,16 +265,20 @@ describe('Referer detection', () => {
'https://safe.frame/ad',
'https://otherfr.ame/ad'
],
- canonicalUrl: null
+ canonicalUrl: null,
+ page: null,
+ ref: null,
+ domain: null
});
});
- it('Should return the top window origin with three cross-origin windows with ancessorOrigins', () => {
+ it('Should return the top window origin with three cross-origin windows with ancestorOrigins', () => {
const testWindow = buildWindowTree(['https://example.com/some/page', 'https://safe.frame/ad', 'https://otherfr.ame/ad'], 'https://othersite.com/', 'https://canonical.example.com/', true),
result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/',
+ location: 'https://example.com/',
reachedTop: false,
isAmp: false,
numIframes: 2,
@@ -252,7 +287,10 @@ describe('Referer detection', () => {
'https://safe.frame/ad',
'https://otherfr.ame/ad'
],
- canonicalUrl: null
+ canonicalUrl: null,
+ page: 'https://example.com/',
+ ref: null,
+ domain: 'example.com'
});
});
});
@@ -268,8 +306,9 @@ describe('Referer detection', () => {
const result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page/amp/',
+ sinon.assert.match(result, {
+ location: 'https://example.com/some/page/amp/',
+ topmostLocation: 'https://example.com/some/page/amp/',
reachedTop: true,
isAmp: true,
numIframes: 1,
@@ -277,7 +316,10 @@ describe('Referer detection', () => {
'https://example.com/some/page/amp/',
'https://ad-iframe.ampproject.org/ad'
],
- canonicalUrl: 'https://example.com/some/page/'
+ canonicalUrl: 'https://example.com/some/page/',
+ page: 'https://example.com/some/page/',
+ ref: null,
+ domain: 'example.com'
});
});
@@ -291,8 +333,9 @@ describe('Referer detection', () => {
const result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page/amp/',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page/amp/',
+ location: 'https://example.com/some/page/amp/',
reachedTop: true,
isAmp: true,
numIframes: 1,
@@ -300,10 +343,24 @@ describe('Referer detection', () => {
'https://example.com/some/page/amp/',
'https://ad-iframe.ampproject.org/ad'
],
- canonicalUrl: 'https://example.com/some/page/'
+ canonicalUrl: 'https://example.com/some/page/',
+ page: 'https://example.com/some/page/',
+ ref: null,
+ domain: 'example.com'
});
});
+ it('should respect pageUrl as the primary source of canonicalUrl', () => {
+ config.setConfig({
+ pageUrl: 'pub-defined'
+ });
+ const w = buildWindowTree(['https://example.com', 'https://amp.com']);
+ w.context = {
+ canonicalUrl: 'should-be-overridden'
+ };
+ expect(detectReferer(w)().canonicalUrl).to.equal('pub-defined');
+ });
+
describe('Cached AMP page in iframed search result', () => {
it('Should return the AMP source and canonical URLs but with a null top-level stack location Without ancesorOrigins', () => {
const testWindow = buildWindowTree(['https://google.com/amp/example-com/some/page/amp/', 'https://example-com.amp-cache.example.com/some/page/amp/', 'https://ad-iframe.ampproject.org/ad']);
@@ -315,8 +372,9 @@ describe('Referer detection', () => {
const result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page/amp/',
+ sinon.assert.match(result, {
+ topmostLocation: 'https://example.com/some/page/amp/',
+ location: 'https://example.com/some/page/amp/',
reachedTop: false,
isAmp: true,
numIframes: 2,
@@ -325,7 +383,10 @@ describe('Referer detection', () => {
'https://example.com/some/page/amp/',
'https://ad-iframe.ampproject.org/ad'
],
- canonicalUrl: 'https://example.com/some/page/'
+ canonicalUrl: 'https://example.com/some/page/',
+ page: 'https://example.com/some/page/',
+ ref: null,
+ domain: 'example.com',
});
});
@@ -339,8 +400,9 @@ describe('Referer detection', () => {
const result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page/amp/',
+ sinon.assert.match(result, {
+ location: 'https://example.com/some/page/amp/',
+ topmostLocation: 'https://example.com/some/page/amp/',
reachedTop: false,
isAmp: true,
numIframes: 2,
@@ -349,7 +411,10 @@ describe('Referer detection', () => {
'https://example.com/some/page/amp/',
'https://ad-iframe.ampproject.org/ad'
],
- canonicalUrl: 'https://example.com/some/page/'
+ canonicalUrl: 'https://example.com/some/page/',
+ page: 'https://example.com/some/page/',
+ ref: null,
+ domain: 'example.com'
});
});
@@ -363,8 +428,9 @@ describe('Referer detection', () => {
const result = detectReferer(testWindow)();
- expect(result).to.deep.equal({
- referer: 'https://example.com/some/page/amp/',
+ sinon.assert.match(result, {
+ location: 'https://example.com/some/page/amp/',
+ topmostLocation: 'https://example.com/some/page/amp/',
reachedTop: false,
isAmp: true,
numIframes: 3,
@@ -374,9 +440,105 @@ describe('Referer detection', () => {
'https://ad-iframe.ampproject.org/ad',
'https://ad-iframe.ampproject.org/ad'
],
- canonicalUrl: 'https://example.com/some/page/'
+ canonicalUrl: 'https://example.com/some/page/',
+ page: 'https://example.com/some/page/',
+ ref: null,
+ domain: 'example.com',
});
});
});
});
});
+
+describe('ensureProtocol', () => {
+ ['', null, undefined].forEach((val) => {
+ it(`should return unchanged invalid input: ${val}`, () => {
+ expect(ensureProtocol(val)).to.eql(val);
+ });
+ });
+
+ ['http:', 'https:'].forEach((protocol) => {
+ Object.entries({
+ 'window.top.location.protocol': {
+ top: {
+ location: {
+ protocol
+ }
+ },
+ location: {
+ protocol: 'unused'
+ }
+ },
+ 'window.location.protocol': (() => {
+ const w = {
+ top: {},
+ location: {
+ protocol
+ }
+ };
+ Object.defineProperty(w.top, 'location', {
+ get: function () {
+ throw new Error('cross-origin');
+ }
+ });
+ return w;
+ })(),
+ }).forEach(([t, win]) => {
+ describe(`when ${t} declares ${protocol}`, () => {
+ Object.entries({
+ 'declared': {
+ url: 'proto://example.com/page',
+ expect: 'proto://example.com/page'
+ },
+ 'relative': {
+ url: '//example.com/page',
+ expect: `${protocol}//example.com/page`
+ },
+ 'missing': {
+ url: 'example.com/page',
+ expect: `${protocol}//example.com/page`
+ }
+ }).forEach(([t, {url, expect: expected}]) => {
+ it(`should handle URLs with ${t} protocols`, () => {
+ expect(ensureProtocol(url, win)).to.equal(expected);
+ });
+ });
+ });
+ });
+ });
+});
+
+describe('parseDomain', () => {
+ Object.entries({
+ 'www.example.com': 'www.example.com',
+ 'example.com:443': 'example.com:443',
+ 'www.sub.example.com': 'www.sub.example.com',
+ 'example.com/page': 'example.com',
+ 'www.example.com:443/page': 'www.example.com:443',
+ 'http://www.example.com:443/page?query=value': 'www.example.com:443',
+ '': undefined,
+ }).forEach(([input, expected]) => {
+ it(`should extract domain from '${input}' -> '${expected}`, () => {
+ expect(parseDomain(input)).to.equal(expected);
+ });
+ });
+ Object.entries({
+ 'www.example.com': 'example.com',
+ 'https://www.sub.example.com': 'sub.example.com',
+ '//www.example.com:443': 'example.com:443',
+ 'without.www.example.com': 'without.www.example.com'
+ }).forEach(([input, expected]) => {
+ it('should remove leading www if requested', () => {
+ expect(parseDomain(input, {noLeadingWww: true})).to.equal(expected);
+ })
+ });
+ Object.entries({
+ 'example.com:443': 'example.com',
+ 'https://sub.example.com': 'sub.example.com',
+ 'http://sub.example.com:8443': 'sub.example.com'
+ }).forEach(([input, expected]) => {
+ it('should remove port if requested', () => {
+ expect(parseDomain(input, {noPort: true})).to.equal(expected);
+ })
+ })
+});
diff --git a/test/spec/unit/core/adapterManager_spec.js b/test/spec/unit/core/adapterManager_spec.js
index 88beaa88a67..dcbc098305c 100644
--- a/test/spec/unit/core/adapterManager_spec.js
+++ b/test/spec/unit/core/adapterManager_spec.js
@@ -1711,6 +1711,83 @@ describe('adapterManager tests', function () {
expect(sizes1).not.to.deep.equal(sizes2);
});
+ it('should make FPD available under `ortb2`', () => {
+ const global = {
+ k1: 'v1',
+ k2: {
+ k3: 'v3',
+ k4: 'v4'
+ }
+ };
+ const bidder = {
+ 'appnexus': {
+ ka: 'va',
+ k2: {
+ k3: 'override',
+ k5: 'v5'
+ }
+ }
+ };
+ const requests = Object.fromEntries(
+ adapterManager.makeBidRequests(adUnits, 123, 'auction-id', 123, [], {global, bidder})
+ .map((r) => [r.bidderCode, r])
+ );
+ sinon.assert.match(requests, {
+ rubicon: {
+ ortb2: global
+ },
+ appnexus: {
+ ortb2: {
+ k1: 'v1',
+ ka: 'va',
+ k2: {
+ k3: 'override',
+ k4: 'v4',
+ k5: 'v5',
+ }
+ }
+ }
+ });
+ requests.rubicon.bids.forEach((bid) => expect(bid.ortb2).to.eql(requests.rubicon.ortb2));
+ requests.appnexus.bids.forEach((bid) => expect(bid.ortb2).to.eql(requests.appnexus.ortb2));
+ });
+
+ describe('when calling the s2s adapter', () => {
+ beforeEach(() => {
+ config.setConfig({
+ s2sConfig: {
+ enabled: true,
+ adapter: 'mockS2S',
+ bidders: ['appnexus']
+ }
+ })
+ adapterManager.bidderRegistry.mockS2S = {
+ callBids: sinon.stub()
+ };
+ });
+ afterEach(() => {
+ config.resetConfig();
+ delete adapterManager.bidderRegistry.mockS2S;
+ })
+
+ it('should pass FPD', () => {
+ const ortb2Fragments = {};
+ const req = {
+ bidderCode: 'appnexus',
+ src: CONSTANTS.S2S.SRC,
+ adUnitsS2SCopy: adUnits,
+ bids: [{
+ bidder: 'appnexus',
+ src: CONSTANTS.S2S.SRC
+ }]
+ };
+ adapterManager.callBids(adUnits, [req], sinon.stub(), sinon.stub(), {request: sinon.stub(), done: sinon.stub()}, 1000, sinon.stub(), ortb2Fragments);
+ sinon.assert.calledWith(adapterManager.bidderRegistry.mockS2S.callBids, sinon.match({
+ ortb2Fragments: sinon.match.same(ortb2Fragments)
+ }));
+ });
+ })
+
describe('setBidderSequence', function () {
beforeEach(function () {
sinon.spy(utils, 'shuffle');
diff --git a/test/spec/unit/core/bidderFactory_spec.js b/test/spec/unit/core/bidderFactory_spec.js
index 20a545a51d4..a1acbb56de9 100644
--- a/test/spec/unit/core/bidderFactory_spec.js
+++ b/test/spec/unit/core/bidderFactory_spec.js
@@ -1073,16 +1073,14 @@ describe('validate bid response: ', function () {
expect(logWarnSpy.callCount).to.equal(1);
});
- it('should accept the bid, when allowAlternateBidderCodes flag is undefined (default should be true)', function () {
+ it('should reject the bid, when allowAlternateBidderCodes flag is undefined (default should be false)', function () {
bidderSettingStub.returns(undefined);
const bidder = newBidder(spec);
spec.interpretResponse.returns(bids1);
bidder.callBids(bidRequest, addBidResponseStub, doneStub, ajaxStub, onTimelyResponseStub, wrappedCallback);
- expect(addBidResponseStub.calledOnce).to.equal(true);
- expect(logWarnSpy.callCount).to.equal(0);
- expect(logErrorSpy.callCount).to.equal(0);
+ expect(addBidResponseStub.calledOnce).to.equal(false);
});
it('should log warning when the particular bidder is not specified in allowedAlternateBidderCodes and allowAlternateBidderCodes flag is true', function () {
diff --git a/test/spec/unit/core/storageManager_spec.js b/test/spec/unit/core/storageManager_spec.js
index 74a3b3b023f..dacde5491b7 100644
--- a/test/spec/unit/core/storageManager_spec.js
+++ b/test/spec/unit/core/storageManager_spec.js
@@ -108,8 +108,8 @@ describe('storage manager', function() {
});
describe('when bidderSettings.allowStorage is defined', () => {
- const DENIED_BIDDER = 'denied-bidder';
- const DENY_KEY = 'storageAllowed';
+ const ALLOWED_BIDDER = 'allowed-bidder';
+ const ALLOW_KEY = 'storageAllowed';
const COOKIE = 'test-cookie';
const LS_KEY = 'test-localstorage';
@@ -117,8 +117,8 @@ describe('storage manager', function() {
function mockBidderSettings() {
return {
get(bidder, key) {
- if (bidder === DENIED_BIDDER && key === DENY_KEY) {
- return false;
+ if (bidder === ALLOWED_BIDDER && key === ALLOW_KEY) {
+ return true;
} else {
return undefined;
}
@@ -127,8 +127,8 @@ describe('storage manager', function() {
}
Object.entries({
- disallowed: [DENIED_BIDDER, false],
- allowed: ['allowed-bidder', true]
+ disallowed: ['denied_bidder', false],
+ allowed: [ALLOWED_BIDDER, true]
}).forEach(([test, [bidderCode, shouldWork]]) => {
describe(`for ${test} bidders`, () => {
let mgr;
diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js
index 6a7c79fe49d..4ec4f3b841c 100644
--- a/test/spec/unit/pbjs_api_spec.js
+++ b/test/spec/unit/pbjs_api_spec.js
@@ -17,8 +17,9 @@ import { registerBidder } from 'src/adapters/bidderFactory.js';
import { _sendAdToCreative } from 'src/secureCreatives.js';
import {find} from 'src/polyfill.js';
import {synchronizePromise} from '../../helpers/syncPromise.js';
-import 'src/prebid.js';
+import * as pbjsModule from 'src/prebid.js';
import {hook} from '../../../src/hook.js';
+import $$PREBID_GLOBAL$$ from 'src/prebid.js';
var assert = require('chai').assert;
var expect = require('chai').expect;
@@ -33,7 +34,6 @@ require('modules/appnexusBidAdapter');
var config = require('test/fixtures/config.json');
-$$PREBID_GLOBAL$$ = $$PREBID_GLOBAL$$ || {};
var adUnits = getAdUnits();
var adUnitCodes = getAdUnits().map(unit => unit.code);
var bidsBackHandler = function() {};
@@ -1605,8 +1605,124 @@ describe('Unit: Prebid Module', function () {
assert.ok(spyExecuteCallback.calledOnce, 'callback executed when bidRequests is empty');
});
});
+
+ describe('starts auction', () => {
+ let startAuctionStub;
+ function saHook(fn, ...args) {
+ return startAuctionStub(...args);
+ }
+ beforeEach(() => {
+ startAuctionStub = sinon.stub();
+ pbjsModule.startAuction.before(saHook);
+ configObj.resetConfig();
+ });
+ afterEach(() => {
+ pbjsModule.startAuction.getHooks({hook: saHook}).remove();
+ })
+ after(() => {
+ configObj.resetConfig();
+ });
+
+ it('passing global and auction-level FPD as ortb2Fragments.global', () => {
+ configObj.setConfig({
+ ortb2: {
+ 'k1': 'v1',
+ 'k2': {
+ 'k3': 'v3',
+ 'k4': 'v4'
+ }
+ }
+ });
+ $$PREBID_GLOBAL$$.requestBids({
+ ortb2: {
+ 'k5': 'v5',
+ 'k2': {
+ 'k3': 'override',
+ 'k7': 'v7'
+ }
+ }
+ });
+ sinon.assert.calledWith(startAuctionStub, sinon.match({
+ ortb2Fragments: {
+ global: {
+ 'k1': 'v1',
+ 'k5': 'v5',
+ 'k2': {
+ 'k3': 'override',
+ 'k4': 'v4',
+ 'k7': 'v7'
+ }
+ }
+ }
+ }))
+ });
+ it('passing bidder-specific FPD as ortb2Fragments.bidder', () => {
+ configObj.setBidderConfig({
+ bidders: ['bidderA', 'bidderC'],
+ config: {
+ ortb2: {
+ k1: 'v1'
+ }
+ }
+ });
+ configObj.setBidderConfig({
+ bidders: ['bidderB'],
+ config: {
+ ortb2: {
+ k2: 'v2'
+ }
+ }
+ });
+ $$PREBID_GLOBAL$$.requestBids({});
+ sinon.assert.calledWith(startAuctionStub, sinon.match({
+ ortb2Fragments: {
+ bidder: {
+ bidderA: {
+ k1: 'v1'
+ },
+ bidderB: {
+ k2: 'v2'
+ },
+ bidderC: {
+ k1: 'v1'
+ }
+ }
+ }
+ }));
+ });
+ });
});
+ describe('startAuction', () => {
+ let sandbox, newAuctionStub;
+ beforeEach(() => {
+ sandbox = sinon.createSandbox();
+ newAuctionStub = sandbox.stub(auctionManager, 'createAuction').callsFake(() => ({
+ getAuctionId: () => 'mockAuctionId',
+ callBids: sinon.stub()
+ }));
+ });
+
+ afterEach(() => {
+ sandbox.restore();
+ });
+
+ it('passes ortb2 fragments to createAuction', () => {
+ const ortb2Fragments = {};
+ pbjsModule.startAuction({
+ adUnits: [{
+ code: 'au',
+ mediaTypes: {banner: {sizes: [[300, 250]]}},
+ bids: [{bidder: 'bd'}]
+ }],
+ ortb2Fragments
+ });
+ sinon.assert.calledWith(newAuctionStub, sinon.match({
+ ortb2Fragments: sinon.match.same(ortb2Fragments)
+ }));
+ });
+ })
+
describe('requestBids', function () {
var adUnitsBackup;
var auctionManagerStub;
diff --git a/test/spec/videoCache_spec.js b/test/spec/videoCache_spec.js
index 34e9bed04b6..fdb4103baed 100644
--- a/test/spec/videoCache_spec.js
+++ b/test/spec/videoCache_spec.js
@@ -29,8 +29,7 @@ function getMockBid(bidder, auctionId, bidderRequestId) {
'sizes': [300, 250],
'bidId': '123',
'bidderRequestId': bidderRequestId,
- 'auctionId': auctionId,
- 'storedAuctionResponse': 11111
+ 'auctionId': auctionId
};
}
diff --git a/webpack.conf.js b/webpack.conf.js
index 5269f5300f5..9d85505d96e 100644
--- a/webpack.conf.js
+++ b/webpack.conf.js
@@ -1,3 +1,4 @@
+const TerserPlugin = require('terser-webpack-plugin');
var prebid = require('./package.json');
var path = require('path');
var webpack = require('webpack');
@@ -71,6 +72,14 @@ module.exports = {
optimization: {
usedExports: true,
sideEffects: true,
+ minimizer: [
+ new TerserPlugin({
+ extractComments: false, // do not generate unhelpful LICENSE comment
+ terserOptions: {
+ module: true, // do not prepend every module with 'use strict'; allow mangling of top-level locals
+ }
+ })
+ ]
},
plugins
};