prebid.js 6.1.0 → 6.5.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 (184) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/README.md +1 -1
  3. package/browsers.json +13 -29
  4. package/gulpfile.js +87 -82
  5. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  6. package/karma.conf.maker.js +2 -2
  7. package/modules/33acrossBidAdapter.js +189 -102
  8. package/modules/adagioBidAdapter.js +1 -1
  9. package/modules/addefendBidAdapter.js +1 -0
  10. package/modules/adkernelBidAdapter.js +146 -61
  11. package/modules/adlooxAdServerVideo.js +2 -2
  12. package/modules/adlooxAnalyticsAdapter.js +4 -4
  13. package/modules/admanBidAdapter.js +1 -0
  14. package/modules/admixerBidAdapter.js +3 -2
  15. package/modules/adnuntiusBidAdapter.js +5 -2
  16. package/modules/adomikAnalyticsAdapter.js +6 -0
  17. package/modules/adplusBidAdapter.js +203 -0
  18. package/modules/adplusBidAdapter.md +39 -0
  19. package/modules/adxcgBidAdapter.js +311 -359
  20. package/modules/adxcgBidAdapter.md +22 -21
  21. package/modules/adyoulikeBidAdapter.js +20 -11
  22. package/modules/aniviewBidAdapter.js +1 -1
  23. package/modules/appnexusBidAdapter.js +19 -3
  24. package/modules/beachfrontBidAdapter.js +14 -17
  25. package/modules/beopBidAdapter.js +6 -4
  26. package/modules/bidViewability.js +3 -3
  27. package/modules/bidViewabilityIO.js +3 -3
  28. package/modules/bliinkBidAdapter.js +1 -1
  29. package/modules/colossussspBidAdapter.js +7 -0
  30. package/modules/compassBidAdapter.js +201 -0
  31. package/modules/compassBidAdapter.md +79 -0
  32. package/modules/consentManagement.js +7 -1
  33. package/modules/craftBidAdapter.js +5 -3
  34. package/modules/criteoBidAdapter.js +1 -1
  35. package/modules/currency.js +2 -2
  36. package/modules/cwireBidAdapter.js +3 -0
  37. package/modules/dailyhuntBidAdapter.js +435 -0
  38. package/modules/dailyhuntBidAdapter.md +4 -0
  39. package/modules/dchain.js +149 -0
  40. package/modules/dchain.md +45 -0
  41. package/modules/docereeBidAdapter.js +10 -1
  42. package/modules/docereeBidAdapter.md +2 -0
  43. package/modules/dspxBidAdapter.js +1 -1
  44. package/modules/emx_digitalBidAdapter.js +9 -1
  45. package/modules/engageyaBidAdapter.js +1 -1
  46. package/modules/feedadBidAdapter.js +2 -2
  47. package/modules/feedadBidAdapter.md +4 -2
  48. package/modules/freewheel-sspBidAdapter.js +6 -0
  49. package/modules/futureads.md +48 -0
  50. package/modules/glimpseBidAdapter.js +16 -3
  51. package/modules/goldbachBidAdapter.js +1176 -0
  52. package/modules/goldbachBidAdapter.md +151 -0
  53. package/modules/gptPreAuction.js +55 -7
  54. package/modules/gridBidAdapter.js +4 -3
  55. package/modules/gumgumBidAdapter.js +7 -3
  56. package/modules/improvedigitalBidAdapter.js +19 -3
  57. package/modules/instreamTracking.js +4 -4
  58. package/modules/intersectionRtdProvider.js +114 -0
  59. package/modules/invibesBidAdapter.js +64 -14
  60. package/modules/invibesBidAdapter.md +2 -1
  61. package/modules/ipromBidAdapter.js +79 -0
  62. package/modules/ixBidAdapter.js +53 -18
  63. package/modules/kinessoIdSystem.js +1 -1
  64. package/modules/limelightDigitalBidAdapter.js +3 -1
  65. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  66. package/modules/livewrappedBidAdapter.js +8 -2
  67. package/modules/loglyliftBidAdapter.js +79 -0
  68. package/modules/loglyliftBidAdapter.md +55 -0
  69. package/modules/lotamePanoramaIdSystem.js +80 -8
  70. package/modules/luponmediaBidAdapter.js +570 -0
  71. package/modules/mediasquareBidAdapter.js +1 -9
  72. package/modules/missenaBidAdapter.js +89 -0
  73. package/modules/nextMillenniumBidAdapter.js +37 -7
  74. package/modules/optimeraRtdProvider.js +8 -1
  75. package/modules/ozoneBidAdapter.js +21 -64
  76. package/modules/prebidServerBidAdapter/index.js +16 -12
  77. package/modules/pubgeniusBidAdapter.js +1 -1
  78. package/modules/pubmaticBidAdapter.js +3 -3
  79. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  80. package/modules/relaidoBidAdapter.js +86 -65
  81. package/modules/richaudienceBidAdapter.js +2 -3
  82. package/modules/rtdModule/index.js +48 -18
  83. package/modules/rubiconBidAdapter.js +31 -19
  84. package/modules/sharedIdSystem.js +27 -1
  85. package/modules/smaatoBidAdapter.js +4 -1
  86. package/modules/smartxBidAdapter.js +17 -1
  87. package/modules/tappxBidAdapter.js +3 -1
  88. package/modules/targetVideoBidAdapter.js +187 -0
  89. package/modules/targetVideoBidAdapter.md +34 -0
  90. package/modules/telariaBidAdapter.js +2 -2
  91. package/modules/trustxBidAdapter.js +8 -16
  92. package/modules/undertoneBidAdapter.js +8 -1
  93. package/modules/userId/index.js +27 -2
  94. package/modules/ventes.md +71 -0
  95. package/modules/ventesBidAdapter.js +104 -64
  96. package/modules/ventesBidAdapter.md +0 -1
  97. package/modules/vidoomyBidAdapter.js +16 -10
  98. package/modules/visxBidAdapter.js +19 -2
  99. package/modules/visxBidAdapter.md +4 -6
  100. package/modules/weboramaRtdProvider.js +288 -73
  101. package/modules/weboramaRtdProvider.md +27 -10
  102. package/modules/yahoosspBidAdapter.js +5 -1
  103. package/modules/yahoosspBidAdapter.md +1 -1
  104. package/modules/yieldmoBidAdapter.js +23 -5
  105. package/modules/yieldoneBidAdapter.js +115 -11
  106. package/modules/zetaSspBidAdapter.md +33 -1
  107. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  108. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  109. package/modules/zeta_global_sspBidAdapter.js +22 -1
  110. package/package.json +1 -1
  111. package/plugins/pbjsGlobals.js +28 -1
  112. package/src/auction.js +5 -4
  113. package/src/config.js +27 -3
  114. package/src/prebid.js +3 -2
  115. package/src/targeting.js +24 -3
  116. package/src/utils.js +53 -8
  117. package/test/helpers/prebidGlobal.js +1 -0
  118. package/test/spec/config_spec.js +279 -0
  119. package/test/spec/integration/faker/googletag.js +6 -0
  120. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  121. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  122. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  123. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +6 -0
  124. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  125. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  126. package/test/spec/modules/adyoulikeBidAdapter_spec.js +75 -0
  127. package/test/spec/modules/appnexusBidAdapter_spec.js +49 -1
  128. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  129. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  130. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  131. package/test/spec/modules/bidViewability_spec.js +4 -4
  132. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  133. package/test/spec/modules/compassBidAdapter_spec.js +397 -0
  134. package/test/spec/modules/consentManagement_spec.js +20 -0
  135. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  136. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  137. package/test/spec/modules/dchain_spec.js +329 -0
  138. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  139. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  140. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  141. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  142. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  143. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  144. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  145. package/test/spec/modules/improvedigitalBidAdapter_spec.js +3 -1
  146. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  147. package/test/spec/modules/invibesBidAdapter_spec.js +148 -4
  148. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  149. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  150. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +84 -23
  151. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  152. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  153. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  154. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  155. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  156. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  157. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  158. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  159. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  160. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  161. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  162. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  163. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  164. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  165. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  166. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  167. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  168. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  169. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  170. package/test/spec/modules/smaatoBidAdapter_spec.js +31 -0
  171. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  172. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  173. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  174. package/test/spec/modules/userId_spec.js +51 -0
  175. package/test/spec/modules/visxBidAdapter_spec.js +120 -4
  176. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  177. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  178. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  179. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  180. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  181. package/test/spec/unit/core/targeting_spec.js +116 -0
  182. package/test/spec/utils_spec.js +38 -0
  183. package/test/test_deps.js +3 -0
  184. package/test/test_index.js +1 -3
@@ -0,0 +1,151 @@
1
+ #Overview
2
+
3
+ ```
4
+ Module Name: Goldbach Bid Adapter
5
+ Module Type: Bidder Adapter
6
+ Maintainer: dusan.veljovic@goldbach.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ Connects to Xandr exchange for bids.
12
+
13
+ Goldbach bid adapter supports Banner, Video (instream and outstream) and Native.
14
+
15
+ # Test Parameters
16
+ ```
17
+ var adUnits = [
18
+ // Banner adUnit
19
+ {
20
+ code: 'banner-div',
21
+ mediaTypes: {
22
+ banner: {
23
+ sizes: [[300, 250], [300,600]]
24
+ }
25
+ },
26
+ bids: [{
27
+ bidder: 'goldbach',
28
+ params: {
29
+ placementId: 13144370
30
+ }
31
+ }]
32
+ },
33
+ // Native adUnit
34
+ {
35
+ code: 'native-div',
36
+ sizes: [[1, 1]],
37
+ mediaTypes: {
38
+ native: {
39
+ title: {
40
+ required: true
41
+ },
42
+ body: {
43
+ required: true
44
+ },
45
+ image: {
46
+ required: true
47
+ },
48
+ sponsoredBy: {
49
+ required: true
50
+ },
51
+ icon: {
52
+ required: false
53
+ }
54
+ }
55
+ },
56
+ bids: [{
57
+ bidder: 'goldbach',
58
+ params: {
59
+ placementId: 13232354,
60
+ allowSmallerSizes: true
61
+ }
62
+ }]
63
+ },
64
+ // Video instream adUnit
65
+ {
66
+ code: 'video-instream',
67
+ sizes: [[640, 480]],
68
+ mediaTypes: {
69
+ video: {
70
+ playerSize: [[640, 480]],
71
+ context: 'instream'
72
+ },
73
+ },
74
+ bids: [{
75
+ goldbach: 'goldbach',
76
+ params: {
77
+ placementId: 13232361,
78
+ video: {
79
+ skippable: true,
80
+ playback_methods: ['auto_play_sound_off']
81
+ }
82
+ }
83
+ }]
84
+ },
85
+ // Video outstream adUnit
86
+ {
87
+ code: 'video-outstream',
88
+ sizes: [[300, 250]],
89
+ mediaTypes: {
90
+ video: {
91
+ playerSize: [[300, 250]],
92
+ context: 'outstream',
93
+ // Certain ORTB 2.5 video values can be read from the mediatypes object; below are examples of supported params.
94
+ // To note - goldbach supports additional values for our system that are not part of the ORTB spec. If you want
95
+ // to use these values, they will have to be declared in the bids[].params.video object instead using the goldbach syntax.
96
+ // Between the corresponding values of the mediaTypes.video and params.video objects, the properties in params.video will
97
+ // take precedence if declared; eg in the example below, the `skippable: true` setting will be used instead of the `skip: 0`.
98
+ minduration: 1,
99
+ maxduration: 60,
100
+ skip: 0, // 1 - true, 0 - false
101
+ skipafter: 5,
102
+ playbackmethod: [2], // note - we only support options 1-4 at this time
103
+ api: [1,2,3] // note - option 6 is not supported at this time
104
+ }
105
+ },
106
+ bids: [
107
+ {
108
+ bidder: 'goldbach',
109
+ params: {
110
+ placementId: 13232385,
111
+ video: {
112
+ skippable: true,
113
+ playback_method: 'auto_play_sound_off'
114
+ }
115
+ }
116
+ }
117
+ ]
118
+ },
119
+ // Banner adUnit in a App Webview
120
+ // Only use this for situations where prebid.js is in a webview of an App
121
+ // See Prebid Mobile for displaying ads via an SDK
122
+ {
123
+ code: 'banner-div',
124
+ mediaTypes: {
125
+ banner: {
126
+ sizes: [[300, 250], [300,600]]
127
+ }
128
+ }
129
+ bids: [{
130
+ bidder: 'goldbach',
131
+ params: {
132
+ placementId: 13144370,
133
+ app: {
134
+ id: "B1O2W3M4AN.com.prebid.webview",
135
+ geo: {
136
+ lat: 40.0964439,
137
+ lng: -75.3009142
138
+ },
139
+ device_id: {
140
+ idfa: "4D12078D-3246-4DA4-AD5E-7610481E7AE", // Apple advertising identifier
141
+ aaid: "38400000-8cf0-11bd-b23e-10b96e40000d", // Android advertising identifier
142
+ md5udid: "5756ae9022b2ea1e47d84fead75220c8", // MD5 hash of the ANDROID_ID
143
+ sha1udid: "4DFAA92388699AC6539885AEF1719293879985BF", // SHA1 hash of the ANDROID_ID
144
+ windowsadid: "750c6be243f1c4b5c9912b95a5742fc5" // Windows advertising identifier
145
+ }
146
+ }
147
+ }
148
+ }]
149
+ }
150
+ ];
151
+ ```
@@ -48,10 +48,35 @@ const sanitizeSlotPath = (path) => {
48
48
  return path;
49
49
  }
50
50
 
51
+ const defaultPreAuction = (adUnit, adServerAdSlot) => {
52
+ const context = adUnit.ortb2Imp.ext.data;
53
+
54
+ // use pbadslot if supplied
55
+ if (context.pbadslot) {
56
+ return context.pbadslot;
57
+ }
58
+
59
+ // confirm that GPT is set up
60
+ if (!isGptPubadsDefined()) {
61
+ return;
62
+ }
63
+
64
+ // find all GPT slots with this name
65
+ var gptSlots = window.googletag.pubads().getSlots().filter(slot => slot.getAdUnitPath() === adServerAdSlot);
66
+
67
+ if (gptSlots.length === 0) {
68
+ return; // should never happen
69
+ }
70
+
71
+ if (gptSlots.length === 1) {
72
+ return adServerAdSlot;
73
+ }
74
+
75
+ // else the adunit code must be div id. append it.
76
+ return `${adServerAdSlot}#${adUnit.code}`;
77
+ }
78
+
51
79
  export const appendPbAdSlot = adUnit => {
52
- adUnit.ortb2Imp = adUnit.ortb2Imp || {};
53
- adUnit.ortb2Imp.ext = adUnit.ortb2Imp.ext || {};
54
- adUnit.ortb2Imp.ext.data = adUnit.ortb2Imp.ext.data || {};
55
80
  const context = adUnit.ortb2Imp.ext.data;
56
81
  const { customPbAdSlot } = _currentConfig;
57
82
 
@@ -84,11 +109,32 @@ export const appendPbAdSlot = adUnit => {
84
109
 
85
110
  export const makeBidRequestsHook = (fn, adUnits, ...args) => {
86
111
  appendGptSlots(adUnits);
112
+ const { useDefaultPreAuction, customPreAuction } = _currentConfig;
87
113
  adUnits.forEach(adUnit => {
88
- const usedAdUnitCode = appendPbAdSlot(adUnit);
89
- // gpid should be set to itself if already set, or to what pbadslot was (as long as it was not adUnit code)
90
- if (!adUnit.ortb2Imp.ext.gpid && !usedAdUnitCode) {
91
- adUnit.ortb2Imp.ext.gpid = adUnit.ortb2Imp.ext.data.pbadslot;
114
+ // init the ortb2Imp if not done yet
115
+ adUnit.ortb2Imp = adUnit.ortb2Imp || {};
116
+ adUnit.ortb2Imp.ext = adUnit.ortb2Imp.ext || {};
117
+ adUnit.ortb2Imp.ext.data = adUnit.ortb2Imp.ext.data || {};
118
+ const context = adUnit.ortb2Imp.ext;
119
+
120
+ // if neither new confs set do old stuff
121
+ if (!customPreAuction && !useDefaultPreAuction) {
122
+ const usedAdUnitCode = appendPbAdSlot(adUnit);
123
+ // gpid should be set to itself if already set, or to what pbadslot was (as long as it was not adUnit code)
124
+ if (!context.gpid && !usedAdUnitCode) {
125
+ context.gpid = context.data.pbadslot;
126
+ }
127
+ } else {
128
+ let adserverSlot = deepAccess(context, 'data.adserver.adslot');
129
+ let result;
130
+ if (customPreAuction) {
131
+ result = customPreAuction(adUnit, adserverSlot);
132
+ } else if (useDefaultPreAuction) {
133
+ result = defaultPreAuction(adUnit, adserverSlot);
134
+ }
135
+ if (result) {
136
+ context.gpid = context.data.pbadslot = result;
137
+ }
92
138
  }
93
139
  });
94
140
  return fn.call(this, adUnits, ...args);
@@ -100,6 +146,8 @@ const handleSetGptConfig = moduleConfig => {
100
146
  'customGptSlotMatching', customGptSlotMatching =>
101
147
  typeof customGptSlotMatching === 'function' && customGptSlotMatching,
102
148
  'customPbAdSlot', customPbAdSlot => typeof customPbAdSlot === 'function' && customPbAdSlot,
149
+ 'customPreAuction', customPreAuction => typeof customPreAuction === 'function' && customPreAuction,
150
+ 'useDefaultPreAuction', useDefaultPreAuction => useDefaultPreAuction === true,
103
151
  ]);
104
152
 
105
153
  if (_currentConfig.enabled) {
@@ -291,10 +291,11 @@ export const spec = {
291
291
  if (!hasSynced && syncOptions.pixelEnabled) {
292
292
  let params = '';
293
293
 
294
- if (gdprConsent && typeof gdprConsent.consentString === 'string') {
294
+ if (gdprConsent) {
295
295
  if (typeof gdprConsent.gdprApplies === 'boolean') {
296
- params += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
297
- } else {
296
+ params += `&gdpr=${Number(gdprConsent.gdprApplies)}`;
297
+ }
298
+ if (typeof gdprConsent.consentString === 'string') {
298
299
  params += `&gdpr_consent=${gdprConsent.consentString}`;
299
300
  }
300
301
  }
@@ -286,7 +286,8 @@ function buildRequests(validBidRequests, bidderRequest) {
286
286
  schain,
287
287
  transactionId,
288
288
  userId = {},
289
- ortb2Imp
289
+ ortb2Imp,
290
+ adUnitCode = ''
290
291
  } = bidRequest;
291
292
  const { currency, floor } = _getFloor(mediaTypes, params.bidfloor, bidRequest);
292
293
  const eids = getEids(userId);
@@ -295,13 +296,16 @@ function buildRequests(validBidRequests, bidderRequest) {
295
296
  let gpid = '';
296
297
 
297
298
  const date = new Date();
298
- const lt = date && date.getTime();
299
- const to = date && date.getTimezoneOffset();
299
+ const lt = date.getTime();
300
+ const to = date.getTimezoneOffset();
300
301
  if (to) {
301
302
  lt && (data.lt = lt);
302
303
  data.to = to;
303
304
  }
304
305
 
306
+ // ADTS-169 add adUnitCode to requests
307
+ if (adUnitCode) data.aun = adUnitCode
308
+
305
309
  // ADTS-134 Retrieve ID envelopes
306
310
  for (const eid in eids) data[eid] = eids[eid];
307
311
 
@@ -11,7 +11,7 @@ const RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js
11
11
  const VIDEO_TARGETING = ['skip', 'skipmin', 'skipafter'];
12
12
 
13
13
  export const spec = {
14
- version: '7.4.0',
14
+ version: '7.5.0',
15
15
  code: BIDDER_CODE,
16
16
  gvlid: 253,
17
17
  aliases: ['id'],
@@ -45,8 +45,24 @@ export const spec = {
45
45
  libVersion: this.version
46
46
  };
47
47
 
48
- if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) {
49
- requestParameters.gdpr = bidderRequest.gdprConsent.consentString;
48
+ const gdprConsent = deepAccess(bidderRequest, 'gdprConsent')
49
+ if (gdprConsent) {
50
+ // GDPR Consent String
51
+ if (gdprConsent.consentString) {
52
+ requestParameters.gdpr = gdprConsent.consentString;
53
+ }
54
+
55
+ // Additional Consent String
56
+ const additionalConsent = deepAccess(gdprConsent, 'addtlConsent');
57
+ if (additionalConsent && additionalConsent.indexOf('~') !== -1) {
58
+ // Google Ad Tech Provider IDs
59
+ const atpIds = additionalConsent.substring(additionalConsent.indexOf('~') + 1);
60
+ deepSetValue(
61
+ requestParameters,
62
+ 'user.ext.consented_providers_settings.consented_providers',
63
+ atpIds.split('.').map(id => parseInt(id, 10))
64
+ );
65
+ }
50
66
  }
51
67
 
52
68
  if (bidderRequest && bidderRequest.uspConsent) {
@@ -3,11 +3,11 @@ import { config } from '../src/config.js';
3
3
  import { auctionManager } from '../src/auctionManager.js';
4
4
  import { INSTREAM } from '../src/video.js';
5
5
  import * as events from '../src/events.js';
6
- import { BID_STATUS, EVENTS, TARGETING_KEYS } from '../src/constants.json';
6
+ import CONSTANTS from '../src/constants.json'
7
7
 
8
- const {CACHE_ID, UUID} = TARGETING_KEYS;
9
- const {BID_WON, AUCTION_END} = EVENTS;
10
- const {RENDERED} = BID_STATUS;
8
+ const {CACHE_ID, UUID} = CONSTANTS.TARGETING_KEYS;
9
+ const {BID_WON, AUCTION_END} = CONSTANTS.EVENTS;
10
+ const {RENDERED} = CONSTANTS.BID_STATUS;
11
11
 
12
12
  const INSTREAM_TRACKING_DEFAULT_CONFIG = {
13
13
  enabled: false,
@@ -0,0 +1,114 @@
1
+ import {submodule} from '../src/hook.js';
2
+ import {isFn, logError} from '../src/utils.js';
3
+ import {config} from '../src/config.js';
4
+ import {getGlobal} from '../src/prebidGlobal.js';
5
+ import includes from 'core-js-pure/features/array/includes.js';
6
+ import '../src/adapterManager.js';
7
+ let observerAvailable = true;
8
+ function getIntersectionData(requestBidsObject, onDone, providerConfig, userConsent) {
9
+ const intersectionMap = {};
10
+ const placeholdersMap = {};
11
+ let done = false;
12
+ if (!observerAvailable) return complete();
13
+ const observer = new IntersectionObserver(observerCallback, {threshold: 0.5});
14
+ const adUnitCodes = requestBidsObject.adUnitCodes || [];
15
+ const auctionDelay = config.getConfig('realTimeData.auctionDelay') || 0;
16
+ const waitForIt = providerConfig.waitForIt;
17
+ let adUnits = requestBidsObject.adUnits || getGlobal().adUnits || [];
18
+ if (adUnitCodes.length) {
19
+ adUnits = adUnits.filter(unit => includes(adUnitCodes, unit.code));
20
+ }
21
+ let checkTimeoutId;
22
+ findAndObservePlaceholders();
23
+ if (auctionDelay > 0) {
24
+ setTimeout(complete, auctionDelay);
25
+ }
26
+ function findAndObservePlaceholders() {
27
+ const observed = adUnits.filter((unit) => {
28
+ const code = unit.code;
29
+ if (placeholdersMap[code]) return true;
30
+ const ph = document.getElementById(code);
31
+ if (ph) {
32
+ placeholdersMap[code] = ph;
33
+ observer.observe(ph);
34
+ return true;
35
+ }
36
+ });
37
+ if (
38
+ observed.length === adUnits.length ||
39
+ !waitForIt ||
40
+ auctionDelay <= 0
41
+ ) {
42
+ return;
43
+ }
44
+ checkTimeoutId = setTimeout(findAndObservePlaceholders);
45
+ }
46
+ function observerCallback(entries) {
47
+ let entry = entries.pop();
48
+ while (entry) {
49
+ const target = entry.target;
50
+ const id = target.getAttribute('id');
51
+ if (id) {
52
+ const intersection = intersectionMap[id];
53
+ if (!intersection || intersection.time < entry.time) {
54
+ intersectionMap[id] = {
55
+ 'boundingClientRect': cloneRect(entry.boundingClientRect),
56
+ 'intersectionRect': cloneRect(entry.intersectionRect),
57
+ 'rootRect': cloneRect(entry.rootRect),
58
+ 'intersectionRatio': entry.intersectionRatio,
59
+ 'isIntersecting': entry.isIntersecting,
60
+ 'time': entry.time
61
+ };
62
+ if (adUnits.every(unit => !!intersectionMap[unit.code])) {
63
+ complete();
64
+ }
65
+ }
66
+ }
67
+ entry = entries.pop();
68
+ }
69
+ }
70
+ function complete() {
71
+ if (done) return;
72
+ if (checkTimeoutId) clearTimeout(checkTimeoutId);
73
+ done = true;
74
+ checkTimeoutId = null;
75
+ observer && observer.disconnect();
76
+ adUnits && adUnits.forEach((unit) => {
77
+ const intersection = intersectionMap[unit.code];
78
+ if (intersection && unit.bids) {
79
+ unit.bids.forEach(bid => bid.intersection = intersection);
80
+ }
81
+ });
82
+ onDone();
83
+ }
84
+ }
85
+ function init(moduleConfig) {
86
+ if (!isFn(window.IntersectionObserver)) {
87
+ logError('IntersectionObserver is not defined');
88
+ observerAvailable = false;
89
+ } else {
90
+ observerAvailable = true;
91
+ }
92
+ return observerAvailable;
93
+ }
94
+ function cloneRect(rect) {
95
+ return rect ? {
96
+ 'left': rect.left,
97
+ 'top': rect.top,
98
+ 'right': rect.right,
99
+ 'bottom': rect.bottom,
100
+ 'width': rect.width,
101
+ 'height': rect.height,
102
+ 'x': rect.x,
103
+ 'y': rect.y,
104
+ } : rect;
105
+ }
106
+ export const intersectionSubmodule = {
107
+ name: 'intersection',
108
+ getBidRequestData: getIntersectionData,
109
+ init: init,
110
+ };
111
+ function registerSubModule() {
112
+ submodule('realTimeData', intersectionSubmodule);
113
+ }
114
+ registerSubModule();
@@ -4,7 +4,8 @@ import {getStorageManager} from '../src/storageManager.js';
4
4
 
5
5
  const CONSTANTS = {
6
6
  BIDDER_CODE: 'invibes',
7
- BID_ENDPOINT: 'https://bid.videostep.com/Bid/VideoAdContent',
7
+ BID_ENDPOINT: '.videostep.com/Bid/VideoAdContent',
8
+ BID_SUBDOMAIN: 'https://bid',
8
9
  SYNC_ENDPOINT: 'https://k.r66net.com/GetUserSync',
9
10
  TIME_TO_LIVE: 300,
10
11
  DEFAULT_CURRENCY: 'EUR',
@@ -77,13 +78,15 @@ function isBidRequestValid(bid) {
77
78
  function buildRequest(bidRequests, bidderRequest) {
78
79
  bidderRequest = bidderRequest || {};
79
80
  const _placementIds = [];
80
- let _loginId, _customEndpoint, _userId;
81
+ const _adUnitCodes = [];
82
+ let _customEndpoint, _userId, _domainId;
81
83
  let _ivAuctionStart = bidderRequest.auctionStart || Date.now();
82
84
 
83
85
  bidRequests.forEach(function (bidRequest) {
84
86
  bidRequest.startTime = new Date().getTime();
85
87
  _placementIds.push(bidRequest.params.placementId);
86
- _loginId = _loginId || bidRequest.params.loginId;
88
+ _adUnitCodes.push(bidRequest.adUnitCode);
89
+ _domainId = _domainId || bidRequest.params.domainId;
87
90
  _customEndpoint = _customEndpoint || bidRequest.params.customEndpoint;
88
91
  _customUserSync = _customUserSync || bidRequest.params.customUserSync;
89
92
  _userId = _userId || bidRequest.userId;
@@ -99,7 +102,7 @@ function buildRequest(bidRequests, bidderRequest) {
99
102
  let userIdModel = getUserIds(_userId);
100
103
  let bidParamsJson = {
101
104
  placementIds: _placementIds,
102
- loginId: _loginId,
105
+ adUnitCodes: _adUnitCodes,
103
106
  auctionStartTime: _ivAuctionStart,
104
107
  bidVersion: CONSTANTS.PREBID_VERSION
105
108
  };
@@ -143,9 +146,11 @@ function buildRequest(bidRequests, bidderRequest) {
143
146
  }
144
147
  }
145
148
 
149
+ let endpoint = createEndpoint(_customEndpoint, _domainId, _placementIds);
150
+
146
151
  return {
147
152
  method: CONSTANTS.METHOD,
148
- url: _customEndpoint || CONSTANTS.BID_ENDPOINT,
153
+ url: endpoint,
149
154
  data: data,
150
155
  options: {withCredentials: true},
151
156
  // for POST: { contentType: 'application/json', withCredentials: true }
@@ -181,9 +186,12 @@ function handleResponse(responseObj, bidRequests) {
181
186
  const bidResponses = [];
182
187
  for (let i = 0; i < bidRequests.length; i++) {
183
188
  let bidRequest = bidRequests[i];
189
+ let usedPlacementId = responseObj.UseAdUnitCode === true
190
+ ? bidRequest.params.placementId + '_' + bidRequest.adUnitCode
191
+ : bidRequest.params.placementId;
184
192
 
185
- if (invibes.placementBids.indexOf(bidRequest.params.placementId) > -1) {
186
- logInfo('Invibes Adapter - Placement was previously bid on ' + bidRequest.params.placementId);
193
+ if (invibes.placementBids.indexOf(usedPlacementId) > -1) {
194
+ logInfo('Invibes Adapter - Placement was previously bid on ' + usedPlacementId);
187
195
  continue;
188
196
  }
189
197
 
@@ -191,21 +199,21 @@ function handleResponse(responseObj, bidRequests) {
191
199
  if (responseObj.AdPlacements != null) {
192
200
  for (let j = 0; j < responseObj.AdPlacements.length; j++) {
193
201
  let bidModel = responseObj.AdPlacements[j].BidModel;
194
- if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) {
202
+ if (bidModel != null && bidModel.PlacementId == usedPlacementId) {
195
203
  requestPlacement = responseObj.AdPlacements[j];
196
204
  break;
197
205
  }
198
206
  }
199
207
  } else {
200
208
  let bidModel = responseObj.BidModel;
201
- if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) {
209
+ if (bidModel != null && bidModel.PlacementId == usedPlacementId) {
202
210
  requestPlacement = responseObj;
203
211
  }
204
212
  }
205
213
 
206
- let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled);
214
+ let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled, usedPlacementId);
207
215
  if (bid !== null) {
208
- invibes.placementBids.push(bidRequest.params.placementId);
216
+ invibes.placementBids.push(usedPlacementId);
209
217
  bidResponses.push(bid);
210
218
  }
211
219
  }
@@ -213,9 +221,9 @@ function handleResponse(responseObj, bidRequests) {
213
221
  return bidResponses;
214
222
  }
215
223
 
216
- function createBid(bidRequest, requestPlacement, multipositionEnabled) {
224
+ function createBid(bidRequest, requestPlacement, multipositionEnabled, usedPlacementId) {
217
225
  if (requestPlacement === null || requestPlacement.BidModel === null) {
218
- logInfo('Invibes Adapter - Placement not configured for bidding ' + bidRequest.params.placementId);
226
+ logInfo('Invibes Adapter - Placement not configured for bidding ' + usedPlacementId);
219
227
  return null;
220
228
  }
221
229
 
@@ -274,6 +282,48 @@ function createBid(bidRequest, requestPlacement, multipositionEnabled) {
274
282
  };
275
283
  }
276
284
 
285
+ function createEndpoint(customEndpoint, domainId, placementIds) {
286
+ if (customEndpoint != null) {
287
+ return customEndpoint;
288
+ }
289
+
290
+ if (domainId != null) {
291
+ return extractEndpointFromId(domainId - 1000);
292
+ }
293
+
294
+ if (placementIds.length > 0) {
295
+ for (var i = 0; i < placementIds.length; i++) {
296
+ const id = extractFromPlacement(placementIds[i]);
297
+ if (id != null) {
298
+ return extractEndpointFromId(id);
299
+ }
300
+ }
301
+ }
302
+
303
+ return extractEndpointFromId(1);
304
+ }
305
+
306
+ function extractEndpointFromId(domainId) {
307
+ if (domainId < 2) {
308
+ return CONSTANTS.BID_SUBDOMAIN + CONSTANTS.BID_ENDPOINT;
309
+ }
310
+
311
+ return CONSTANTS.BID_SUBDOMAIN + domainId + CONSTANTS.BID_ENDPOINT;
312
+ }
313
+
314
+ function extractFromPlacement(placementId) {
315
+ if (placementId == null) { return null; }
316
+
317
+ var pattern = /_ivbs([0-9]+)/g;
318
+
319
+ var match = pattern.exec(placementId);
320
+ if (match != null && match[1] != null) {
321
+ return parseInt(match[1]);
322
+ }
323
+
324
+ return null;
325
+ }
326
+
277
327
  function addMeta(bidModelMeta) {
278
328
  var meta = {};
279
329
  if (bidModelMeta != null) {
@@ -684,7 +734,7 @@ let keywords = (function () {
684
734
  return kw;
685
735
  }());
686
736
 
687
- // =====================
737
+ // ======================
688
738
 
689
739
  export function resetInvibes() {
690
740
  invibes.optIn = undefined;
@@ -20,7 +20,8 @@ Connect to Invibes for bids.
20
20
  {
21
21
  bidder: 'invibes',
22
22
  params: {
23
- placementId: '12345'
23
+ placementId: '12345',
24
+ domainId: 1001
24
25
  }
25
26
  }
26
27
  ]