prebid.js 6.5.0 → 6.9.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.
Files changed (139) hide show
  1. package/.eslintrc.js +8 -1
  2. package/integrationExamples/gpt/amp/creative.html +11 -33
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
  4. package/integrationExamples/gpt/x-domain/creative.html +63 -29
  5. package/modules/.submodules.json +2 -1
  6. package/modules/adagioBidAdapter.js +0 -8
  7. package/modules/adagioBidAdapter.md +1 -1
  8. package/modules/adbookpspBidAdapter.js +27 -10
  9. package/modules/adhashBidAdapter.js +3 -3
  10. package/modules/adkernelBidAdapter.js +2 -1
  11. package/modules/admanBidAdapter.js +10 -4
  12. package/modules/adomikAnalyticsAdapter.js +23 -11
  13. package/modules/adqueryIdSystem.js +103 -0
  14. package/modules/adqueryIdSystem.md +35 -0
  15. package/modules/appnexusBidAdapter.js +14 -2
  16. package/modules/asealBidAdapter.js +58 -0
  17. package/modules/asealBidAdapter.md +52 -0
  18. package/modules/bliinkBidAdapter.js +2 -1
  19. package/modules/brandmetricsRtdProvider.js +168 -0
  20. package/modules/brandmetricsRtdProvider.md +40 -0
  21. package/modules/colossussspBidAdapter.js +12 -8
  22. package/modules/colossussspBidAdapter.md +15 -1
  23. package/modules/compassBidAdapter.js +10 -3
  24. package/modules/consumableBidAdapter.md +1 -1
  25. package/modules/conversantBidAdapter.js +7 -0
  26. package/modules/criteoBidAdapter.js +10 -1
  27. package/modules/criteoIdSystem.js +29 -7
  28. package/modules/currency.js +26 -1
  29. package/modules/displayioBidAdapter.js +157 -0
  30. package/modules/displayioBidAdapter.md +148 -0
  31. package/modules/e_volutionBidAdapter.js +158 -0
  32. package/modules/glimpseBidAdapter.js +66 -44
  33. package/modules/gnetBidAdapter.js +3 -3
  34. package/modules/gnetBidAdapter.md +4 -4
  35. package/modules/gumgumBidAdapter.js +56 -42
  36. package/modules/idImportLibrary.js +45 -8
  37. package/modules/idImportLibrary.md +4 -0
  38. package/modules/improvedigitalBidAdapter.js +29 -2
  39. package/modules/interactiveOffersBidAdapter.js +9 -6
  40. package/modules/jwplayerRtdProvider.js +71 -6
  41. package/modules/jwplayerRtdProvider.md +27 -11
  42. package/modules/kargoBidAdapter.js +2 -2
  43. package/modules/lunamediahbBidAdapter.js +32 -4
  44. package/modules/nextMillenniumBidAdapter.js +3 -1
  45. package/modules/oguryBidAdapter.js +14 -14
  46. package/modules/onetagBidAdapter.js +4 -2
  47. package/modules/pilotxBidAdapter.js +147 -0
  48. package/modules/pilotxBidAdapter.md +50 -0
  49. package/modules/priceFloors.js +2 -1
  50. package/modules/proxistoreBidAdapter.js +0 -2
  51. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  52. package/modules/richaudienceBidAdapter.js +10 -4
  53. package/modules/riseBidAdapter.js +18 -7
  54. package/modules/rtbhouseBidAdapter.js +14 -4
  55. package/modules/rtdModule/index.js +14 -15
  56. package/modules/rubiconAnalyticsAdapter.js +8 -2
  57. package/modules/seedingAllianceBidAdapter.js +3 -3
  58. package/modules/sharethroughBidAdapter.js +12 -17
  59. package/modules/showheroes-bsBidAdapter.js +13 -2
  60. package/modules/sortableAnalyticsAdapter.js +5 -4
  61. package/modules/sovrnBidAdapter.js +93 -18
  62. package/modules/sovrnBidAdapter.md +80 -2
  63. package/modules/synacormediaBidAdapter.js +31 -10
  64. package/modules/tappxBidAdapter.js +8 -5
  65. package/modules/teadsBidAdapter.js +1 -2
  66. package/modules/undertoneBidAdapter.js +17 -1
  67. package/modules/userId/eids.js +7 -1
  68. package/modules/userId/userId.md +8 -0
  69. package/modules/viewability.js +177 -0
  70. package/modules/viewability.md +87 -0
  71. package/modules/weboramaRtdProvider.js +264 -34
  72. package/modules/weboramaRtdProvider.md +110 -40
  73. package/modules/welectBidAdapter.js +106 -0
  74. package/modules/yahoosspBidAdapter.js +2 -0
  75. package/package.json +2 -1
  76. package/src/adRendering.js +38 -0
  77. package/src/adloader.js +2 -1
  78. package/src/auction.js +103 -73
  79. package/src/bidderSettings.js +69 -0
  80. package/src/hook.js +5 -1
  81. package/src/prebid.js +19 -21
  82. package/src/secureCreatives.js +131 -47
  83. package/src/targeting.js +3 -2
  84. package/src/utils.js +13 -10
  85. package/test/helpers/syncPromise.js +71 -0
  86. package/test/spec/auctionmanager_spec.js +179 -15
  87. package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
  88. package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
  89. package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
  90. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  91. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  92. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  93. package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
  94. package/test/spec/modules/asealBidAdapter_spec.js +144 -0
  95. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  96. package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
  97. package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
  98. package/test/spec/modules/compassBidAdapter_spec.js +1 -0
  99. package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
  100. package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
  101. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  102. package/test/spec/modules/currency_spec.js +21 -6
  103. package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
  104. package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
  105. package/test/spec/modules/eids_spec.js +15 -0
  106. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  107. package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
  108. package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
  109. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  110. package/test/spec/modules/improvedigitalBidAdapter_spec.js +61 -0
  111. package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
  112. package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
  113. package/test/spec/modules/loglyliftBidAdapter_spec.js +1 -1
  114. package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
  115. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
  116. package/test/spec/modules/oguryBidAdapter_spec.js +69 -3
  117. package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
  118. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  119. package/test/spec/modules/realTimeDataModule_spec.js +67 -5
  120. package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
  121. package/test/spec/modules/riseBidAdapter_spec.js +31 -5
  122. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  123. package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
  124. package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
  125. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  126. package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
  127. package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
  128. package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
  129. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  130. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  131. package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
  132. package/test/spec/modules/userId_spec.js +68 -19
  133. package/test/spec/modules/viewability_spec.js +280 -0
  134. package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
  135. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  136. package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
  137. package/test/spec/unit/core/bidderSettings_spec.js +123 -0
  138. package/test/spec/unit/pbjs_api_spec.js +21 -8
  139. package/test/spec/unit/secureCreatives_spec.js +143 -24
@@ -7,27 +7,42 @@
7
7
  * @requires module:modules/realTimeData
8
8
  */
9
9
 
10
+ /** onData callback type
11
+ * @callback dataCallback
12
+ * @param {Object} data profile data
13
+ * @param {Boolean} site true if site, else it is user
14
+ * @returns {void}
15
+ */
16
+
10
17
  /**
11
18
  * @typedef {Object} ModuleParams
12
- * @property {WeboCtxConf} weboCtxConf
13
- * @property {WeboUserDataConf} weboUserDataConf
19
+ * @property {?Boolean} setPrebidTargeting if true, will set the GAM targeting (default undefined)
20
+ * @property {?Boolean} sendToBidders if true, will send the contextual profile to all bidders (default undefined)
21
+ * @property {?dataCallback} onData callback
22
+ * @property {?WeboCtxConf} weboCtxConf
23
+ * @property {?WeboUserDataConf} weboUserDataConf
14
24
  */
15
25
 
16
26
  /**
17
27
  * @typedef {Object} WeboCtxConf
18
28
  * @property {string} token required token to be used on bigsea contextual API requests
19
29
  * @property {?string} targetURL specify the target url instead use the referer
20
- * @property {?Boolean} setPrebidTargeting if true will set the GAM targeting (default true)
21
- * @property {?Boolean} sendToBidders if true, will send the contextual profile to all bidders (default true)
30
+ * @property {?Boolean} setPrebidTargeting if true, will set the GAM targeting (default params.setPrebidTargeting or true)
31
+ * @property {?Boolean} sendToBidders if true, will send the contextual profile to all bidders (default params.sendToBidders or true)
32
+ * @property {?dataCallback} onData callback
22
33
  * @property {?object} defaultProfile to be used if the profile is not found
34
+ * @property {?Boolean} enabled if false, will ignore this configuration
23
35
  */
24
36
 
25
37
  /**
26
38
  * @typedef {Object} WeboUserDataConf
27
- * @property {?string} localStorageProfileKey can be used to customize the local storage key (default is 'webo_wam2gam_entry')
28
- * @property {?Boolean} setPrebidTargeting if true will set the GAM targeting (default true)
29
- * @property {?Boolean} sendToBidders if true, will send the contextual profile to all bidders (default true)
39
+ * @property {?number} accountId wam account id
40
+ * @property {?Boolean} setPrebidTargeting if true, will set the GAM targeting (default params.setPrebidTargeting or true)
41
+ * @property {?Boolean} sendToBidders if true, will send the user-centric profile to all bidders (default params.sendToBidders or true)
30
42
  * @property {?object} defaultProfile to be used if the profile is not found
43
+ * @property {?dataCallback} onData callback
44
+ * @property {?string} localStorageProfileKey can be used to customize the local storage key (default is 'webo_wam2gam_entry')
45
+ * @property {?Boolean} enabled if false, will ignore this configuration
31
46
  */
32
47
 
33
48
  import {
@@ -39,8 +54,10 @@ import {
39
54
  isEmpty,
40
55
  mergeDeep,
41
56
  logError,
57
+ logWarn,
42
58
  tryAppendQueryString,
43
- logMessage
59
+ logMessage,
60
+ isFn
44
61
  } from '../src/utils.js';
45
62
  import {
46
63
  submodule
@@ -86,40 +103,88 @@ let _weboUserDataInitialized = false;
86
103
  function init(moduleConfig) {
87
104
  moduleConfig = moduleConfig || {};
88
105
  const moduleParams = moduleConfig.params || {};
89
- const weboCtxConf = moduleParams.weboCtxConf || {};
106
+ const weboCtxConf = moduleParams.weboCtxConf;
90
107
  const weboUserDataConf = moduleParams.weboUserDataConf;
91
108
 
92
- _weboCtxInitialized = initWeboCtx(weboCtxConf);
93
- _weboUserDataInitialized = initWeboUserData(weboUserDataConf);
109
+ _weboCtxInitialized = initWeboCtx(moduleParams, weboCtxConf);
110
+ _weboUserDataInitialized = initWeboUserData(moduleParams, weboUserDataConf);
94
111
 
95
112
  return _weboCtxInitialized || _weboUserDataInitialized;
96
113
  }
97
114
 
98
115
  /** Initialize contextual sub module
116
+ * @param {ModuleParams} moduleParams
99
117
  * @param {WeboCtxConf} weboCtxConf
100
118
  * @return {Boolean} true if sub module was initialized with success
101
119
  */
102
- function initWeboCtx(weboCtxConf) {
120
+ function initWeboCtx(moduleParams, weboCtxConf) {
121
+ if (!weboCtxConf || weboCtxConf.enabled === false) {
122
+ moduleParams.weboCtxConf = null;
123
+
124
+ return false
125
+ }
126
+
127
+ normalizeConf(moduleParams, weboCtxConf);
128
+
103
129
  _weboCtxInitialized = false;
104
130
  _weboContextualProfile = null;
105
131
 
106
132
  if (!weboCtxConf.token) {
107
- logError('missing param "token" for weborama contextual sub module initialization');
133
+ logWarn('missing param "token" for weborama contextual sub module initialization');
108
134
  return false;
109
135
  }
110
136
 
137
+ logMessage('weborama contextual intialized with success');
138
+
111
139
  return true;
112
140
  }
113
141
 
114
142
  /** Initialize weboUserData sub module
143
+ * @param {ModuleParams} moduleParams
115
144
  * @param {WeboUserDataConf} weboUserDataConf
116
145
  * @return {Boolean} true if sub module was initialized with success
117
146
  */
118
- function initWeboUserData(weboUserDataConf) {
147
+ function initWeboUserData(moduleParams, weboUserDataConf) {
148
+ if (!weboUserDataConf || weboUserDataConf.enabled === false) {
149
+ moduleParams.weboUserDataConf = null;
150
+
151
+ return false;
152
+ }
153
+
154
+ normalizeConf(moduleParams, weboUserDataConf);
155
+
119
156
  _weboUserDataInitialized = false;
120
157
  _weboUserDataUserProfile = null;
121
158
 
122
- return !!weboUserDataConf;
159
+ let message = 'weborama user-centric intialized with success';
160
+ if (weboUserDataConf.hasOwnProperty('accountId')) {
161
+ message = `weborama user-centric intialized with success for account: ${weboUserDataConf.accountId}`;
162
+ }
163
+
164
+ logMessage(message);
165
+
166
+ return true;
167
+ }
168
+
169
+ /** @type {Object} */
170
+ const globalDefaults = {
171
+ setPrebidTargeting: true,
172
+ sendToBidders: true,
173
+ onData: (data, kind, def) => logMessage('onData(data,kind,default)', data, kind, def),
174
+ }
175
+
176
+ /** normalize submodule configuration
177
+ * @param {ModuleParams} moduleParams
178
+ * @param {WeboCtxConf|WeboUserDataConf} submoduleParams
179
+ * @return {void}
180
+ */
181
+ function normalizeConf(moduleParams, submoduleParams) {
182
+ Object.entries(globalDefaults).forEach(([propertyName, globalDefaultValue]) => {
183
+ if (!submoduleParams.hasOwnProperty(propertyName)) {
184
+ const hasModuleParam = moduleParams.hasOwnProperty(propertyName);
185
+ submoduleParams[propertyName] = (hasModuleParam) ? moduleParams[propertyName] : globalDefaultValue;
186
+ }
187
+ })
123
188
  }
124
189
 
125
190
  /** function that provides ad server targeting data to RTD-core
@@ -132,8 +197,8 @@ function getTargetingData(adUnitsCodes, moduleConfig) {
132
197
  const moduleParams = moduleConfig.params || {};
133
198
  const weboCtxConf = moduleParams.weboCtxConf || {};
134
199
  const weboUserDataConf = moduleParams.weboUserDataConf || {};
135
- const weboCtxConfTargeting = weboCtxConf.setPrebidTargeting !== false;
136
- const weboUserDataConfTargeting = weboUserDataConf.setPrebidTargeting !== false;
200
+ const weboCtxConfTargeting = weboCtxConf.setPrebidTargeting;
201
+ const weboUserDataConfTargeting = weboUserDataConf.setPrebidTargeting;
137
202
 
138
203
  try {
139
204
  const profile = getCompleteProfile(moduleParams, weboCtxConfTargeting, weboUserDataConfTargeting);
@@ -250,21 +315,79 @@ export function getBidRequestData(reqBidsConfigObj, onDone, moduleConfig) {
250
315
  function handleBidRequestData(adUnits, moduleParams) {
251
316
  const weboCtxConf = moduleParams.weboCtxConf || {};
252
317
  const weboUserDataConf = moduleParams.weboUserDataConf || {};
253
- const weboCtxConfTargeting = weboCtxConf.sendToBidders !== false;
254
- const weboUserDataConfTargeting = weboUserDataConf.sendToBidders !== false;
255
- const profile = getCompleteProfile(moduleParams, weboCtxConfTargeting, weboUserDataConfTargeting);
318
+ const weboCtxConfTargeting = weboCtxConf.sendToBidders;
319
+ const weboUserDataConfTargeting = weboUserDataConf.sendToBidders;
256
320
 
257
- if (isEmpty(profile)) {
258
- return;
321
+ if (weboCtxConfTargeting) {
322
+ const contextualProfile = getContextualProfile(weboCtxConf);
323
+ if (!isEmpty(contextualProfile)) {
324
+ setBidRequestProfile(adUnits, contextualProfile, true);
325
+ }
326
+ }
327
+
328
+ if (weboUserDataConfTargeting) {
329
+ const weboUserDataProfile = getWeboUserDataProfile(weboUserDataConf);
330
+ if (!isEmpty(weboUserDataProfile)) {
331
+ setBidRequestProfile(adUnits, weboUserDataProfile, false);
332
+ }
259
333
  }
260
334
 
335
+ handleOnData(weboCtxConf, weboUserDataConf);
336
+ }
337
+
338
+ /** function that handle with onData callbacks
339
+ * @param {WeboCtxConf} weboCtxConf
340
+ * @param {WeboUserDataConf} weboUserDataConf
341
+ */
342
+
343
+ function handleOnData(weboCtxConf, weboUserDataConf) {
344
+ const callbacks = [{
345
+ onData: weboCtxConf.onData,
346
+ fetchData: () => getContextualProfile(weboCtxConf),
347
+ site: true,
348
+ }, {
349
+ onData: weboUserDataConf.onData,
350
+ fetchData: () => getWeboUserDataProfile(weboUserDataConf),
351
+ site: false,
352
+ }];
353
+
354
+ callbacks.filter(obj => isFn(obj.onData)).forEach(obj => {
355
+ try {
356
+ const data = obj.fetchData();
357
+ obj.onData(data, obj.site);
358
+ } catch (e) {
359
+ const kind = (obj.site) ? 'site' : 'user';
360
+ logError(`error while executure onData callback with ${kind}-based data:`, e);
361
+ }
362
+ });
363
+ }
364
+
365
+ /** function that set bid request data on each segment (site or user centric)
366
+ * @param {Object[]} adUnits
367
+ * @param {Object} profile
368
+ * @param {Boolean} site true if site centric, else it is user centric
369
+ * @returns {void}
370
+ */
371
+ function setBidRequestProfile(adUnits, profile, site) {
372
+ setGlobalOrtb2(profile, site);
373
+
261
374
  adUnits.forEach(adUnit => {
262
375
  if (adUnit.hasOwnProperty('bids')) {
263
- adUnit.bids.forEach(bid => handleBid(adUnit, profile, bid));
376
+ const adUnitCode = adUnit.code || 'no code';
377
+ adUnit.bids.forEach(bid => handleBid(adUnitCode, profile, site, bid));
264
378
  }
265
379
  });
266
380
  }
267
381
 
382
+ /** @type {string} */
383
+ const APPNEXUS = 'appnexus';
384
+
385
+ /** @type {string} */
386
+ const PUBMATIC = 'pubmatic';
387
+
388
+ /** @type {string} */
389
+ const RUBICON = 'rubicon';
390
+
268
391
  /** @type {string} */
269
392
  const SMARTADSERVER = 'smartadserver';
270
393
 
@@ -272,35 +395,143 @@ const SMARTADSERVER = 'smartadserver';
272
395
  const bidderAliasRegistry = adapterManager.aliasRegistry || {};
273
396
 
274
397
  /** handle individual bid
275
- * @param {Object} adUnit
398
+ * @param {string} adUnitCode
276
399
  * @param {Object} profile
400
+ * @param {Boolean} site true if site centric, else it is user centric
277
401
  * @param {Object} bid
278
402
  * @returns {void}
279
403
  */
280
- function handleBid(adUnit, profile, bid) {
404
+ function handleBid(adUnitCode, profile, site, bid) {
281
405
  const bidder = bidderAliasRegistry[bid.bidder] || bid.bidder;
282
406
 
283
- logMessage('handle bidder', bidder, bid);
407
+ logMessage(`handling on adunit '${adUnitCode}', bidder '${bidder}' and bid`, bid);
284
408
 
285
409
  switch (bidder) {
410
+ case APPNEXUS:
411
+ handleAppnexusBid(profile, bid);
412
+
413
+ break;
414
+
415
+ case PUBMATIC:
416
+ handlePubmaticBid(profile, bid);
417
+
418
+ break;
419
+
286
420
  case SMARTADSERVER:
287
- handleSmartadserverBid(adUnit, profile, bid);
421
+ handleSmartadserverBid(profile, bid);
288
422
 
289
423
  break;
424
+ case RUBICON:
425
+ handleRubiconBid(profile, site, bid);
426
+
427
+ break;
428
+ default:
429
+ logMessage(`unsupported bidder '${bidder}', trying via bidder ortb2 fpd`);
430
+ const section = ((site) ? 'site' : 'user');
431
+ const base = `ortb2.${section}.ext.data`;
432
+
433
+ assignProfileToObject(bid, base, profile);
434
+ }
435
+ }
436
+
437
+ /**
438
+ * set ortb2 global data
439
+ * @param {Object} profile
440
+ * @param {Boolean} site
441
+ * @returns {void}
442
+ */
443
+ function setGlobalOrtb2(profile, site) {
444
+ const section = ((site) ? 'site' : 'user');
445
+ const base = `${section}.ext.data`;
446
+ const addOrtb2 = {};
447
+
448
+ assignProfileToObject(addOrtb2, base, profile);
449
+
450
+ if (!isEmpty(addOrtb2)) {
451
+ const testGlobal = getGlobal().getConfig('ortb2') || {};
452
+ const ortb2 = {
453
+ ortb2: mergeDeep({}, testGlobal, addOrtb2)
454
+ };
455
+ getGlobal().setConfig(ortb2);
456
+ }
457
+ }
458
+
459
+ /**
460
+ * assign profile to object
461
+ * @param {Object} destination
462
+ * @param {string} base
463
+ * @param {Object} profile
464
+ * @returns {void}
465
+ */
466
+ function assignProfileToObject(destination, base, profile) {
467
+ Object.keys(profile).forEach(key => {
468
+ const path = `${base}.${key}`;
469
+ deepSetValue(destination, path, profile[key])
470
+ })
471
+ }
472
+
473
+ /** handle rubicon bid
474
+ * @param {Object} profile
475
+ * @param {Boolean} site
476
+ * @param {Object} bid
477
+ * @returns {void}
478
+ */
479
+ function handleRubiconBid(profile, site, bid) {
480
+ const section = (site) ? 'inventory' : 'visitor';
481
+ const base = `params.${section}`;
482
+ assignProfileToObject(bid, base, profile);
483
+ }
484
+
485
+ /** handle appnexus/xandr bid
486
+ * @param {Object} profile
487
+ * @param {Object} bid
488
+ * @returns {void}
489
+ */
490
+ function handleAppnexusBid(profile, bid) {
491
+ const base = 'params.keywords';
492
+ assignProfileToObject(bid, base, profile);
493
+ }
494
+
495
+ /** handle pubmatic bid
496
+ * @param {Object} profile
497
+ * @param {Object} bid
498
+ * @returns {void}
499
+ */
500
+ function handlePubmaticBid(profile, bid) {
501
+ const sep = '|';
502
+ const subsep = ',';
503
+ const bidKey = 'params.dctr';
504
+ const target = [];
505
+
506
+ const data = deepAccess(bid, bidKey);
507
+ if (data) {
508
+ data.split(sep).forEach(t => target.push(t));
290
509
  }
510
+
511
+ Object.keys(profile).forEach(key => {
512
+ const value = profile[key].join(subsep);
513
+ const keyword = `${key}=${value}`;
514
+ if (target.indexOf(keyword) === -1) {
515
+ target.push(keyword);
516
+ }
517
+ });
518
+
519
+ deepSetValue(bid, bidKey, target.join(sep));
291
520
  }
292
521
 
293
522
  /** handle smartadserver bid
294
- * @param {Object} adUnit
295
523
  * @param {Object} profile
296
524
  * @param {Object} bid
297
525
  * @returns {void}
298
526
  */
299
- function handleSmartadserverBid(adUnit, profile, bid) {
527
+ function handleSmartadserverBid(profile, bid) {
528
+ const sep = ';';
529
+ const bidKey = 'params.target';
300
530
  const target = [];
301
531
 
302
- if (deepAccess(bid, 'params.target')) {
303
- target.push(bid.params.target.split(';'));
532
+ const data = deepAccess(bid, bidKey);
533
+ if (data) {
534
+ data.split(sep).forEach(t => target.push(t));
304
535
  }
305
536
 
306
537
  Object.keys(profile).forEach(key => {
@@ -311,8 +542,7 @@ function handleSmartadserverBid(adUnit, profile, bid) {
311
542
  }
312
543
  });
313
544
  });
314
-
315
- deepSetValue(bid, 'params.target', target.join(';'));
545
+ deepSetValue(bid, bidKey, target.join(sep));
316
546
  }
317
547
 
318
548
  /** set bigsea contextual profile on module state
@@ -350,7 +580,7 @@ function fetchContextualProfile(weboCtxConf, onSuccess, onDone) {
350
580
  queryString = tryAppendQueryString(queryString, 'token', token);
351
581
  queryString = tryAppendQueryString(queryString, 'url', targetURL);
352
582
 
353
- const url = 'https://ctx.weborama.com/api/profile?' + queryString;
583
+ const url = `https://ctx.weborama.com/api/profile?${queryString}`;
354
584
 
355
585
  ajax(url, {
356
586
  success: function(response, req) {
@@ -21,40 +21,51 @@ Compile the Weborama RTD module into your Prebid build:
21
21
  Add the Weborama RTD provider to your Prebid config.
22
22
 
23
23
  ```javascript
24
- pbjs.setConfig(
25
- ...
26
- realTimeData: {
27
- auctionDelay: 1000,
28
- dataProviders: [
29
- {
24
+ var pbjs = pbjs || {};
25
+ pbjs.que = pbjs.que || [];
26
+
27
+ pbjs.que.push(function () {
28
+ pbjs.setConfig({
29
+ debug: true,
30
+ realTimeData: {
31
+ auctionDelay: 1000,
32
+ dataProviders: [{
30
33
  name: "weborama",
31
34
  waitForIt: true,
32
35
  params: {
33
- weboCtxConf: { // contextual configuration
34
- token: "<<provided by weborama>>", // mandatory
35
- targetURL: "...", // default is document.URL
36
- setPrebidTargeting: true, // default
37
- sendToBidders: true, // default
38
- defaultProfile: { // optional, default is none
39
- webo_ctx: ['foo'],
40
- webo_ds: ['bar']
41
- }
36
+ setPrebidTargeting: true, // optional
37
+ sendToBidders: true, // optional
38
+ onData: function(data, site){ // optional
39
+ var kind = (site)? 'site' : 'user';
40
+ console.log('onData', kind, data);
42
41
  },
43
- weboUserDataConf: { // user-centric configuration
44
- setPrebidTargeting: true, // default
45
- sendToBidders: true, // default
46
- defaultProfile: { // optional, default is none
47
- webo_cs: ['baz'],
48
- webo_audiences: ['bam']
49
- },
50
- localStorageProfileKey: 'webo_wam2gam_entry' // default
42
+ weboCtxConf: {
43
+ token: "to-be-defined", // mandatory
44
+ targetURL: "https://prebid.org", // default is document.URL
45
+ setPrebidTargeting: true, // override param.setPrebidTargeting or default true
46
+ sendToBidders: true, // override param.sendToBidders or default true
47
+ defaultProfile: { // optional
48
+ webo_ctx: ['moon'],
49
+ webo_ds: ['bar']
50
+ }
51
+ //, onData: function (data, ...) { ...}
52
+ },
53
+ weboUserDataConf: {
54
+ accountId: 12345, // optional, used for logging
55
+ setPrebidTargeting: true, // override param.setPrebidTargeting or default true
56
+ sendToBidders: true, // override param.sendToBidders or default true
57
+ defaultProfile: { // optional
58
+ webo_cs: ['Red'],
59
+ webo_audiences: ['bam']
60
+ },
61
+ localStorageProfileKey: 'webo_wam2gam_entry' // default
62
+ //, onData: function (data, ...) { ...}
51
63
  }
52
64
  }
53
- }
54
- ]
55
- }
56
- ...
57
- );
65
+ }]
66
+ }
67
+ });
68
+ });
58
69
  ```
59
70
 
60
71
  ### Parameter Descriptions for the Weborama Configuration Section
@@ -64,23 +75,82 @@ pbjs.setConfig(
64
75
  | name | String | Real time data module name | Mandatory. Always 'Weborama' |
65
76
  | waitForIt | Boolean | Mandatory. Required to ensure that the auction is delayed until prefetch is complete | Optional. Defaults to false but recommended to true |
66
77
  | params | Object | | Optional |
67
- | params.weboCtxConf | Object | Weborama Contextual Configuration | Optional |
68
- | params.weboCtxConf.token | String | Security Token provided by Weborama, unique per client | Mandatory |
69
- | params.weboCtxConf.targetURL | String | Url to be profiled in the contextual api | Optional. Defaults to `document.URL` |
70
- | params.weboCtxConf.setPrebidTargeting|Boolean|If true, will use the contextual profile to set the prebid (GPT/GAM or AST) targeting of all adunits managed by prebid.js| Optional. Default is *true*.|
71
- | params.weboCtxConf.sendToBidders|Boolean|If true, will send the contextual profile to all bidders (only smartadserver is supported now)| Optional. Default is *true*.|
72
- | params.weboCtxConf.defaultProfile | Object | default value of the profile to be used when there are no response from contextual api (such as timeout)| Optional. Default is `{}` |
73
- | params.weboUserDataConf | Object | WeboUserData Configuration | Optional |
74
- | params.weboUserDataConf.setPrebidTargeting|Boolean|If true, will use the contextual profile to set the prebid (GPT/GAM or AST) targeting of all adunits managed by prebid.js| Optional. Default is *true*.|
75
- | params.weboUserDataConf.sendToBidders|Boolean|If true, will send the contextual profile to all bidders (only smartadserver is supported now)| Optional. Default is *true*.|
76
- | params.weboUserDataConf.defaultProfile | Object | default value of the profile to be used when there are no response from contextual api (such as timeout)| Optional. Default is `{}` |
77
- | params.weboUserDataConf.localStorageProfileKey| String | can be used to customize the local storage key | Optional |
78
+ | params.setPrebidTargeting | Boolean | If true, may use the profile to set the prebid (GPT/GAM or AST) targeting of all adunits managed by prebid.js | Optional. Affects the `weboCtxConf` and `weboUserDataConf` sections |
79
+ | params.sendToBidders | Boolean | If true, may send the profile to all bidders | Optional. Affects the `weboCtxConf` and `weboUserDataConf` sections |
80
+ | params.weboCtxConf | Object | Weborama Contextual Configuration | Optional
81
+ | params.weboUserDataConf | Object | Weborama User-Centric Configuration | Optional |
82
+ | params.onData | Callback | If set, will receive the profile and site flag | Optional. Affects the `weboCtxConf` and `weboUserDataConf` sections |
83
+
84
+ #### Contextual Configuration
85
+
86
+ | Name |Type | Description | Notes |
87
+ | :------------ | :------------ | :------------ |:------------ |
88
+ | token | String | Security Token provided by Weborama, unique per client | Mandatory |
89
+ | targetURL | String | Url to be profiled in the contextual api | Optional. Defaults to `document.URL` |
90
+ | setPrebidTargeting|Boolean|If true, will use the contextual profile to set the prebid (GPT/GAM or AST) targeting of all adunits managed by prebid.js| Optional. Default is `params.setPrebidTargeting` (if any) or **true**.|
91
+ | sendToBidders|Boolean|If true, will send the contextual profile to all bidders| Optional. Default is `params.sendToBidders` (if any) or **true**.|
92
+ | defaultProfile | Object | default value of the profile to be used when there are no response from contextual api (such as timeout)| Optional. Default is `{}` |
93
+ | onData | Callback | If set, will receive the profile and site flag | Optional. Default is `params.onData` (if any) or log via prebid debug |
94
+ | enabled | Boolean| if false, will ignore this configuration| default true|
95
+
96
+ #### User-Centric Configuration
97
+
98
+ | Name |Type | Description | Notes |
99
+ | :------------ | :------------ | :------------ |:------------ |
100
+ | accountId|Number|WAM account id. If present, will be used on logging and statistics| Optional.|
101
+ | setPrebidTargeting|Boolean|If true, will use the user profile to set the prebid (GPT/GAM or AST) targeting of all adunits managed by prebid.js| Optional. Default is `params.setPrebidTargeting` (if any) or **true**.|
102
+ | sendToBidders|Boolean|If true, will send the user profile to all bidders| Optional. Default is `params.sendToBidders` (if any) or **true**.|
103
+ | onData | Callback | If set, will receive the profile and site flag | Optional. Default is `params.onData` (if any) or log via prebid debug |
104
+ | defaultProfile | Object | default value of the profile to be used when there are no response from contextual api (such as timeout)| Optional. Default is `{}` |
105
+ | localStorageProfileKey| String | can be used to customize the local storage key | Optional |
106
+ | enabled | Boolean| if false, will ignore this configuration| default true|
107
+
108
+ ### Supported Bidders
109
+
110
+ We currently support the following bidder adapters:
111
+ * SmartADServer SSP
112
+ * PubMatic SSP
113
+ * AppNexus SSP
114
+ * Rubicon SSP
115
+
116
+ We also set the bidder and global ortb2 `site` and `user` sections. The following bidders may support it, to be sure, check the `First Party Data Support` on the feature list for the particular bidder from here: https://docs.prebid.org/dev-docs/bidders
117
+
118
+ * Adagio
119
+ * AdformOpenRTB
120
+ * AdKernel
121
+ * AdMixer
122
+ * Adnuntius
123
+ * Adrelevantis
124
+ * adxcg
125
+ * AMX RTB
126
+ * Avocet
127
+ * BeOp
128
+ * Criteo
129
+ * Etarget
130
+ * Inmar
131
+ * Index Exchange
132
+ * Livewrapped
133
+ * Mediakeys
134
+ * NoBid
135
+ * OpenX
136
+ * Opt Out Advertising
137
+ * Ozone Project
138
+ * Proxistore
139
+ * Rise
140
+ * Smaato
141
+ * Sonobi
142
+ * TheMediaGrid
143
+ * TripleLift
144
+ * TrustX
145
+ * Yahoo SSP
146
+ * Yieldlab
147
+ * Zeta Global Ssp
78
148
 
79
149
  ### Testing
80
150
 
81
151
  To view an example of available segments returned by Weborama's backends:
82
152
 
83
- `gulp serve --modules=rtdModule,weboramaRtdProvider,smartadserverBidAdapter`
153
+ `gulp serve --notest --nolint --modules=rtdModule,weboramaRtdProvider,smartadserverBidAdapter,pubmaticBidAdapter,appnexusBidAdapter,rubiconBidAdapter,criteoBidAdapter`
84
154
 
85
155
  and then point your browser at:
86
156