prebid.js 7.3.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +11 -6
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adnuntiusBidAdapter.js +1 -1
- package/dist/adotBidAdapter.js +1 -1
- package/dist/adpod.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adrinoBidAdapter.js +1 -1
- package/dist/adtelligentBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/atsAnalyticsAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/byDataAnalyticsAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/debugging-standalone.js +1 -1
- package/dist/debugging.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hadronIdSystem.js +1 -1
- package/dist/hadronRtdProvider.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imRtdProvider.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoAnalyticsAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/missenaBidAdapter.js +1 -1
- package/dist/newspassidBidAdapter.js +1 -0
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +131 -127
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxOrtbBidAdapter.js +1 -0
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +2 -2
- package/dist/priceFloors.js +1 -1
- package/dist/pubCommonId.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/rasBidAdapter.js +1 -0
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharedIdSystem.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -0
- package/dist/sizeMappingV2.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/ventesBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vrtcalBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/gulpfile.js +1 -1
- package/karma.conf.maker.js +3 -1
- package/modules/adgenerationBidAdapter.js +24 -1
- package/modules/adnuntiusBidAdapter.js +26 -8
- package/modules/adotBidAdapter.js +13 -4
- package/modules/adrinoBidAdapter.js +10 -2
- package/modules/adrinoBidAdapter.md +6 -0
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/appnexusBidAdapter.js +3 -3
- package/modules/atsAnalyticsAdapter.js +4 -5
- package/modules/byDataAnalyticsAdapter.js +172 -74
- package/modules/byDataAnalyticsAdapter.md +5 -6
- package/modules/consumableBidAdapter.js +12 -1
- package/modules/criteoBidAdapter.js +7 -1
- package/modules/cwireBidAdapter.md +1 -1
- package/modules/debugging/bidInterceptor.js +1 -1
- package/modules/debugging/index.js +2 -1
- package/modules/eplanningBidAdapter.js +82 -97
- package/modules/gdprEnforcement.js +8 -14
- package/modules/gridNMBidAdapter.js +45 -4
- package/modules/hadronAnalyticsAdapter.md +5 -5
- package/modules/hadronIdSystem.js +18 -5
- package/modules/hadronIdSystem.md +15 -11
- package/modules/hadronRtdProvider.js +14 -1
- package/modules/hadronRtdProvider.md +17 -13
- package/modules/imRtdProvider.js +0 -8
- package/modules/insticatorBidAdapter.js +9 -0
- package/modules/ixBidAdapter.js +462 -58
- package/modules/ixBidAdapter.md +95 -5
- package/modules/kargoAnalyticsAdapter.js +88 -6
- package/modules/kargoAnalyticsAdapter.md +33 -0
- package/modules/kargoBidAdapter.js +1 -2
- package/modules/minutemediaBidAdapter.js +1 -0
- package/modules/missenaBidAdapter.js +20 -2
- package/modules/newspassidBidAdapter.js +649 -0
- package/modules/nextMillenniumBidAdapter.js +17 -1
- package/modules/oguryBidAdapter.js +2 -0
- package/modules/openxBidAdapter.md +3 -1
- package/modules/openxOrtbBidAdapter.js +349 -0
- package/modules/openxOrtbBidAdapter.md +105 -0
- package/modules/priceFloors.js +1 -1
- package/modules/pubCommonId.js +1 -2
- package/modules/pubxaiAnalyticsAdapter.js +6 -1
- package/modules/rasBidAdapter.js +149 -0
- package/modules/rasBidAdapter.md +50 -0
- package/modules/readpeakBidAdapter.js +15 -6
- package/modules/relaidoBidAdapter.js +19 -4
- package/modules/seedtagBidAdapter.js +37 -1
- package/modules/sharedIdSystem.js +11 -5
- package/modules/sharethroughBidAdapter.js +9 -24
- package/modules/shinezBidAdapter.js +435 -0
- package/modules/shinezBidAdapter.md +76 -0
- package/modules/taboolaBidAdapter.js +1 -1
- package/modules/taboolaBidAdapter.md +3 -3
- package/modules/ventesBidAdapter.js +1 -1
- package/modules/ventesBidAdapter.md +1 -1
- package/modules/vrtcalBidAdapter.js +35 -0
- package/package.json +1 -1
- package/plugins/pbjsGlobals.js +2 -1
- package/src/storageManager.js +4 -5
- package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -4
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +126 -14
- package/test/spec/modules/adotBidAdapter_spec.js +12 -9
- package/test/spec/modules/adrinoBidAdapter_spec.js +22 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
- package/test/spec/modules/byDataAnalyticsAdapter_spec.js +74 -24
- package/test/spec/modules/consumableBidAdapter_spec.js +75 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
- package/test/spec/modules/debugging_mod_spec.js +7 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +58 -18
- package/test/spec/modules/gdprEnforcement_spec.js +53 -100
- package/test/spec/modules/gridNMBidAdapter_spec.js +32 -0
- package/test/spec/modules/hadronIdSystem_spec.js +2 -2
- package/test/spec/modules/imRtdProvider_spec.js +0 -1
- package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
- package/test/spec/modules/ixBidAdapter_spec.js +470 -10
- package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
- package/test/spec/modules/minutemediaBidAdapter_spec.js +3 -0
- package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
- package/test/spec/modules/newspassidBidAdapter_spec.js +1793 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +20 -0
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +5 -0
- package/test/spec/modules/rasBidAdapter_spec.js +190 -0
- package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
- package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
- package/test/spec/modules/seedtagBidAdapter_spec.js +29 -0
- package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
- package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
- package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
- package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
- package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
- package/webpack.conf.js +1 -1
|
@@ -6,6 +6,7 @@ import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
|
6
6
|
import { ajax } from '../src/ajax.js'
|
|
7
7
|
|
|
8
8
|
const BIDDER_CODE = 'ogury';
|
|
9
|
+
const GVLID = 31;
|
|
9
10
|
const DEFAULT_TIMEOUT = 1000;
|
|
10
11
|
const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
|
|
11
12
|
const TIMEOUT_MONITORING_HOST = 'https://ms-ads-monitoring-events.presage.io';
|
|
@@ -198,6 +199,7 @@ function onTimeout(timeoutData) {
|
|
|
198
199
|
|
|
199
200
|
export const spec = {
|
|
200
201
|
code: BIDDER_CODE,
|
|
202
|
+
gvlid: GVLID,
|
|
201
203
|
supportedMediaTypes: [BANNER],
|
|
202
204
|
isBidRequestValid,
|
|
203
205
|
getUserSyncs,
|
|
@@ -8,7 +8,9 @@ Maintainer: team-openx@openx.com
|
|
|
8
8
|
|
|
9
9
|
# Description
|
|
10
10
|
|
|
11
|
-
Module that connects to OpenX's demand sources
|
|
11
|
+
Module that connects to OpenX's demand sources.
|
|
12
|
+
Note there is an updated version of the OpenX bid adapter called openxOrtbBidAdapter.
|
|
13
|
+
Publishers are welcome to test the other adapter and give feedback. Please note you should only include either openxBidAdapter or openxOrtbBidAdapter in your build.
|
|
12
14
|
|
|
13
15
|
# Bid Parameters
|
|
14
16
|
## Banner
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import {config} from '../src/config.js';
|
|
2
|
+
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
3
|
+
import * as utils from '../src/utils.js';
|
|
4
|
+
import {BANNER, VIDEO} from '../src/mediaTypes.js';
|
|
5
|
+
import {includes} from '../src/polyfill.js';
|
|
6
|
+
|
|
7
|
+
const bidderConfig = 'hb_pb_ortb';
|
|
8
|
+
const bidderVersion = '1.0';
|
|
9
|
+
const VIDEO_TARGETING = ['startdelay', 'mimes', 'minduration', 'maxduration', 'delivery',
|
|
10
|
+
'startdelay', 'skip', 'playbackmethod', 'api', 'protocol', 'boxingallowed', 'maxextended',
|
|
11
|
+
'linearity', 'delivery', 'protocols', 'placement', 'minbitrate', 'maxbitrate', 'battr', 'ext'];
|
|
12
|
+
export const REQUEST_URL = 'https://rtb.openx.net/openrtbb/prebidjs';
|
|
13
|
+
export const SYNC_URL = 'https://u.openx.net/w/1.0/pd';
|
|
14
|
+
export const DEFAULT_PH = '2d1251ae-7f3a-47cf-bd2a-2f288854a0ba';
|
|
15
|
+
export const spec = {
|
|
16
|
+
code: 'openx',
|
|
17
|
+
supportedMediaTypes: [BANNER, VIDEO],
|
|
18
|
+
isBidRequestValid,
|
|
19
|
+
buildRequests,
|
|
20
|
+
interpretResponse,
|
|
21
|
+
getUserSyncs,
|
|
22
|
+
transformBidParams
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
registerBidder(spec);
|
|
26
|
+
|
|
27
|
+
function transformBidParams(params, isOpenRtb) {
|
|
28
|
+
return utils.convertTypes({
|
|
29
|
+
'unit': 'string',
|
|
30
|
+
'customFloor': 'number'
|
|
31
|
+
}, params);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isBidRequestValid(bidRequest) {
|
|
35
|
+
const hasDelDomainOrPlatform = bidRequest.params.delDomain ||
|
|
36
|
+
bidRequest.params.platform;
|
|
37
|
+
|
|
38
|
+
if (utils.deepAccess(bidRequest, 'mediaTypes.banner') &&
|
|
39
|
+
hasDelDomainOrPlatform) {
|
|
40
|
+
return !!bidRequest.params.unit ||
|
|
41
|
+
utils.deepAccess(bidRequest, 'mediaTypes.banner.sizes.length') > 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return !!(bidRequest.params.unit && hasDelDomainOrPlatform);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function buildRequests(bids, bidderRequest) {
|
|
48
|
+
let videoBids = bids.filter(bid => isVideoBid(bid));
|
|
49
|
+
let bannerBids = bids.filter(bid => isBannerBid(bid));
|
|
50
|
+
let requests = bannerBids.length ? [createBannerRequest(bannerBids, bidderRequest)] : [];
|
|
51
|
+
videoBids.forEach(bid => {
|
|
52
|
+
requests.push(createVideoRequest(bid, bidderRequest));
|
|
53
|
+
});
|
|
54
|
+
return requests;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function createBannerRequest(bids, bidderRequest) {
|
|
58
|
+
let data = getBaseRequest(bids[0], bidderRequest);
|
|
59
|
+
data.imp = bids.map(bid => {
|
|
60
|
+
const floor = getFloor(bid, BANNER);
|
|
61
|
+
let imp = {
|
|
62
|
+
id: bid.bidId,
|
|
63
|
+
tagid: bid.params.unit,
|
|
64
|
+
banner: {
|
|
65
|
+
format: toFormat(bid.mediaTypes.banner.sizes),
|
|
66
|
+
topframe: utils.inIframe() ? 0 : 1
|
|
67
|
+
},
|
|
68
|
+
ext: {divid: bid.adUnitCode}
|
|
69
|
+
};
|
|
70
|
+
enrichImp(imp, bid, floor);
|
|
71
|
+
return imp;
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: REQUEST_URL,
|
|
76
|
+
data: data
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function toFormat(sizes) {
|
|
81
|
+
return sizes.map((s) => {
|
|
82
|
+
return { w: s[0], h: s[1] };
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function enrichImp(imp, bid, floor) {
|
|
87
|
+
if (bid.params.customParams) {
|
|
88
|
+
utils.deepSetValue(imp, 'ext.customParams', bid.params.customParams);
|
|
89
|
+
}
|
|
90
|
+
if (floor > 0) {
|
|
91
|
+
imp.bidfloor = floor;
|
|
92
|
+
imp.bidfloorcur = 'USD';
|
|
93
|
+
} else if (bid.params.customFloor) {
|
|
94
|
+
imp.bidfloor = bid.params.customFloor;
|
|
95
|
+
}
|
|
96
|
+
if (bid.ortb2Imp && bid.ortb2Imp.ext && bid.ortb2Imp.ext.data) {
|
|
97
|
+
imp.ext.data = bid.ortb2Imp.ext.data;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function createVideoRequest(bid, bidderRequest) {
|
|
102
|
+
let width;
|
|
103
|
+
let height;
|
|
104
|
+
const videoMediaType = utils.deepAccess(bid, `mediaTypes.video`);
|
|
105
|
+
const playerSize = utils.deepAccess(bid, 'mediaTypes.video.playerSize');
|
|
106
|
+
const context = utils.deepAccess(bid, 'mediaTypes.video.context');
|
|
107
|
+
const floor = getFloor(bid, VIDEO);
|
|
108
|
+
|
|
109
|
+
// normalize config for video size
|
|
110
|
+
if (utils.isArray(bid.sizes) && bid.sizes.length === 2 && !utils.isArray(bid.sizes[0])) {
|
|
111
|
+
width = parseInt(bid.sizes[0], 10);
|
|
112
|
+
height = parseInt(bid.sizes[1], 10);
|
|
113
|
+
} else if (utils.isArray(bid.sizes) && utils.isArray(bid.sizes[0]) && bid.sizes[0].length === 2) {
|
|
114
|
+
width = parseInt(bid.sizes[0][0], 10);
|
|
115
|
+
height = parseInt(bid.sizes[0][1], 10);
|
|
116
|
+
} else if (utils.isArray(playerSize) && playerSize.length === 2) {
|
|
117
|
+
width = parseInt(playerSize[0], 10);
|
|
118
|
+
height = parseInt(playerSize[1], 10);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let data = getBaseRequest(bid, bidderRequest);
|
|
122
|
+
data.imp = [{
|
|
123
|
+
id: bid.bidId,
|
|
124
|
+
tagid: bid.params.unit,
|
|
125
|
+
video: {
|
|
126
|
+
w: width,
|
|
127
|
+
h: height,
|
|
128
|
+
topframe: utils.inIframe() ? 0 : 1
|
|
129
|
+
},
|
|
130
|
+
ext: {divid: bid.adUnitCode}
|
|
131
|
+
}];
|
|
132
|
+
|
|
133
|
+
enrichImp(data.imp[0], bid, floor);
|
|
134
|
+
|
|
135
|
+
if (context) {
|
|
136
|
+
if (context === 'instream') {
|
|
137
|
+
data.imp[0].video.placement = 1;
|
|
138
|
+
} else if (context === 'outstream') {
|
|
139
|
+
data.imp[0].video.placement = 4;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// backward compatability for video params
|
|
144
|
+
let videoParams = bid.params.video || bid.params.openrtb || {};
|
|
145
|
+
if (utils.isArray(videoParams.imp)) {
|
|
146
|
+
videoParams = videoParams[0].video;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
Object.keys(videoParams)
|
|
150
|
+
.filter(param => includes(VIDEO_TARGETING, param))
|
|
151
|
+
.forEach(param => data.imp[0].video[param] = videoParams[param]);
|
|
152
|
+
Object.keys(videoMediaType)
|
|
153
|
+
.filter(param => includes(VIDEO_TARGETING, param))
|
|
154
|
+
.forEach(param => data.imp[0].video[param] = videoMediaType[param]);
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
url: REQUEST_URL,
|
|
159
|
+
data: data
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function getBaseRequest(bid, bidderRequest) {
|
|
164
|
+
let req = {
|
|
165
|
+
id: bidderRequest.auctionId,
|
|
166
|
+
cur: [config.getConfig('currency.adServerCurrency') || 'USD'],
|
|
167
|
+
at: 1,
|
|
168
|
+
tmax: config.getConfig('bidderTimeout'),
|
|
169
|
+
site: {
|
|
170
|
+
page: config.getConfig('pageUrl') || bidderRequest.refererInfo.referer
|
|
171
|
+
},
|
|
172
|
+
regs: {
|
|
173
|
+
coppa: (config.getConfig('coppa') === true || bid.params.coppa) ? 1 : 0,
|
|
174
|
+
},
|
|
175
|
+
device: {
|
|
176
|
+
dnt: (utils.getDNT() || bid.params.doNotTrack) ? 1 : 0,
|
|
177
|
+
h: screen.height,
|
|
178
|
+
w: screen.width,
|
|
179
|
+
ua: window.navigator.userAgent,
|
|
180
|
+
language: window.navigator.language.split('-').shift()
|
|
181
|
+
},
|
|
182
|
+
ext: {
|
|
183
|
+
bc: `${bidderConfig}_${bidderVersion}`
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
if (bid.params.platform) {
|
|
188
|
+
utils.deepSetValue(req, 'ext.platform', bid.params.platform);
|
|
189
|
+
}
|
|
190
|
+
if (bid.params.delDomain) {
|
|
191
|
+
utils.deepSetValue(req, 'ext.delDomain', bid.params.delDomain);
|
|
192
|
+
}
|
|
193
|
+
if (bid.params.test) {
|
|
194
|
+
req.test = 1
|
|
195
|
+
}
|
|
196
|
+
if (bidderRequest.gdprConsent) {
|
|
197
|
+
if (bidderRequest.gdprConsent.gdprApplies !== undefined) {
|
|
198
|
+
utils.deepSetValue(req, 'regs.ext.gdpr', bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0);
|
|
199
|
+
}
|
|
200
|
+
if (bidderRequest.gdprConsent.consentString !== undefined) {
|
|
201
|
+
utils.deepSetValue(req, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
|
|
202
|
+
}
|
|
203
|
+
if (bidderRequest.gdprConsent.addtlConsent !== undefined) {
|
|
204
|
+
utils.deepSetValue(req, 'user.ext.ConsentedProvidersSettings.consented_providers', bidderRequest.gdprConsent.addtlConsent);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (bidderRequest.uspConsent) {
|
|
208
|
+
utils.deepSetValue(req, 'regs.ext.us_privacy', bidderRequest.uspConsent);
|
|
209
|
+
}
|
|
210
|
+
if (bid.schain) {
|
|
211
|
+
utils.deepSetValue(req, 'source.ext.schain', bid.schain);
|
|
212
|
+
}
|
|
213
|
+
if (bid.userIdAsEids) {
|
|
214
|
+
utils.deepSetValue(req, 'user.ext.eids', bid.userIdAsEids);
|
|
215
|
+
}
|
|
216
|
+
const commonFpd = bidderRequest.ortb2 || {};
|
|
217
|
+
if (commonFpd.site) {
|
|
218
|
+
utils.mergeDeep(req, {site: commonFpd.site});
|
|
219
|
+
}
|
|
220
|
+
if (commonFpd.user) {
|
|
221
|
+
utils.mergeDeep(req, {user: commonFpd.user});
|
|
222
|
+
}
|
|
223
|
+
return req;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function isVideoBid(bid) {
|
|
227
|
+
return utils.deepAccess(bid, 'mediaTypes.video');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function isBannerBid(bid) {
|
|
231
|
+
return utils.deepAccess(bid, 'mediaTypes.banner') || !isVideoBid(bid);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function getFloor(bid, mediaType) {
|
|
235
|
+
let floor = 0;
|
|
236
|
+
|
|
237
|
+
if (typeof bid.getFloor === 'function') {
|
|
238
|
+
const floorInfo = bid.getFloor({
|
|
239
|
+
currency: 'USD',
|
|
240
|
+
mediaType: mediaType,
|
|
241
|
+
size: '*'
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
if (typeof floorInfo === 'object' &&
|
|
245
|
+
floorInfo.currency === 'USD' &&
|
|
246
|
+
!isNaN(parseFloat(floorInfo.floor))) {
|
|
247
|
+
floor = Math.max(floor, parseFloat(floorInfo.floor));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return floor;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function interpretResponse(resp, req) {
|
|
255
|
+
// pass these from request to the responses for use in userSync
|
|
256
|
+
if (req.data.ext) {
|
|
257
|
+
if (req.data.ext.delDomain) {
|
|
258
|
+
utils.deepSetValue(resp, 'body.ext.delDomain', req.data.ext.delDomain);
|
|
259
|
+
}
|
|
260
|
+
if (req.data.ext.platform) {
|
|
261
|
+
utils.deepSetValue(resp, 'body.ext.platform', req.data.ext.platform);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const respBody = resp.body;
|
|
266
|
+
if ('nbr' in respBody) {
|
|
267
|
+
return [];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
let bids = [];
|
|
271
|
+
respBody.seatbid.forEach(seatbid => {
|
|
272
|
+
bids = [...bids, ...seatbid.bid.map(bid => {
|
|
273
|
+
let response = {
|
|
274
|
+
requestId: bid.impid,
|
|
275
|
+
cpm: bid.price,
|
|
276
|
+
width: bid.w,
|
|
277
|
+
height: bid.h,
|
|
278
|
+
creativeId: bid.crid,
|
|
279
|
+
dealId: bid.dealid,
|
|
280
|
+
currency: respBody.cur || 'USD',
|
|
281
|
+
netRevenue: true,
|
|
282
|
+
ttl: 300,
|
|
283
|
+
mediaType: 'banner' in req.data.imp[0] ? BANNER : VIDEO,
|
|
284
|
+
meta: { advertiserDomains: bid.adomain }
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
if (response.mediaType === VIDEO) {
|
|
288
|
+
if (bid.nurl) {
|
|
289
|
+
response.vastUrl = bid.nurl;
|
|
290
|
+
} else {
|
|
291
|
+
response.vastXml = bid.adm;
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
response.ad = bid.adm;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (bid.ext) {
|
|
298
|
+
response.meta.networkId = bid.ext.dsp_id;
|
|
299
|
+
response.meta.advertiserId = bid.ext.buyer_id;
|
|
300
|
+
response.meta.brandId = bid.ext.brand_id;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (respBody.ext && respBody.ext.paf) {
|
|
304
|
+
response.meta.paf = respBody.ext.paf;
|
|
305
|
+
response.meta.paf.content_id = utils.deepAccess(bid, 'ext.paf.content_id');
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return response
|
|
309
|
+
})];
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
return bids;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @param syncOptions
|
|
317
|
+
* @param responses
|
|
318
|
+
* @param gdprConsent
|
|
319
|
+
* @param uspConsent
|
|
320
|
+
* @return {{type: (string), url: (*|string)}[]}
|
|
321
|
+
*/
|
|
322
|
+
function getUserSyncs(syncOptions, responses, gdprConsent, uspConsent) {
|
|
323
|
+
if (syncOptions.iframeEnabled || syncOptions.pixelEnabled) {
|
|
324
|
+
let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
|
|
325
|
+
let queryParamStrings = [];
|
|
326
|
+
let syncUrl = SYNC_URL;
|
|
327
|
+
if (gdprConsent) {
|
|
328
|
+
queryParamStrings.push('gdpr=' + (gdprConsent.gdprApplies ? 1 : 0));
|
|
329
|
+
queryParamStrings.push('gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''));
|
|
330
|
+
}
|
|
331
|
+
if (uspConsent) {
|
|
332
|
+
queryParamStrings.push('us_privacy=' + encodeURIComponent(uspConsent));
|
|
333
|
+
}
|
|
334
|
+
if (responses.length > 0 && responses[0].body && responses[0].body.ext) {
|
|
335
|
+
const ext = responses[0].body.ext;
|
|
336
|
+
if (ext.delDomain) {
|
|
337
|
+
syncUrl = `https://${ext.delDomain}/w/1.0/pd`
|
|
338
|
+
} else if (ext.platform) {
|
|
339
|
+
queryParamStrings.push('ph=' + ext.platform)
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
queryParamStrings.push('ph=' + DEFAULT_PH)
|
|
343
|
+
}
|
|
344
|
+
return [{
|
|
345
|
+
type: pixelType,
|
|
346
|
+
url: `${syncUrl}${queryParamStrings.length > 0 ? '?' + queryParamStrings.join('&') : ''}`
|
|
347
|
+
}];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Module Name: OpenX OpenRTB Bidder Adapter
|
|
5
|
+
Module Type: Bidder Adapter
|
|
6
|
+
Maintainer: team-openx@openx.com
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
# Description
|
|
10
|
+
|
|
11
|
+
This is an updated version of the OpenX bid adapter which calls our new serving architecture.
|
|
12
|
+
Publishers are welcome to test this adapter and give feedback. Please note you should only include either openxBidAdapter or openxOrtbBidAdapter in your build.
|
|
13
|
+
|
|
14
|
+
# Bid Parameters
|
|
15
|
+
## Banner
|
|
16
|
+
|
|
17
|
+
| Name | Scope | Type | Description | Example
|
|
18
|
+
| ---- | ----- | ---- | ----------- | -------
|
|
19
|
+
| `delDomain` or `platform` | required | String | OpenX delivery domain or platform id provided by your OpenX representative. | "PUBLISHER-d.openx.net" or "555not5a-real-plat-form-id0123456789"
|
|
20
|
+
| `unit` | required | String | OpenX ad unit ID provided by your OpenX representative. | "1611023122"
|
|
21
|
+
| `customParams` | optional | Object | User-defined targeting key-value pairs. customParams applies to a specific unit. | `{key1: "v1", key2: ["v2","v3"]}`
|
|
22
|
+
| `customFloor` | optional | Number | Minimum price in USD. customFloor applies to a specific unit. For example, use the following value to set a $1.50 floor: 1.50 <br/><br/> **WARNING:**<br/> Misuse of this parameter can impact revenue | 1.50
|
|
23
|
+
| `doNotTrack` | optional | Boolean | Prevents advertiser from using data for this user. <br/><br/> **WARNING:**<br/> Request-level setting. May impact revenue. | true
|
|
24
|
+
| `coppa` | optional | Boolean | Enables Child's Online Privacy Protection Act (COPPA) regulations. | true
|
|
25
|
+
|
|
26
|
+
## Video
|
|
27
|
+
|
|
28
|
+
| Name | Scope | Type | Description | Example
|
|
29
|
+
| ---- | ----- | ---- | ----------- | -------
|
|
30
|
+
| `unit` | required | String | OpenX ad unit ID provided by your OpenX representative. | "1611023122"
|
|
31
|
+
| `delDomain` | required | String | OpenX delivery domain provided by your OpenX representative. | "PUBLISHER-d.openx.net"
|
|
32
|
+
| `video` | optional | OpenRTB video subtypes | Alternatively can be added under adUnit.mediaTypes.video | `{ video: {mimes: ['video/mp4']}`
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Example
|
|
36
|
+
```javascript
|
|
37
|
+
var adUnits = [
|
|
38
|
+
{
|
|
39
|
+
code: 'test-div',
|
|
40
|
+
sizes: [[728, 90]], // a display size
|
|
41
|
+
mediaTypes: {'banner': {}},
|
|
42
|
+
bids: [
|
|
43
|
+
{
|
|
44
|
+
bidder: 'openx',
|
|
45
|
+
params: {
|
|
46
|
+
unit: '539439964',
|
|
47
|
+
delDomain: 'se-demo-d.openx.net',
|
|
48
|
+
customParams: {
|
|
49
|
+
key1: 'v1',
|
|
50
|
+
key2: ['v2', 'v3']
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
bidder: 'openx',
|
|
55
|
+
params: {
|
|
56
|
+
unit: '539439964',
|
|
57
|
+
platform: 'a3aece0c-9e80-4316-8deb-faf804779bd1',
|
|
58
|
+
customParams: {
|
|
59
|
+
key1: 'v1',
|
|
60
|
+
key2: ['v2', 'v3']
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
code: 'video1',
|
|
68
|
+
mediaTypes: {
|
|
69
|
+
video: {
|
|
70
|
+
playerSize: [640, 480],
|
|
71
|
+
context: 'instream'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
bids: [{
|
|
75
|
+
bidder: 'openx',
|
|
76
|
+
params: {
|
|
77
|
+
unit: '1611023124',
|
|
78
|
+
delDomain: 'PUBLISHER-d.openx.net',
|
|
79
|
+
video: {
|
|
80
|
+
mimes: ['video/x-ms-wmv, video/mp4']
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}]
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
# Configuration
|
|
89
|
+
Add the following code to enable user syncing. By default, Prebid.js version 0.34.0+ turns off user syncing through iframes.
|
|
90
|
+
OpenX strongly recommends enabling user syncing through iframes. This functionality improves DSP user match rates and increases the
|
|
91
|
+
OpenX bid rate and bid price. Be sure to call `pbjs.setConfig()` only once.
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
pbjs.setConfig({
|
|
95
|
+
userSync: {
|
|
96
|
+
iframeEnabled: true
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
# Additional Details
|
|
102
|
+
[Banner Ads](https://docs.openx.com/publishers/prebid-adapter-web/)
|
|
103
|
+
|
|
104
|
+
[Video Ads](https://docs.openx.com/publishers/prebid-adapter-video/)
|
|
105
|
+
|
package/modules/priceFloors.js
CHANGED
|
@@ -751,7 +751,7 @@ export function addBidResponseHook(fn, adUnitCode, bid) {
|
|
|
751
751
|
flooredBid.status = CONSTANTS.BID_STATUS.BID_REJECTED;
|
|
752
752
|
// if floor not met update bid with 0 cpm so it is not included downstream and marked as no-bid
|
|
753
753
|
flooredBid.cpm = 0;
|
|
754
|
-
logWarn(`${MODULE_NAME}: ${flooredBid.bidderCode}'s Bid Response for ${adUnitCode} was rejected due to floor not met`, bid);
|
|
754
|
+
logWarn(`${MODULE_NAME}: ${flooredBid.bidderCode}'s Bid Response for ${adUnitCode} was rejected due to floor not met (adjusted cpm: ${bid?.floorData?.cpmAfterAdjustments}, floor: ${floorInfo?.matchingFloor})`, bid);
|
|
755
755
|
return fn.call(this, adUnitCode, flooredBid);
|
|
756
756
|
}
|
|
757
757
|
return fn.call(this, adUnitCode, bid);
|
package/modules/pubCommonId.js
CHANGED
|
@@ -9,8 +9,7 @@ import * as events from '../src/events.js';
|
|
|
9
9
|
import CONSTANTS from '../src/constants.json';
|
|
10
10
|
import { getStorageManager } from '../src/storageManager.js';
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
const storage = getStorageManager({moduleType: MODULE_TYPE});
|
|
12
|
+
const storage = getStorageManager();
|
|
14
13
|
|
|
15
14
|
const ID_NAME = '_pubcid';
|
|
16
15
|
const OPTOUT_NAME = '_pubcid_optout';
|
|
@@ -91,7 +91,12 @@ function mapBidResponse(bidResponse, status) {
|
|
|
91
91
|
} else {
|
|
92
92
|
Object.assign(bid, {
|
|
93
93
|
bidId: bidResponse.requestId,
|
|
94
|
-
floorProvider: events.floorDetail
|
|
94
|
+
floorProvider: events.floorDetail?.floorProvider || null,
|
|
95
|
+
floorFetchStatus: events.floorDetail?.fetchStatus || null,
|
|
96
|
+
floorLocation: events.floorDetail?.location || null,
|
|
97
|
+
floorModelVersion: events.floorDetail?.modelVersion || null,
|
|
98
|
+
floorSkipRate: events.floorDetail?.skipRate || 0,
|
|
99
|
+
isFloorSkipped: events.floorDetail?.skipped || false,
|
|
95
100
|
isWinningBid: true,
|
|
96
101
|
placementId: bidResponse.params ? deepAccess(bidResponse, 'params.0.placementId') : null,
|
|
97
102
|
renderedSize: bidResponse.size,
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import { BANNER } from '../src/mediaTypes.js';
|
|
3
|
+
import { isEmpty, getAdUnitSizes, parseSizesInput, deepAccess } from '../src/utils.js';
|
|
4
|
+
|
|
5
|
+
const BIDDER_CODE = 'ras';
|
|
6
|
+
const VERSION = '1.0';
|
|
7
|
+
|
|
8
|
+
const getEndpoint = (network) => `https://csr.onet.pl/${encodeURIComponent(network)}/csr-006/csr.json?`;
|
|
9
|
+
|
|
10
|
+
function parseParams(params, bidderRequest) {
|
|
11
|
+
const newParams = {};
|
|
12
|
+
const du = deepAccess(bidderRequest, 'refererInfo.page');
|
|
13
|
+
const dr = deepAccess(bidderRequest, 'refererInfo.ref');
|
|
14
|
+
|
|
15
|
+
if (du) {
|
|
16
|
+
newParams.du = du;
|
|
17
|
+
}
|
|
18
|
+
if (dr) {
|
|
19
|
+
newParams.dr = dr;
|
|
20
|
+
}
|
|
21
|
+
const pageContext = params.pageContext;
|
|
22
|
+
if (!pageContext) {
|
|
23
|
+
return newParams;
|
|
24
|
+
}
|
|
25
|
+
if (pageContext.du) {
|
|
26
|
+
newParams.du = pageContext.du;
|
|
27
|
+
}
|
|
28
|
+
if (pageContext.dr) {
|
|
29
|
+
newParams.dr = pageContext.dr;
|
|
30
|
+
}
|
|
31
|
+
if (pageContext.dv) {
|
|
32
|
+
newParams.DV = pageContext.dv;
|
|
33
|
+
}
|
|
34
|
+
if (pageContext.keyWords && Array.isArray(pageContext.keyWords)) {
|
|
35
|
+
newParams.kwrd = pageContext.keyWords.join('+');
|
|
36
|
+
}
|
|
37
|
+
if (pageContext.capping) {
|
|
38
|
+
newParams.local_capping = pageContext.capping;
|
|
39
|
+
}
|
|
40
|
+
if (pageContext.keyValues && typeof pageContext.keyValues === 'object') {
|
|
41
|
+
for (const param in pageContext.keyValues) {
|
|
42
|
+
if (pageContext.keyValues.hasOwnProperty(param)) {
|
|
43
|
+
const kvName = 'kv' + param;
|
|
44
|
+
newParams[kvName] = pageContext.keyValues[param];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return newParams;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const buildBid = (ad) => {
|
|
52
|
+
if (ad.type === 'empty') {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
requestId: ad.id,
|
|
57
|
+
cpm: ad.bid_rate ? ad.bid_rate.toFixed(2) : 0,
|
|
58
|
+
width: ad.width || 0,
|
|
59
|
+
height: ad.height || 0,
|
|
60
|
+
ttl: 300,
|
|
61
|
+
creativeId: ad.adid ? parseInt(ad.adid.split(',')[2], 10) : 0,
|
|
62
|
+
netRevenue: true,
|
|
63
|
+
currency: ad.currency || 'USD',
|
|
64
|
+
dealId: null,
|
|
65
|
+
meta: {
|
|
66
|
+
mediaType: BANNER
|
|
67
|
+
},
|
|
68
|
+
ad: ad.html || null
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getContextParams = (bidRequests, bidderRequest) => {
|
|
73
|
+
const bid = bidRequests[0];
|
|
74
|
+
const { params } = bid;
|
|
75
|
+
const requestParams = {
|
|
76
|
+
site: params.site,
|
|
77
|
+
area: params.area,
|
|
78
|
+
cre_format: 'html',
|
|
79
|
+
systems: 'das',
|
|
80
|
+
kvprver: VERSION,
|
|
81
|
+
ems_url: 1,
|
|
82
|
+
bid_rate: 1,
|
|
83
|
+
...parseParams(params, bidderRequest)
|
|
84
|
+
};
|
|
85
|
+
return Object.keys(requestParams).map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(requestParams[key])).join('&');
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const getSlots = (bidRequests) => {
|
|
89
|
+
let queryString = '';
|
|
90
|
+
const batchSize = bidRequests.length;
|
|
91
|
+
for (let i = 0; i < batchSize; i++) {
|
|
92
|
+
const adunit = bidRequests[i];
|
|
93
|
+
const sizes = parseSizesInput(getAdUnitSizes(adunit)).join(',');
|
|
94
|
+
queryString += `&slot${i}=${encodeURIComponent(adunit.params.slot)}&id${i}=${encodeURIComponent(adunit.bidId)}&composition${i}=CHILD`;
|
|
95
|
+
if (sizes.length) {
|
|
96
|
+
queryString += `&iusizes${i}=${encodeURIComponent(sizes)}`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return queryString;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const getGdprParams = (bidderRequest) => {
|
|
103
|
+
const gdprApplies = deepAccess(bidderRequest, 'gdprConsent.gdprApplies');
|
|
104
|
+
let consentString = deepAccess(bidderRequest, 'gdprConsent.consentString');
|
|
105
|
+
let queryString = '';
|
|
106
|
+
if (gdprApplies !== undefined) {
|
|
107
|
+
queryString += `&gdpr_applies=${encodeURIComponent(gdprApplies)}`;
|
|
108
|
+
}
|
|
109
|
+
if (consentString !== undefined) {
|
|
110
|
+
queryString += `&euconsent=${encodeURIComponent(consentString)}`;
|
|
111
|
+
}
|
|
112
|
+
return queryString;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const spec = {
|
|
116
|
+
code: BIDDER_CODE,
|
|
117
|
+
supportedMediaTypes: [BANNER],
|
|
118
|
+
|
|
119
|
+
isBidRequestValid: function (bidRequest) {
|
|
120
|
+
if (!bidRequest || !bidRequest.params || typeof bidRequest.params !== 'object') {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const { params } = bidRequest;
|
|
124
|
+
return Boolean(params.network && params.site && params.area && params.slot);
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
buildRequests: function (bidRequests, bidderRequest) {
|
|
128
|
+
const slotsQuery = getSlots(bidRequests);
|
|
129
|
+
const contextQuery = getContextParams(bidRequests, bidderRequest);
|
|
130
|
+
const gdprQuery = getGdprParams(bidderRequest);
|
|
131
|
+
const bidIds = bidRequests.map((bid) => ({ slot: bid.params.slot, bidId: bid.bidId }));
|
|
132
|
+
const network = bidRequests[0].params.network;
|
|
133
|
+
return [{
|
|
134
|
+
method: 'GET',
|
|
135
|
+
url: getEndpoint(network) + contextQuery + slotsQuery + gdprQuery,
|
|
136
|
+
bidIds: bidIds
|
|
137
|
+
}];
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
interpretResponse: function (serverResponse, bidRequest) {
|
|
141
|
+
const response = serverResponse.body;
|
|
142
|
+
if (!response || !response.ads || response.ads.length === 0) {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
return response.ads.map(buildBid).filter((bid) => !isEmpty(bid));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
registerBidder(spec);
|