prebid.js 5.19.0 → 6.2.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 (161) hide show
  1. package/.babelrc.js +1 -10
  2. package/README.md +4 -2
  3. package/browsers.json +13 -37
  4. package/gulpfile.js +1 -0
  5. package/karma.conf.maker.js +1 -1
  6. package/modules/adheseBidAdapter.js +7 -2
  7. package/modules/adkernelBidAdapter.js +1 -0
  8. package/modules/adlivetechBidAdapter.md +61 -0
  9. package/modules/admixerBidAdapter.js +2 -1
  10. package/modules/adnuntiusBidAdapter.js +2 -1
  11. package/modules/adomikAnalyticsAdapter.js +10 -4
  12. package/modules/adplusBidAdapter.js +203 -0
  13. package/modules/adplusBidAdapter.md +39 -0
  14. package/modules/adyoulikeBidAdapter.js +7 -2
  15. package/modules/airgridRtdProvider.js +1 -1
  16. package/modules/appnexusBidAdapter.js +28 -5
  17. package/modules/atsAnalyticsAdapter.js +67 -46
  18. package/modules/atsAnalyticsAdapter.md +1 -0
  19. package/modules/beachfrontBidAdapter.js +14 -17
  20. package/modules/betweenBidAdapter.js +2 -1
  21. package/modules/browsiRtdProvider.js +106 -18
  22. package/modules/cleanioRtdProvider.js +192 -0
  23. package/modules/cleanioRtdProvider.md +59 -0
  24. package/modules/codefuelBidAdapter.js +1 -3
  25. package/modules/codefuelBidAdapter.md +3 -3
  26. package/modules/craftBidAdapter.js +5 -3
  27. package/modules/datablocksBidAdapter.js +3 -3
  28. package/modules/dchain.js +149 -0
  29. package/modules/dchain.md +45 -0
  30. package/modules/deepintentBidAdapter.js +1 -1
  31. package/modules/deltaprojectsBidAdapter.js +252 -0
  32. package/modules/deltaprojectsBidAdapter.md +32 -0
  33. package/modules/emx_digitalBidAdapter.js +9 -1
  34. package/modules/engageyaBidAdapter.js +68 -54
  35. package/modules/freewheel-sspBidAdapter.js +6 -0
  36. package/modules/glimpseBidAdapter.js +31 -16
  37. package/modules/goldbachBidAdapter.js +1176 -0
  38. package/modules/goldbachBidAdapter.md +151 -0
  39. package/modules/gptPreAuction.js +11 -5
  40. package/modules/gridBidAdapter.js +1 -0
  41. package/modules/gumgumBidAdapter.js +5 -1
  42. package/modules/id5IdSystem.md +6 -6
  43. package/modules/imRtdProvider.js +31 -0
  44. package/modules/intersectionRtdProvider.js +114 -0
  45. package/modules/invibesBidAdapter.js +15 -9
  46. package/modules/ipromBidAdapter.js +79 -0
  47. package/modules/ixBidAdapter.js +173 -22
  48. package/modules/jixieBidAdapter.js +8 -2
  49. package/modules/justpremiumBidAdapter.js +6 -1
  50. package/modules/limelightDigitalBidAdapter.js +2 -1
  51. package/modules/livewrappedAnalyticsAdapter.js +5 -0
  52. package/modules/luponmediaBidAdapter.js +570 -0
  53. package/modules/merkleIdSystem.js +5 -0
  54. package/modules/missenaBidAdapter.js +89 -0
  55. package/modules/multibid/index.js +3 -3
  56. package/modules/nativoBidAdapter.js +32 -2
  57. package/modules/oguryBidAdapter.js +2 -1
  58. package/modules/openxBidAdapter.js +7 -2
  59. package/modules/operaadsBidAdapter.js +21 -1
  60. package/modules/otmBidAdapter.js +146 -0
  61. package/modules/otmBidAdapter.md +27 -26
  62. package/modules/outbrainBidAdapter.js +5 -0
  63. package/modules/playwireBidAdapter.md +61 -0
  64. package/modules/prebidServerBidAdapter/index.js +3 -3
  65. package/modules/pubmaticBidAdapter.js +5 -3
  66. package/modules/relaidoBidAdapter.js +86 -65
  67. package/modules/richaudienceBidAdapter.js +1 -1
  68. package/modules/rtdModule/index.js +2 -2
  69. package/modules/saambaaBidAdapter.js +420 -0
  70. package/modules/saambaaBidAdapter.md +65 -68
  71. package/modules/seedtagBidAdapter.js +6 -0
  72. package/modules/smaatoBidAdapter.js +9 -1
  73. package/modules/smartxBidAdapter.js +17 -1
  74. package/modules/sonobiBidAdapter.js +7 -0
  75. package/modules/sortableBidAdapter.js +1 -0
  76. package/modules/sspBCBidAdapter.js +34 -3
  77. package/modules/tappxBidAdapter.js +3 -1
  78. package/modules/teadsBidAdapter.js +3 -0
  79. package/modules/trustxBidAdapter.js +18 -7
  80. package/modules/undertoneBidAdapter.js +8 -1
  81. package/modules/userId/index.js +27 -2
  82. package/modules/ventes.md +71 -0
  83. package/modules/ventesBidAdapter.js +410 -0
  84. package/modules/ventesBidAdapter.md +93 -0
  85. package/modules/vidoomyBidAdapter.js +51 -100
  86. package/modules/visxBidAdapter.js +20 -3
  87. package/modules/visxBidAdapter.md +4 -6
  88. package/modules/yahoosspBidAdapter.js +6 -6
  89. package/modules/yahoosspBidAdapter.md +1 -1
  90. package/modules/yieldlabBidAdapter.js +41 -10
  91. package/modules/yieldlabBidAdapter.md +91 -48
  92. package/modules/yieldoneBidAdapter.js +115 -11
  93. package/package.json +6 -1
  94. package/src/adapterManager.js +14 -8
  95. package/src/auction.js +14 -13
  96. package/src/targeting.js +2 -2
  97. package/src/utils.js +7 -0
  98. package/test/spec/integration/faker/googletag.js +6 -0
  99. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  100. package/test/spec/modules/adnuntiusBidAdapter_spec.js +18 -0
  101. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  102. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  103. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  104. package/test/spec/modules/appnexusBidAdapter_spec.js +65 -2
  105. package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
  106. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  107. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  108. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  109. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  110. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  111. package/test/spec/modules/dchain_spec.js +329 -0
  112. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  113. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  114. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  115. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  116. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  117. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  118. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  119. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  120. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  121. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  122. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  123. package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
  124. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  125. package/test/spec/modules/ixBidAdapter_spec.js +288 -5
  126. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  127. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  128. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  129. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  130. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +23 -4
  131. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  132. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  133. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  134. package/test/spec/modules/multibid_spec.js +31 -31
  135. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  136. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  137. package/test/spec/modules/openxBidAdapter_spec.js +5 -26
  138. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  139. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  140. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  141. package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
  142. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  143. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  144. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  145. package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
  146. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  147. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  148. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  149. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  150. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  151. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  152. package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
  153. package/test/spec/modules/userId_spec.js +51 -0
  154. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  155. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  156. package/test/spec/modules/visxBidAdapter_spec.js +121 -5
  157. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  158. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  159. package/test/spec/unit/core/adapterManager_spec.js +26 -7
  160. package/test/spec/unit/core/targeting_spec.js +44 -0
  161. package/wdio.conf.js +1 -1
@@ -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
+ ```
@@ -55,15 +55,16 @@ export const appendPbAdSlot = adUnit => {
55
55
  const context = adUnit.ortb2Imp.ext.data;
56
56
  const { customPbAdSlot } = _currentConfig;
57
57
 
58
- if (customPbAdSlot) {
59
- context.pbadslot = customPbAdSlot(adUnit.code, deepAccess(context, 'adserver.adslot'));
58
+ // use context.pbAdSlot if set (if someone set it already, it will take precedence over others)
59
+ if (context.pbadslot) {
60
60
  return;
61
61
  }
62
62
 
63
- // use context.pbAdSlot if set
64
- if (context.pbadslot) {
63
+ if (customPbAdSlot) {
64
+ context.pbadslot = customPbAdSlot(adUnit.code, deepAccess(context, 'adserver.adslot'));
65
65
  return;
66
66
  }
67
+
67
68
  // use data attribute 'data-adslotid' if set
68
69
  try {
69
70
  const adUnitCodeDiv = document.getElementById(adUnit.code);
@@ -78,12 +79,17 @@ export const appendPbAdSlot = adUnit => {
78
79
  return;
79
80
  }
80
81
  context.pbadslot = adUnit.code;
82
+ return true;
81
83
  };
82
84
 
83
85
  export const makeBidRequestsHook = (fn, adUnits, ...args) => {
84
86
  appendGptSlots(adUnits);
85
87
  adUnits.forEach(adUnit => {
86
- appendPbAdSlot(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;
92
+ }
87
93
  });
88
94
  return fn.call(this, adUnits, ...args);
89
95
  };
@@ -29,6 +29,7 @@ let hasSynced = false;
29
29
 
30
30
  export const spec = {
31
31
  code: BIDDER_CODE,
32
+ aliases: ['playwire', 'adlivetech'],
32
33
  supportedMediaTypes: [ BANNER, VIDEO ],
33
34
  /**
34
35
  * Determines whether or not the given bid request is valid.
@@ -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);
@@ -302,6 +303,9 @@ function buildRequests(validBidRequests, bidderRequest) {
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
 
@@ -1,14 +1,14 @@
1
1
  # ID5 Universal ID
2
2
 
3
- The ID5 Universal ID is a shared, neutral identifier that publishers and ad tech platforms can use to recognise users even in environments where 3rd party cookies are not available. The ID5 Universal ID is designed to respect users' privacy choices and publishers’ preferences throughout the advertising value chain. For more information about the ID5 Universal ID and detailed integration docs, please visit [our documentation](https://support.id5.io/portal/en/kb/articles/prebid-js-user-id-module). We also recommend that you sign up for our [release notes](https://id5.io/universal-id/release-notes) to stay up-to-date with any changes to the implementation of the ID5 Universal ID in Prebid.
3
+ The ID5 ID is a shared, neutral identifier that publishers and ad tech platforms can use to recognise users even in environments where 3rd party cookies are not available. The ID5 ID is designed to respect users' privacy choices and publishers’ preferences throughout the advertising value chain. For more information about the ID5 ID and detailed integration docs, please visit [our documentation](https://support.id5.io/portal/en/kb/articles/prebid-js-user-id-module).
4
4
 
5
- ## ID5 Universal ID Registration
5
+ ## ID5 ID Registration
6
6
 
7
- The ID5 Universal ID is free to use, but requires a simple registration with ID5. Please visit [id5.io/universal-id](https://id5.io/universal-id) to sign up and request your ID5 Partner Number to get started.
7
+ The ID5 ID is free to use, but requires a simple registration with ID5. Please visit [our website](https://id5.io/solutions/#publishers) to sign up and request your ID5 Partner Number to get started.
8
8
 
9
- The ID5 privacy policy is at [https://www.id5.io/platform-privacy-policy](https://www.id5.io/platform-privacy-policy).
9
+ The ID5 privacy policy is at [https://id5.io/platform-privacy-policy](https://id5.io/platform-privacy-policy).
10
10
 
11
- ## ID5 Universal ID Configuration
11
+ ## ID5 ID Configuration
12
12
 
13
13
  First, make sure to add the ID5 submodule to your Prebid.js package with:
14
14
 
@@ -46,7 +46,7 @@ pbjs.setConfig({
46
46
  | Param under userSync.userIds[] | Scope | Type | Description | Example |
47
47
  | --- | --- | --- | --- | --- |
48
48
  | name | Required | String | The name of this module: `"id5Id"` | `"id5Id"` |
49
- | params | Required | Object | Details for the ID5 Universal ID. | |
49
+ | params | Required | Object | Details for the ID5 ID. | |
50
50
  | params.partner | Required | Number | This is the ID5 Partner Number obtained from registering with ID5. | `173` |
51
51
  | params.pd | Optional | String | Partner-supplied data used for linking ID5 IDs across domains. See [our documentation](https://support.id5.io/portal/en/kb/articles/passing-partner-data-to-id5) for details on generating the string. Omit the parameter or leave as an empty string if no data to supply | `"MT1iNTBjY..."` |
52
52
  | params.provider | Optional | String | An identifier provided by ID5 to technology partners who manage Prebid setups on behalf of publishers. Reach out to [ID5](mailto:prebid@id5.io) if you have questions about this parameter | `pubmatic-identity-hub` |
@@ -37,6 +37,34 @@ function setImDataInCookie(value) {
37
37
  );
38
38
  }
39
39
 
40
+ /**
41
+ * @param {string} bidderName
42
+ */
43
+ export function getBidderFunction(bidderName) {
44
+ const biddersFunction = {
45
+ ix: function (bid, data) {
46
+ if (data.im_segments && data.im_segments.length) {
47
+ config.setConfig({
48
+ ix: {firstPartyData: {im_segments: data.im_segments}},
49
+ });
50
+ }
51
+ return bid
52
+ },
53
+ pubmatic: function (bid, data) {
54
+ if (data.im_segments && data.im_segments.length) {
55
+ const dctr = deepAccess(bid, 'params.dctr');
56
+ deepSetValue(
57
+ bid,
58
+ 'params.dctr',
59
+ `${dctr ? dctr + '|' : ''}im_segments=${data.im_segments.join(',')}`
60
+ );
61
+ }
62
+ return bid
63
+ }
64
+ }
65
+ return biddersFunction[bidderName] || null;
66
+ }
67
+
40
68
  export function getCustomBidderFunction(config, bidder) {
41
69
  const overwriteFn = deepAccess(config, `params.overwrites.${bidder}`)
42
70
 
@@ -73,9 +101,12 @@ export function setRealTimeData(bidConfig, moduleConfig, data) {
73
101
 
74
102
  adUnits.forEach(adUnit => {
75
103
  adUnit.bids.forEach(bid => {
104
+ const bidderFunction = getBidderFunction(bid.bidder);
76
105
  const overwriteFunction = getCustomBidderFunction(moduleConfig, bid.bidder);
77
106
  if (overwriteFunction) {
78
107
  overwriteFunction(bid, data, utils, config);
108
+ } else if (bidderFunction) {
109
+ bidderFunction(bid, data);
79
110
  }
80
111
  })
81
112
  });
@@ -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();
@@ -77,12 +77,14 @@ function isBidRequestValid(bid) {
77
77
  function buildRequest(bidRequests, bidderRequest) {
78
78
  bidderRequest = bidderRequest || {};
79
79
  const _placementIds = [];
80
+ const _adUnitCodes = [];
80
81
  let _loginId, _customEndpoint, _userId;
81
82
  let _ivAuctionStart = bidderRequest.auctionStart || Date.now();
82
83
 
83
84
  bidRequests.forEach(function (bidRequest) {
84
85
  bidRequest.startTime = new Date().getTime();
85
86
  _placementIds.push(bidRequest.params.placementId);
87
+ _adUnitCodes.push(bidRequest.adUnitCode);
86
88
  _loginId = _loginId || bidRequest.params.loginId;
87
89
  _customEndpoint = _customEndpoint || bidRequest.params.customEndpoint;
88
90
  _customUserSync = _customUserSync || bidRequest.params.customUserSync;
@@ -99,6 +101,7 @@ function buildRequest(bidRequests, bidderRequest) {
99
101
  let userIdModel = getUserIds(_userId);
100
102
  let bidParamsJson = {
101
103
  placementIds: _placementIds,
104
+ adUnitCodes: _adUnitCodes,
102
105
  loginId: _loginId,
103
106
  auctionStartTime: _ivAuctionStart,
104
107
  bidVersion: CONSTANTS.PREBID_VERSION
@@ -181,9 +184,12 @@ function handleResponse(responseObj, bidRequests) {
181
184
  const bidResponses = [];
182
185
  for (let i = 0; i < bidRequests.length; i++) {
183
186
  let bidRequest = bidRequests[i];
187
+ let usedPlacementId = responseObj.UseAdUnitCode === true
188
+ ? bidRequest.params.placementId + '_' + bidRequest.adUnitCode
189
+ : bidRequest.params.placementId;
184
190
 
185
- if (invibes.placementBids.indexOf(bidRequest.params.placementId) > -1) {
186
- logInfo('Invibes Adapter - Placement was previously bid on ' + bidRequest.params.placementId);
191
+ if (invibes.placementBids.indexOf(usedPlacementId) > -1) {
192
+ logInfo('Invibes Adapter - Placement was previously bid on ' + usedPlacementId);
187
193
  continue;
188
194
  }
189
195
 
@@ -191,21 +197,21 @@ function handleResponse(responseObj, bidRequests) {
191
197
  if (responseObj.AdPlacements != null) {
192
198
  for (let j = 0; j < responseObj.AdPlacements.length; j++) {
193
199
  let bidModel = responseObj.AdPlacements[j].BidModel;
194
- if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) {
200
+ if (bidModel != null && bidModel.PlacementId == usedPlacementId) {
195
201
  requestPlacement = responseObj.AdPlacements[j];
196
202
  break;
197
203
  }
198
204
  }
199
205
  } else {
200
206
  let bidModel = responseObj.BidModel;
201
- if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) {
207
+ if (bidModel != null && bidModel.PlacementId == usedPlacementId) {
202
208
  requestPlacement = responseObj;
203
209
  }
204
210
  }
205
211
 
206
- let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled);
212
+ let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled, usedPlacementId);
207
213
  if (bid !== null) {
208
- invibes.placementBids.push(bidRequest.params.placementId);
214
+ invibes.placementBids.push(usedPlacementId);
209
215
  bidResponses.push(bid);
210
216
  }
211
217
  }
@@ -213,9 +219,9 @@ function handleResponse(responseObj, bidRequests) {
213
219
  return bidResponses;
214
220
  }
215
221
 
216
- function createBid(bidRequest, requestPlacement, multipositionEnabled) {
222
+ function createBid(bidRequest, requestPlacement, multipositionEnabled, usedPlacementId) {
217
223
  if (requestPlacement === null || requestPlacement.BidModel === null) {
218
- logInfo('Invibes Adapter - Placement not configured for bidding ' + bidRequest.params.placementId);
224
+ logInfo('Invibes Adapter - Placement not configured for bidding ' + usedPlacementId);
219
225
  return null;
220
226
  }
221
227
 
@@ -684,7 +690,7 @@ let keywords = (function () {
684
690
  return kw;
685
691
  }());
686
692
 
687
- // =====================
693
+ // ======================
688
694
 
689
695
  export function resetInvibes() {
690
696
  invibes.optIn = undefined;
@@ -0,0 +1,79 @@
1
+ import { logError } from '../src/utils.js';
2
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
3
+
4
+ const BIDDER_CODE = 'iprom';
5
+ const ENDPOINT_URL = 'https://core.iprom.net/programmatic';
6
+ const VERSION = 'v1.0.2';
7
+ const DEFAULT_CURRENCY = 'EUR';
8
+ const DEFAULT_NETREVENUE = true;
9
+ const DEFAULT_TTL = 360;
10
+
11
+ export const spec = {
12
+ code: BIDDER_CODE,
13
+ isBidRequestValid: function ({ bidder, params = {} } = {}) {
14
+ // id parameter checks
15
+ if (!params.id) {
16
+ logError(`${bidder}: Parameter 'id' missing`);
17
+ return false;
18
+ } else if (typeof params.id !== 'string') {
19
+ logError(`${bidder}: Parameter 'id' needs to be a string`);
20
+ return false;
21
+ }
22
+ // dimension parameter checks
23
+ if (!params.dimension) {
24
+ logError(`${bidder}: Required parameter 'dimension' missing`);
25
+ return false;
26
+ } else if (typeof params.dimension !== 'string') {
27
+ logError(`${bidder}: Parameter 'dimension' needs to be a string`);
28
+ return false;
29
+ }
30
+
31
+ return true;
32
+ },
33
+
34
+ buildRequests: function (validBidRequests, bidderRequest) {
35
+ const payload = {
36
+ bids: validBidRequests,
37
+ referer: bidderRequest.refererInfo,
38
+ version: VERSION
39
+ };
40
+ const payloadString = JSON.stringify(payload);
41
+
42
+ return {
43
+ method: 'POST',
44
+ url: ENDPOINT_URL,
45
+ data: payloadString
46
+ };
47
+ },
48
+
49
+ interpretResponse: function (serverResponse, request) {
50
+ let bids = serverResponse.body;
51
+
52
+ const bidResponses = [];
53
+
54
+ bids.forEach(bid => {
55
+ const b = {
56
+ ad: bid.ad,
57
+ requestId: bid.requestId,
58
+ cpm: bid.cpm,
59
+ width: bid.width,
60
+ height: bid.height,
61
+ creativeId: bid.creativeId,
62
+ currency: bid.currency || DEFAULT_CURRENCY,
63
+ netRevenue: bid.netRevenue || DEFAULT_NETREVENUE,
64
+ ttl: bid.ttl || DEFAULT_TTL,
65
+ meta: {},
66
+ };
67
+
68
+ if (bid.aDomains && bid.aDomains.length) {
69
+ b.meta.advertiserDomains = bid.aDomains;
70
+ }
71
+
72
+ bidResponses.push(b);
73
+ });
74
+
75
+ return bidResponses;
76
+ },
77
+ }
78
+
79
+ registerBidder(spec);