prebid.js 6.3.0 → 6.7.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 +1 -1
- package/gulpfile.js +87 -74
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/karma.conf.maker.js +1 -1
- package/modules/.submodules.json +2 -1
- package/modules/adbookpspBidAdapter.js +27 -10
- package/modules/adhashBidAdapter.js +3 -3
- package/modules/adkernelBidAdapter.js +148 -62
- package/modules/adlooxAdServerVideo.js +2 -2
- package/modules/adlooxAnalyticsAdapter.js +4 -4
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +27 -9
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/adyoulikeBidAdapter.js +13 -9
- package/modules/aniviewBidAdapter.js +1 -1
- package/modules/beopBidAdapter.js +1 -1
- package/modules/bidViewability.js +3 -3
- package/modules/bidViewabilityIO.js +3 -3
- package/modules/bliinkBidAdapter.js +3 -2
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +208 -0
- package/modules/compassBidAdapter.md +79 -0
- package/modules/consentManagement.js +7 -1
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +2 -2
- package/modules/dailyhuntBidAdapter.js +435 -0
- package/modules/dailyhuntBidAdapter.md +4 -0
- package/modules/docereeBidAdapter.js +10 -1
- package/modules/docereeBidAdapter.md +2 -0
- package/modules/engageyaBidAdapter.js +1 -1
- package/modules/feedadBidAdapter.js +2 -2
- package/modules/feedadBidAdapter.md +4 -2
- package/modules/glimpseBidAdapter.js +66 -44
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/gptPreAuction.js +55 -7
- package/modules/gridBidAdapter.js +4 -3
- package/modules/gumgumBidAdapter.js +4 -4
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +42 -4
- package/modules/instreamTracking.js +4 -4
- package/modules/invibesBidAdapter.js +49 -5
- package/modules/invibesBidAdapter.md +2 -1
- package/modules/ixBidAdapter.js +53 -18
- package/modules/jwplayerRtdProvider.js +71 -6
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/livewrappedAnalyticsAdapter.js +3 -1
- package/modules/livewrappedBidAdapter.js +8 -2
- package/modules/loglyliftBidAdapter.js +79 -0
- package/modules/loglyliftBidAdapter.md +55 -0
- package/modules/nextMillenniumBidAdapter.js +11 -7
- package/modules/oguryBidAdapter.js +9 -2
- package/modules/onetagBidAdapter.js +4 -2
- package/modules/optimeraRtdProvider.js +8 -1
- package/modules/ozoneBidAdapter.js +21 -64
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/proxistoreBidAdapter.js +0 -2
- package/modules/pubgeniusBidAdapter.js +1 -1
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/pubxaiAnalyticsAdapter.js +17 -0
- package/modules/richaudienceBidAdapter.js +3 -2
- package/modules/riseBidAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +14 -15
- package/modules/rubiconAnalyticsAdapter.js +3 -2
- package/modules/rubiconBidAdapter.js +21 -11
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/synacormediaBidAdapter.js +31 -10
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/telariaBidAdapter.js +2 -2
- package/modules/trustxBidAdapter.js +8 -16
- package/modules/userId/eids.js +7 -1
- package/modules/userId/userId.md +8 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/welectBidAdapter.js +106 -0
- package/modules/yieldmoBidAdapter.js +23 -5
- package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
- package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
- package/package.json +1 -1
- package/src/auction.js +2 -2
- package/src/config.js +27 -3
- package/src/hook.js +5 -1
- package/src/prebid.js +20 -4
- package/src/secureCreatives.js +3 -2
- package/src/utils.js +12 -1
- package/test/helpers/prebidGlobal.js +1 -0
- package/test/spec/config_spec.js +279 -0
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
- package/test/spec/modules/beopBidAdapter_spec.js +1 -1
- package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
- package/test/spec/modules/bidViewability_spec.js +4 -4
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/compassBidAdapter_spec.js +398 -0
- package/test/spec/modules/consentManagement_spec.js +20 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
- package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gptPreAuction_spec.js +177 -2
- package/test/spec/modules/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
- package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
- package/test/spec/modules/ixBidAdapter_spec.js +112 -62
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
- package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
- package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +9 -2
- package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
- package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
- package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
- package/test/spec/modules/realTimeDataModule_spec.js +67 -5
- package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +1 -1
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +30 -0
- package/test/spec/modules/rubiconBidAdapter_spec.js +48 -9
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
- package/test/spec/unit/pbjs_api_spec.js +3 -1
- package/test/test_deps.js +3 -0
- package/test/test_index.js +1 -3
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import * as mediaTypes from '../src/mediaTypes.js';
|
|
3
|
+
import {deepAccess, _map, isEmpty} from '../src/utils.js';
|
|
4
|
+
import { ajax } from '../src/ajax.js';
|
|
5
|
+
import find from 'core-js-pure/features/array/find.js';
|
|
6
|
+
import { OUTSTREAM, INSTREAM } from '../src/video.js';
|
|
7
|
+
|
|
8
|
+
const BIDDER_CODE = 'dailyhunt';
|
|
9
|
+
const BIDDER_ALIAS = 'dh';
|
|
10
|
+
const SUPPORTED_MEDIA_TYPES = [mediaTypes.BANNER, mediaTypes.NATIVE, mediaTypes.VIDEO];
|
|
11
|
+
|
|
12
|
+
const PROD_PREBID_ENDPOINT_URL = 'https://pbs.dailyhunt.in/openrtb2/auction?partner=';
|
|
13
|
+
const PROD_PREBID_TEST_ENDPOINT_URL = 'https://qa-pbs-van.dailyhunt.in/openrtb2/auction?partner=';
|
|
14
|
+
|
|
15
|
+
const ORTB_NATIVE_TYPE_MAPPING = {
|
|
16
|
+
img: {
|
|
17
|
+
'3': 'image',
|
|
18
|
+
'1': 'icon'
|
|
19
|
+
},
|
|
20
|
+
data: {
|
|
21
|
+
'1': 'sponsoredBy',
|
|
22
|
+
'2': 'body',
|
|
23
|
+
'3': 'rating',
|
|
24
|
+
'4': 'likes',
|
|
25
|
+
'5': 'downloads',
|
|
26
|
+
'6': 'price',
|
|
27
|
+
'7': 'salePrice',
|
|
28
|
+
'8': 'phone',
|
|
29
|
+
'9': 'address',
|
|
30
|
+
'10': 'body2',
|
|
31
|
+
'11': 'displayUrl',
|
|
32
|
+
'12': 'cta'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const ORTB_NATIVE_PARAMS = {
|
|
37
|
+
title: {
|
|
38
|
+
id: 0,
|
|
39
|
+
name: 'title'
|
|
40
|
+
},
|
|
41
|
+
icon: {
|
|
42
|
+
id: 1,
|
|
43
|
+
type: 1,
|
|
44
|
+
name: 'img'
|
|
45
|
+
},
|
|
46
|
+
image: {
|
|
47
|
+
id: 2,
|
|
48
|
+
type: 3,
|
|
49
|
+
name: 'img'
|
|
50
|
+
},
|
|
51
|
+
sponsoredBy: {
|
|
52
|
+
id: 3,
|
|
53
|
+
name: 'data',
|
|
54
|
+
type: 1
|
|
55
|
+
},
|
|
56
|
+
body: {
|
|
57
|
+
id: 4,
|
|
58
|
+
name: 'data',
|
|
59
|
+
type: 2
|
|
60
|
+
},
|
|
61
|
+
cta: {
|
|
62
|
+
id: 5,
|
|
63
|
+
type: 12,
|
|
64
|
+
name: 'data'
|
|
65
|
+
},
|
|
66
|
+
body2: {
|
|
67
|
+
id: 4,
|
|
68
|
+
name: 'data',
|
|
69
|
+
type: 10
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Encode URI.
|
|
74
|
+
const _encodeURIComponent = function (a) {
|
|
75
|
+
let b = window.encodeURIComponent(a);
|
|
76
|
+
b = b.replace(/'/g, '%27');
|
|
77
|
+
return b;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Extract key from collections.
|
|
81
|
+
const extractKeyInfo = (collection, key) => {
|
|
82
|
+
for (let i = 0, result; i < collection.length; i++) {
|
|
83
|
+
result = deepAccess(collection[i].params, key);
|
|
84
|
+
if (result) {
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return undefined
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Flattern Array.
|
|
92
|
+
const flatten = (arr) => {
|
|
93
|
+
return [].concat(...arr);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const createOrtbRequest = (validBidRequests, bidderRequest) => {
|
|
97
|
+
let device = createOrtbDeviceObj(validBidRequests);
|
|
98
|
+
let user = createOrtbUserObj(validBidRequests)
|
|
99
|
+
let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.referer)
|
|
100
|
+
return {
|
|
101
|
+
id: bidderRequest.auctionId,
|
|
102
|
+
imp: [],
|
|
103
|
+
site,
|
|
104
|
+
device,
|
|
105
|
+
user,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const createOrtbDeviceObj = (validBidRequests) => {
|
|
110
|
+
let device = { ...extractKeyInfo(validBidRequests, `device`) };
|
|
111
|
+
device.ua = navigator.userAgent;
|
|
112
|
+
return device;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const createOrtbUserObj = (validBidRequests) => ({ ...extractKeyInfo(validBidRequests, `user`) })
|
|
116
|
+
|
|
117
|
+
const createOrtbSiteObj = (validBidRequests, page) => {
|
|
118
|
+
let site = { ...extractKeyInfo(validBidRequests, `site`), page };
|
|
119
|
+
let publisher = createOrtbPublisherObj(validBidRequests);
|
|
120
|
+
if (!site.publisher) {
|
|
121
|
+
site.publisher = publisher
|
|
122
|
+
}
|
|
123
|
+
return site
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const createOrtbPublisherObj = (validBidRequests) => ({ ...extractKeyInfo(validBidRequests, `publisher`) })
|
|
127
|
+
|
|
128
|
+
// get bidFloor Function for different creatives
|
|
129
|
+
function getBidFloor(bid, creative) {
|
|
130
|
+
let floorInfo = typeof (bid.getFloor) == 'function' ? bid.getFloor({ currency: 'USD', mediaType: creative, size: '*' }) : {};
|
|
131
|
+
return Math.floor(floorInfo.floor || (bid.params.bidfloor ? bid.params.bidfloor : 0.0));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const createOrtbImpObj = (bid) => {
|
|
135
|
+
let params = bid.params
|
|
136
|
+
let testMode = !!bid.params.test_mode
|
|
137
|
+
|
|
138
|
+
// Validate Banner Request.
|
|
139
|
+
let bannerObj = deepAccess(bid.mediaTypes, `banner`);
|
|
140
|
+
let nativeObj = deepAccess(bid.mediaTypes, `native`);
|
|
141
|
+
let videoObj = deepAccess(bid.mediaTypes, `video`);
|
|
142
|
+
|
|
143
|
+
let imp = {
|
|
144
|
+
id: bid.bidId,
|
|
145
|
+
ext: {
|
|
146
|
+
dailyhunt: {
|
|
147
|
+
placement_id: params.placement_id,
|
|
148
|
+
publisher_id: params.publisher_id,
|
|
149
|
+
partner: params.partner_name
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Test Mode Campaign.
|
|
155
|
+
if (testMode) {
|
|
156
|
+
imp.ext.test_mode = testMode;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (bannerObj) {
|
|
160
|
+
imp.banner = {
|
|
161
|
+
...createOrtbImpBannerObj(bid, bannerObj)
|
|
162
|
+
}
|
|
163
|
+
imp.bidfloor = getBidFloor(bid, 'banner');
|
|
164
|
+
} else if (nativeObj) {
|
|
165
|
+
imp.native = {
|
|
166
|
+
...createOrtbImpNativeObj(bid, nativeObj)
|
|
167
|
+
}
|
|
168
|
+
imp.bidfloor = getBidFloor(bid, 'native');
|
|
169
|
+
} else if (videoObj) {
|
|
170
|
+
imp.video = {
|
|
171
|
+
...createOrtbImpVideoObj(bid, videoObj)
|
|
172
|
+
}
|
|
173
|
+
imp.bidfloor = getBidFloor(bid, 'video');
|
|
174
|
+
}
|
|
175
|
+
return imp;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const createOrtbImpBannerObj = (bid, bannerObj) => {
|
|
179
|
+
let format = [];
|
|
180
|
+
bannerObj.sizes.forEach(size => format.push({ w: size[0], h: size[1] }))
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
id: 'banner-' + bid.bidId,
|
|
184
|
+
format
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const createOrtbImpNativeObj = (bid, nativeObj) => {
|
|
189
|
+
const assets = _map(bid.nativeParams, (bidParams, key) => {
|
|
190
|
+
const props = ORTB_NATIVE_PARAMS[key];
|
|
191
|
+
const asset = {
|
|
192
|
+
required: bidParams.required & 1,
|
|
193
|
+
};
|
|
194
|
+
if (props) {
|
|
195
|
+
let h = 0;
|
|
196
|
+
let w = 0;
|
|
197
|
+
|
|
198
|
+
asset.id = props.id;
|
|
199
|
+
|
|
200
|
+
if (bidParams.sizes) {
|
|
201
|
+
const sizes = flatten(bidParams.sizes);
|
|
202
|
+
w = sizes[0];
|
|
203
|
+
h = sizes[1];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
asset[props.name] = {
|
|
207
|
+
len: bidParams.len ? bidParams.len : 20,
|
|
208
|
+
type: props.type,
|
|
209
|
+
w,
|
|
210
|
+
h
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return asset;
|
|
214
|
+
}
|
|
215
|
+
}).filter(Boolean);
|
|
216
|
+
let request = {
|
|
217
|
+
assets,
|
|
218
|
+
ver: '1,0'
|
|
219
|
+
}
|
|
220
|
+
return { request: JSON.stringify(request) };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const createOrtbImpVideoObj = (bid, videoObj) => {
|
|
224
|
+
let obj = {};
|
|
225
|
+
let params = bid.params
|
|
226
|
+
if (!isEmpty(bid.params.video)) {
|
|
227
|
+
obj = {
|
|
228
|
+
topframe: 1,
|
|
229
|
+
skip: params.video.skippable || 0,
|
|
230
|
+
linearity: params.video.linearity || 1,
|
|
231
|
+
minduration: params.video.minduration || 5,
|
|
232
|
+
maxduration: params.video.maxduration || 60,
|
|
233
|
+
mimes: params.video.mimes || ['video/mp4'],
|
|
234
|
+
protocols: getProtocols(params.video),
|
|
235
|
+
w: params.video.playerSize[0][0],
|
|
236
|
+
h: params.video.playerSize[0][1],
|
|
237
|
+
};
|
|
238
|
+
} else {
|
|
239
|
+
obj = {
|
|
240
|
+
mimes: ['video/mp4'],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
obj.ext = {
|
|
244
|
+
...videoObj,
|
|
245
|
+
}
|
|
246
|
+
return obj;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function getProtocols({protocols}) {
|
|
250
|
+
let defaultValue = [2, 3, 5, 6, 7, 8];
|
|
251
|
+
let listProtocols = [
|
|
252
|
+
{key: 'VAST_1_0', value: 1},
|
|
253
|
+
{key: 'VAST_2_0', value: 2},
|
|
254
|
+
{key: 'VAST_3_0', value: 3},
|
|
255
|
+
{key: 'VAST_1_0_WRAPPER', value: 4},
|
|
256
|
+
{key: 'VAST_2_0_WRAPPER', value: 5},
|
|
257
|
+
{key: 'VAST_3_0_WRAPPER', value: 6},
|
|
258
|
+
{key: 'VAST_4_0', value: 7},
|
|
259
|
+
{key: 'VAST_4_0_WRAPPER', value: 8}
|
|
260
|
+
];
|
|
261
|
+
if (protocols) {
|
|
262
|
+
return listProtocols.filter(p => {
|
|
263
|
+
return protocols.indexOf(p.key) !== -1
|
|
264
|
+
}).map(p => p.value);
|
|
265
|
+
} else {
|
|
266
|
+
return defaultValue;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const createServerRequest = (ortbRequest, validBidRequests, isTestMode = 'false') => ({
|
|
271
|
+
method: 'POST',
|
|
272
|
+
url: isTestMode === 'true' ? PROD_PREBID_TEST_ENDPOINT_URL + validBidRequests[0].params.partner_name : PROD_PREBID_ENDPOINT_URL + validBidRequests[0].params.partner_name,
|
|
273
|
+
data: JSON.stringify(ortbRequest),
|
|
274
|
+
options: {
|
|
275
|
+
contentType: 'application/json',
|
|
276
|
+
withCredentials: true
|
|
277
|
+
},
|
|
278
|
+
bids: validBidRequests
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
const createPrebidBannerBid = (bid, bidResponse) => ({
|
|
282
|
+
requestId: bid.bidId,
|
|
283
|
+
cpm: bidResponse.price.toFixed(2),
|
|
284
|
+
creativeId: bidResponse.crid,
|
|
285
|
+
width: bidResponse.w,
|
|
286
|
+
height: bidResponse.h,
|
|
287
|
+
ttl: 360,
|
|
288
|
+
netRevenue: bid.netRevenue === 'net',
|
|
289
|
+
currency: 'USD',
|
|
290
|
+
ad: bidResponse.adm,
|
|
291
|
+
mediaType: 'banner',
|
|
292
|
+
winUrl: bidResponse.nurl,
|
|
293
|
+
adomain: bidResponse.adomain
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
const createPrebidNativeBid = (bid, bidResponse) => ({
|
|
297
|
+
requestId: bid.bidId,
|
|
298
|
+
cpm: bidResponse.price.toFixed(2),
|
|
299
|
+
creativeId: bidResponse.crid,
|
|
300
|
+
currency: 'USD',
|
|
301
|
+
ttl: 360,
|
|
302
|
+
netRevenue: bid.netRevenue === 'net',
|
|
303
|
+
native: parseNative(bidResponse),
|
|
304
|
+
mediaType: 'native',
|
|
305
|
+
winUrl: bidResponse.nurl,
|
|
306
|
+
width: bidResponse.w,
|
|
307
|
+
height: bidResponse.h,
|
|
308
|
+
adomain: bidResponse.adomain
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
const parseNative = (bid) => {
|
|
312
|
+
let adm = JSON.parse(bid.adm)
|
|
313
|
+
const { assets, link, imptrackers, jstracker } = adm.native;
|
|
314
|
+
const result = {
|
|
315
|
+
clickUrl: _encodeURIComponent(link.url),
|
|
316
|
+
clickTrackers: link.clicktrackers || [],
|
|
317
|
+
impressionTrackers: imptrackers || [],
|
|
318
|
+
javascriptTrackers: jstracker ? [ jstracker ] : []
|
|
319
|
+
};
|
|
320
|
+
assets.forEach(asset => {
|
|
321
|
+
if (!isEmpty(asset.title)) {
|
|
322
|
+
result.title = asset.title.text
|
|
323
|
+
} else if (!isEmpty(asset.img)) {
|
|
324
|
+
result[ORTB_NATIVE_TYPE_MAPPING.img[asset.img.type]] = {
|
|
325
|
+
url: asset.img.url,
|
|
326
|
+
height: asset.img.h,
|
|
327
|
+
width: asset.img.w
|
|
328
|
+
}
|
|
329
|
+
} else if (!isEmpty(asset.data)) {
|
|
330
|
+
result[ORTB_NATIVE_TYPE_MAPPING.data[asset.data.type]] = asset.data.value
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const createPrebidVideoBid = (bid, bidResponse) => {
|
|
338
|
+
let videoBid = {
|
|
339
|
+
requestId: bid.bidId,
|
|
340
|
+
cpm: bidResponse.price.toFixed(2),
|
|
341
|
+
creativeId: bidResponse.crid,
|
|
342
|
+
width: bidResponse.w,
|
|
343
|
+
height: bidResponse.h,
|
|
344
|
+
ttl: 360,
|
|
345
|
+
netRevenue: bid.netRevenue === 'net',
|
|
346
|
+
currency: 'USD',
|
|
347
|
+
mediaType: 'video',
|
|
348
|
+
winUrl: bidResponse.nurl,
|
|
349
|
+
adomain: bidResponse.adomain
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
let videoContext = bid.mediaTypes.video.context;
|
|
353
|
+
switch (videoContext) {
|
|
354
|
+
case OUTSTREAM:
|
|
355
|
+
videoBid.vastXml = bidResponse.adm;
|
|
356
|
+
break;
|
|
357
|
+
case INSTREAM:
|
|
358
|
+
videoBid.videoCacheKey = bidResponse.ext.bidder.cacheKey;
|
|
359
|
+
videoBid.vastUrl = bidResponse.ext.bidder.vastUrl;
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
return videoBid;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const getQueryVariable = (variable) => {
|
|
366
|
+
let query = window.location.search.substring(1);
|
|
367
|
+
let vars = query.split('&');
|
|
368
|
+
for (var i = 0; i < vars.length; i++) {
|
|
369
|
+
let pair = vars[i].split('=');
|
|
370
|
+
if (decodeURIComponent(pair[0]) == variable) {
|
|
371
|
+
return decodeURIComponent(pair[1]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export const spec = {
|
|
378
|
+
code: BIDDER_CODE,
|
|
379
|
+
|
|
380
|
+
aliases: [BIDDER_ALIAS],
|
|
381
|
+
|
|
382
|
+
supportedMediaTypes: SUPPORTED_MEDIA_TYPES,
|
|
383
|
+
|
|
384
|
+
isBidRequestValid: bid => !!bid.params.placement_id && !!bid.params.publisher_id && !!bid.params.partner_name,
|
|
385
|
+
|
|
386
|
+
buildRequests: function (validBidRequests, bidderRequest) {
|
|
387
|
+
let serverRequests = [];
|
|
388
|
+
|
|
389
|
+
// ORTB Request.
|
|
390
|
+
let ortbReq = createOrtbRequest(validBidRequests, bidderRequest);
|
|
391
|
+
|
|
392
|
+
validBidRequests.forEach((bid) => {
|
|
393
|
+
let imp = createOrtbImpObj(bid)
|
|
394
|
+
ortbReq.imp.push(imp);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
serverRequests.push({ ...createServerRequest(ortbReq, validBidRequests, getQueryVariable('dh_test')) });
|
|
398
|
+
|
|
399
|
+
return serverRequests;
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
interpretResponse: function (serverResponse, request) {
|
|
403
|
+
const { seatbid } = serverResponse.body;
|
|
404
|
+
let bids = request.bids;
|
|
405
|
+
let prebidResponse = [];
|
|
406
|
+
|
|
407
|
+
let seatBids = seatbid[0].bid;
|
|
408
|
+
|
|
409
|
+
seatBids.forEach(ortbResponseBid => {
|
|
410
|
+
let bidId = ortbResponseBid.impid;
|
|
411
|
+
let actualBid = find(bids, (bid) => bid.bidId === bidId);
|
|
412
|
+
let bidMediaType = ortbResponseBid.ext.prebid.type
|
|
413
|
+
switch (bidMediaType) {
|
|
414
|
+
case mediaTypes.BANNER:
|
|
415
|
+
prebidResponse.push(createPrebidBannerBid(actualBid, ortbResponseBid));
|
|
416
|
+
break;
|
|
417
|
+
case mediaTypes.NATIVE:
|
|
418
|
+
prebidResponse.push(createPrebidNativeBid(actualBid, ortbResponseBid));
|
|
419
|
+
break;
|
|
420
|
+
case mediaTypes.VIDEO:
|
|
421
|
+
prebidResponse.push(createPrebidVideoBid(actualBid, ortbResponseBid));
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
return prebidResponse;
|
|
426
|
+
},
|
|
427
|
+
|
|
428
|
+
onBidWon: function(bid) {
|
|
429
|
+
ajax(bid.winUrl, null, null, {
|
|
430
|
+
method: 'GET'
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
registerBidder(spec);
|
|
@@ -99,3 +99,7 @@ Dailyhunt bid adapter supports Banner, Native and Video.
|
|
|
99
99
|
}
|
|
100
100
|
];
|
|
101
101
|
```
|
|
102
|
+
|
|
103
|
+
## latest commit has all the required support for latest version of prebid above 6.x
|
|
104
|
+
## Dailyhunt adapter was there till 4.x and then removed in version 5.x of prebid.
|
|
105
|
+
## this doc has been also submitted to https://github.com/prebid/prebid.github.io
|
|
@@ -14,6 +14,13 @@ export const spec = {
|
|
|
14
14
|
const { placementId } = bid.params;
|
|
15
15
|
return !!placementId
|
|
16
16
|
},
|
|
17
|
+
isGdprConsentPresent: (bid) => {
|
|
18
|
+
const { gdpr, gdprConsent } = bid.params;
|
|
19
|
+
if (gdpr == '1') {
|
|
20
|
+
return !!gdprConsent
|
|
21
|
+
}
|
|
22
|
+
return true
|
|
23
|
+
},
|
|
17
24
|
buildRequests: (validBidRequests) => {
|
|
18
25
|
const serverRequests = [];
|
|
19
26
|
const { data } = config.getConfig('doceree.user')
|
|
@@ -21,7 +28,7 @@ export const spec = {
|
|
|
21
28
|
const encodedUserInfo = window.btoa(encodeURIComponent(JSON.stringify(data)))
|
|
22
29
|
|
|
23
30
|
validBidRequests.forEach(function(validBidRequest) {
|
|
24
|
-
const { publisherUrl, placementId } = validBidRequest.params;
|
|
31
|
+
const { publisherUrl, placementId, gdpr, gdprConsent } = validBidRequest.params;
|
|
25
32
|
const url = publisherUrl || page
|
|
26
33
|
let queryString = '';
|
|
27
34
|
queryString = tryAppendQueryString(queryString, 'id', placementId);
|
|
@@ -32,6 +39,8 @@ export const spec = {
|
|
|
32
39
|
queryString = tryAppendQueryString(queryString, 'prebidjs', true);
|
|
33
40
|
queryString = tryAppendQueryString(queryString, 'token', token);
|
|
34
41
|
queryString = tryAppendQueryString(queryString, 'requestId', validBidRequest.bidId);
|
|
42
|
+
queryString = tryAppendQueryString(queryString, 'gdpr', gdpr);
|
|
43
|
+
queryString = tryAppendQueryString(queryString, 'gdpr_consent', gdprConsent);
|
|
35
44
|
|
|
36
45
|
serverRequests.push({
|
|
37
46
|
method: 'GET',
|
|
@@ -25,6 +25,8 @@ var adUnits = [
|
|
|
25
25
|
params: {
|
|
26
26
|
placementId: 'DOC_7jm9j5eqkl0xvc5w', //required
|
|
27
27
|
publisherUrl: document.URL || window.location.href, //optional
|
|
28
|
+
gdpr: '1', //optional
|
|
29
|
+
gdprConsent:'CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g', //optional
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
]
|
|
@@ -8,7 +8,7 @@ const BIDDER_CODE = 'engageya';
|
|
|
8
8
|
const ENDPOINT_URL = 'https://recs.engageya.com/rec-api/getrecs.json';
|
|
9
9
|
const ENDPOINT_METHOD = 'GET';
|
|
10
10
|
const SUPPORTED_SIZES = [
|
|
11
|
-
[100, 75], [236, 202], [100, 100], [130, 130], [200, 200], [250, 250], [300, 272], [300, 250], [300, 230], [300, 214], [300, 187], [300, 166], [300, 150], [300, 133], [300, 120], [400, 200], [300, 200], [250, 377], [620, 410], [207, 311], [310, 166], [310, 333], [190, 106], [228, 132], [300, 174], [80, 60], [600, 500], [600, 600], [1080, 610], [1080, 610], [624, 350], [650, 1168], [1080, 1920], [300, 374]
|
|
11
|
+
[100, 75], [236, 202], [100, 100], [130, 130], [200, 200], [250, 250], [300, 272], [300, 250], [300, 230], [300, 214], [300, 187], [300, 166], [300, 150], [300, 133], [300, 120], [400, 200], [300, 200], [250, 377], [620, 410], [207, 311], [310, 166], [310, 333], [190, 106], [228, 132], [300, 174], [80, 60], [600, 500], [600, 600], [1080, 610], [1080, 610], [624, 350], [650, 1168], [1080, 1920], [300, 374], [336, 280]
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
function getPageUrl(bidRequest, bidderRequest) {
|
|
@@ -176,13 +176,13 @@ function isMediaTypesEmpty(mediaTypes) {
|
|
|
176
176
|
* @return {FeedAdApiBidRequest}
|
|
177
177
|
*/
|
|
178
178
|
function createApiBidRParams(request) {
|
|
179
|
-
return {
|
|
179
|
+
return Object.assign({}, request.params, {
|
|
180
180
|
ad_type: 0,
|
|
181
181
|
client_token: request.params.clientToken,
|
|
182
182
|
placement_id: request.params.placementId,
|
|
183
183
|
sdk_version: `prebid_${VERSION}`,
|
|
184
184
|
app_hybrid: false,
|
|
185
|
-
};
|
|
185
|
+
});
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/**
|
|
@@ -26,6 +26,7 @@ Prebid.JS adapter that connects to the FeedAd demand sources.
|
|
|
26
26
|
params: {
|
|
27
27
|
clientToken: 'your-client-token' // see below for more info
|
|
28
28
|
placementId: 'your-placement-id' // see below for more info
|
|
29
|
+
decoration: 'decoration parameters' // optional, see below for info
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
]
|
|
@@ -35,7 +36,8 @@ Prebid.JS adapter that connects to the FeedAd demand sources.
|
|
|
35
36
|
|
|
36
37
|
# Required Parameters
|
|
37
38
|
|
|
38
|
-
| Parameter
|
|
39
|
-
|
|
39
|
+
| Parameter | Description |
|
|
40
|
+
|---------------| ----------- |
|
|
40
41
|
| `clientToken` | Your FeedAd web client token. You can view your client token inside the FeedAd admin panel. |
|
|
41
42
|
| `placementId` | You can choose placement IDs yourself. A placement ID should be named after the ad position inside your product. For example, if you want to display an ad inside a list of news articles, you could name it "ad-news-overview".<br> A placement ID may consist of lowercase `a-z`, `0-9`, `-` and `_`. You do not have to manually create the placement IDs before using them. Just specify them within the code, and they will appear in the FeedAd admin panel after the first request. <br> [Learn more](/concept/feed_ad/index.html) about Placement IDs and how they are grouped to play the same Creative. |
|
|
43
|
+
| `decoration` | Optional. If you want to apply a [decoration](https://docs.feedad.com/web/feed_ad/#decorations) to the ad.
|
|
@@ -40,28 +40,21 @@ export const spec = {
|
|
|
40
40
|
* @returns {ServerRequest}
|
|
41
41
|
*/
|
|
42
42
|
buildRequests: (validBidRequests, bidderRequest) => {
|
|
43
|
-
const demo = config.getConfig('glimpse.demo') || false
|
|
44
|
-
const account = config.getConfig('glimpse.account') || -1
|
|
45
|
-
const demand = config.getConfig('glimpse.demand') || 'glimpse'
|
|
46
|
-
const keywords = config.getConfig('glimpse.keywords') || {}
|
|
47
|
-
|
|
48
43
|
const auth = getVaultJwt()
|
|
49
44
|
const referer = getReferer(bidderRequest)
|
|
50
45
|
const gdprConsent = getGdprConsentChoice(bidderRequest)
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
})
|
|
46
|
+
const bidRequests = validBidRequests.map(processBidRequest)
|
|
47
|
+
const firstPartyData = getFirstPartyData()
|
|
54
48
|
|
|
55
49
|
const data = {
|
|
56
50
|
auth,
|
|
57
51
|
data: {
|
|
58
|
-
bidderCode: spec.code,
|
|
59
|
-
demo,
|
|
60
|
-
account,
|
|
61
|
-
demand,
|
|
62
52
|
referer,
|
|
63
53
|
gdprConsent,
|
|
64
|
-
|
|
54
|
+
bidRequests,
|
|
55
|
+
site: firstPartyData.site,
|
|
56
|
+
user: firstPartyData.user,
|
|
57
|
+
bidderCode: spec.code,
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
|
|
@@ -91,35 +84,12 @@ export const spec = {
|
|
|
91
84
|
},
|
|
92
85
|
}
|
|
93
86
|
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
const bidKeywords = bidRequest.params.keywords || {}
|
|
97
|
-
const keywords = {
|
|
98
|
-
...globalKeywords,
|
|
99
|
-
...bidKeywords,
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
unitCode: bidRequest.adUnitCode,
|
|
104
|
-
bidId: bidRequest.bidId,
|
|
105
|
-
placementId: bidRequest.params.placementId,
|
|
106
|
-
keywords,
|
|
107
|
-
sizes,
|
|
108
|
-
}
|
|
87
|
+
function setVaultJwt(auth) {
|
|
88
|
+
storageManager.setDataInLocalStorage(LOCAL_STORAGE_KEY.vault.jwt, auth)
|
|
109
89
|
}
|
|
110
90
|
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
isArray(sizes) &&
|
|
114
|
-
sizes.length === 2 &&
|
|
115
|
-
!isArray(sizes[0]) &&
|
|
116
|
-
!isArray(sizes[1])
|
|
117
|
-
|
|
118
|
-
if (isSingleSize) {
|
|
119
|
-
return [sizes]
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return sizes
|
|
91
|
+
function getVaultJwt() {
|
|
92
|
+
return storageManager.getDataFromLocalStorage(LOCAL_STORAGE_KEY.vault.jwt) || ''
|
|
123
93
|
}
|
|
124
94
|
|
|
125
95
|
function getReferer(bidderRequest) {
|
|
@@ -158,12 +128,64 @@ function getGdprConsentChoice(bidderRequest) {
|
|
|
158
128
|
}
|
|
159
129
|
}
|
|
160
130
|
|
|
161
|
-
function
|
|
162
|
-
|
|
131
|
+
function processBidRequest(bidRequest) {
|
|
132
|
+
const demand = bidRequest.params.demand || 'glimpse'
|
|
133
|
+
const sizes = normalizeSizes(bidRequest.sizes)
|
|
134
|
+
const keywords = bidRequest.params.keywords || {}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
demand,
|
|
138
|
+
sizes,
|
|
139
|
+
keywords,
|
|
140
|
+
bidId: bidRequest.bidId,
|
|
141
|
+
placementId: bidRequest.params.placementId,
|
|
142
|
+
unitCode: bidRequest.adUnitCode,
|
|
143
|
+
}
|
|
163
144
|
}
|
|
164
145
|
|
|
165
|
-
function
|
|
166
|
-
|
|
146
|
+
function normalizeSizes(sizes) {
|
|
147
|
+
const isSingleSize =
|
|
148
|
+
isArray(sizes) &&
|
|
149
|
+
sizes.length === 2 &&
|
|
150
|
+
!isArray(sizes[0]) &&
|
|
151
|
+
!isArray(sizes[1])
|
|
152
|
+
|
|
153
|
+
if (isSingleSize) {
|
|
154
|
+
return [sizes]
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return sizes
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getFirstPartyData() {
|
|
161
|
+
const siteKeywords = parseGlobalKeywords('site')
|
|
162
|
+
const userKeywords = parseGlobalKeywords('user')
|
|
163
|
+
|
|
164
|
+
const siteAttributes = getConfig('ortb2.site.ext.data', {})
|
|
165
|
+
const userAttributes = getConfig('ortb2.user.ext.data', {})
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
site: {
|
|
169
|
+
keywords: siteKeywords,
|
|
170
|
+
attributes: siteAttributes,
|
|
171
|
+
},
|
|
172
|
+
user: {
|
|
173
|
+
keywords: userKeywords,
|
|
174
|
+
attributes: userAttributes,
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function parseGlobalKeywords(scope) {
|
|
180
|
+
const keywords = getConfig(`ortb2.${scope}.keywords`, '')
|
|
181
|
+
|
|
182
|
+
return keywords
|
|
183
|
+
.split(', ')
|
|
184
|
+
.filter((keyword) => keyword !== '')
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function getConfig(path, defaultValue) {
|
|
188
|
+
return config.getConfig(path) || defaultValue
|
|
167
189
|
}
|
|
168
190
|
|
|
169
191
|
function isValidBidResponse(bidResponse) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _each, parseSizesInput, isEmpty } from '../src/utils.js';
|
|
2
1
|
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import { _each, isEmpty, parseSizesInput } from '../src/utils.js';
|
|
3
3
|
import { BANNER } from '../src/mediaTypes.js';
|
|
4
4
|
|
|
5
5
|
const BIDDER_CODE = 'gnet';
|
|
6
|
-
const ENDPOINT = 'https://
|
|
6
|
+
const ENDPOINT = 'https://service.gnetrtb.com/api/adrequest';
|
|
7
7
|
|
|
8
8
|
export const spec = {
|
|
9
9
|
code: BIDDER_CODE,
|
|
@@ -16,7 +16,7 @@ export const spec = {
|
|
|
16
16
|
* @return boolean True if this is a valid bid, and false otherwise.
|
|
17
17
|
*/
|
|
18
18
|
isBidRequestValid: function (bid) {
|
|
19
|
-
return !!(bid.params.websiteId);
|
|
19
|
+
return !!(bid.params.websiteId && bid.params.adunitId);
|
|
20
20
|
},
|
|
21
21
|
|
|
22
22
|
/**
|