prebid.js 7.20.0 → 7.22.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 (189) hide show
  1. package/dist/1plusXRtdProvider.js +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adtrgtmeBidAdapter.js +1 -1
  8. package/dist/adxcgBidAdapter.js +1 -1
  9. package/dist/adyoulikeBidAdapter.js +1 -1
  10. package/dist/ajaBidAdapter.js +1 -1
  11. package/dist/amxBidAdapter.js +1 -1
  12. package/dist/amxIdSystem.js +1 -1
  13. package/dist/appierAnalyticsAdapter.js +1 -1
  14. package/dist/appnexusBidAdapter.js +1 -1
  15. package/dist/asoBidAdapter.js +1 -1
  16. package/dist/audiencerunBidAdapter.js +1 -1
  17. package/dist/axonixBidAdapter.js +1 -1
  18. package/dist/bidglassBidAdapter.js +1 -1
  19. package/dist/big-richmediaBidAdapter.js +1 -1
  20. package/dist/bluebillywigBidAdapter.js +1 -1
  21. package/dist/bridgewellBidAdapter.js +1 -1
  22. package/dist/brightMountainMediaBidAdapter.js +1 -1
  23. package/dist/brightcomBidAdapter.js +1 -1
  24. package/dist/carodaBidAdapter.js +1 -1
  25. package/dist/concertBidAdapter.js +1 -1
  26. package/dist/connectadBidAdapter.js +1 -1
  27. package/dist/consumableBidAdapter.js +1 -1
  28. package/dist/conversantBidAdapter.js +1 -1
  29. package/dist/craftBidAdapter.js +1 -1
  30. package/dist/criteoBidAdapter.js +1 -1
  31. package/dist/dacIdSystem.js +1 -1
  32. package/dist/dspxBidAdapter.js +1 -1
  33. package/dist/eplanningBidAdapter.js +1 -1
  34. package/dist/finativeBidAdapter.js +1 -1
  35. package/dist/freewheel-sspBidAdapter.js +1 -1
  36. package/dist/ftrackIdSystem.js +1 -1
  37. package/dist/glimpseBidAdapter.js +1 -1
  38. package/dist/gmosspBidAdapter.js +1 -1
  39. package/dist/goldbachBidAdapter.js +1 -1
  40. package/dist/gridBidAdapter.js +1 -1
  41. package/dist/gridNMBidAdapter.js +1 -1
  42. package/dist/gumgumBidAdapter.js +1 -1
  43. package/dist/h12mediaBidAdapter.js +1 -1
  44. package/dist/iasRtdProvider.js +1 -1
  45. package/dist/id5IdSystem.js +1 -1
  46. package/dist/impactifyBidAdapter.js +1 -1
  47. package/dist/improvedigitalBidAdapter.js +1 -1
  48. package/dist/inmarBidAdapter.js +1 -1
  49. package/dist/insticatorBidAdapter.js +1 -1
  50. package/dist/ixBidAdapter.js +1 -1
  51. package/dist/jixieBidAdapter.js +1 -1
  52. package/dist/justpremiumBidAdapter.js +1 -1
  53. package/dist/konduitAnalyticsAdapter.js +1 -1
  54. package/dist/kueezBidAdapter.js +1 -1
  55. package/dist/lassoBidAdapter.js +1 -1
  56. package/dist/lifestreetBidAdapter.js +1 -1
  57. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  58. package/dist/logicadBidAdapter.js +1 -1
  59. package/dist/loglyliftBidAdapter.js +1 -1
  60. package/dist/magniteAnalyticsAdapter.js +1 -1
  61. package/dist/malltvAnalyticsAdapter.js +1 -1
  62. package/dist/marsmediaBidAdapter.js +1 -1
  63. package/dist/mediafuseBidAdapter.js +1 -1
  64. package/dist/mediakeysBidAdapter.js +1 -1
  65. package/dist/medianetAnalyticsAdapter.js +1 -1
  66. package/dist/medianetBidAdapter.js +1 -1
  67. package/dist/mediasquareBidAdapter.js +1 -1
  68. package/dist/mgidBidAdapter.js +1 -1
  69. package/dist/minutemediaBidAdapter.js +1 -1
  70. package/dist/not-for-prod/prebid.js +127 -127
  71. package/dist/oguryBidAdapter.js +1 -1
  72. package/dist/onetagBidAdapter.js +1 -1
  73. package/dist/ooloAnalyticsAdapter.js +1 -1
  74. package/dist/outbrainBidAdapter.js +1 -1
  75. package/dist/parrableIdSystem.js +1 -1
  76. package/dist/pixfutureBidAdapter.js +1 -1
  77. package/dist/prebid-core.js +1 -1
  78. package/dist/prebidServerBidAdapter.js +1 -1
  79. package/dist/publinkIdSystem.js +1 -1
  80. package/dist/pubmaticBidAdapter.js +1 -1
  81. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  82. package/dist/pubwiseBidAdapter.js +1 -1
  83. package/dist/pulsepointBidAdapter.js +1 -1
  84. package/dist/pxyzBidAdapter.js +1 -1
  85. package/dist/quantcastBidAdapter.js +1 -1
  86. package/dist/readpeakBidAdapter.js +1 -1
  87. package/dist/relaidoBidAdapter.js +1 -1
  88. package/dist/rhythmoneBidAdapter.js +1 -1
  89. package/dist/riseBidAdapter.js +1 -1
  90. package/dist/rubiconAnalyticsAdapter.js +1 -1
  91. package/dist/rubiconBidAdapter.js +1 -1
  92. package/dist/seedingAllianceBidAdapter.js +1 -1
  93. package/dist/seedtagBidAdapter.js +1 -1
  94. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  95. package/dist/sharethroughBidAdapter.js +1 -1
  96. package/dist/shinezBidAdapter.js +1 -1
  97. package/dist/smaatoBidAdapter.js +1 -1
  98. package/dist/smartadserverBidAdapter.js +1 -1
  99. package/dist/smartxBidAdapter.js +1 -1
  100. package/dist/smilewantedBidAdapter.js +1 -1
  101. package/dist/sonobiBidAdapter.js +1 -1
  102. package/dist/sovrnAnalyticsAdapter.js +1 -1
  103. package/dist/sovrnBidAdapter.js +1 -1
  104. package/dist/sspBCBidAdapter.js +1 -1
  105. package/dist/sublimeBidAdapter.js +1 -1
  106. package/dist/synacormediaBidAdapter.js +1 -1
  107. package/dist/targetVideoBidAdapter.js +1 -1
  108. package/dist/teadsBidAdapter.js +1 -1
  109. package/dist/trionBidAdapter.js +1 -1
  110. package/dist/tripleliftBidAdapter.js +1 -1
  111. package/dist/ttdBidAdapter.js +1 -1
  112. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  113. package/dist/underdogmediaBidAdapter.js +1 -1
  114. package/dist/undertoneBidAdapter.js +1 -1
  115. package/dist/userId.js +1 -1
  116. package/dist/vidazooBidAdapter.js +1 -1
  117. package/dist/videobyteBidAdapter.js +1 -1
  118. package/dist/visxBidAdapter.js +1 -1
  119. package/dist/vuukleBidAdapter.js +1 -1
  120. package/dist/weboramaRtdProvider.js +1 -1
  121. package/dist/widespaceBidAdapter.js +1 -1
  122. package/dist/winrBidAdapter.js +1 -1
  123. package/dist/yahoosspBidAdapter.js +1 -1
  124. package/dist/yieldmoBidAdapter.js +1 -1
  125. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  126. package/dist/yieldoneBidAdapter.js +1 -1
  127. package/integrationExamples/gpt/weboramaRtdProvider_example.html +10 -51
  128. package/modules/1plusXRtdProvider.js +32 -5
  129. package/modules/33acrossBidAdapter.js +18 -11
  130. package/modules/adyoulikeBidAdapter.js +12 -6
  131. package/modules/asoBidAdapter.js +11 -6
  132. package/modules/asoBidAdapter.md +5 -6
  133. package/modules/brightcomBidAdapter.js +30 -10
  134. package/modules/dacIdSystem.js +145 -27
  135. package/modules/dacIdSystem.md +7 -2
  136. package/modules/fledgeForGpt.md +101 -23
  137. package/modules/freewheel-sspBidAdapter.js +48 -7
  138. package/modules/freewheel-sspBidAdapter.md +1 -1
  139. package/modules/ftrackIdSystem.js +28 -9
  140. package/modules/gridBidAdapter.js +1 -0
  141. package/modules/iasRtdProvider.js +21 -6
  142. package/modules/iasRtdProvider.md +1 -1
  143. package/modules/ixBidAdapter.js +9 -4
  144. package/modules/medianetAnalyticsAdapter.js +26 -22
  145. package/modules/medianetBidAdapter.js +5 -1
  146. package/modules/mediasquareBidAdapter.js +42 -3
  147. package/modules/mgidBidAdapter.js +8 -1
  148. package/modules/oguryBidAdapter.js +6 -2
  149. package/modules/prebidServerBidAdapter/index.js +1 -1
  150. package/modules/pubmaticBidAdapter.js +27 -3
  151. package/modules/pubwiseBidAdapter.js +14 -12
  152. package/modules/pulsepointBidAdapter.js +11 -6
  153. package/modules/smaatoBidAdapter.js +54 -5
  154. package/modules/smaatoBidAdapter.md +78 -0
  155. package/modules/teadsBidAdapter.js +26 -8
  156. package/modules/ttdBidAdapter.js +8 -0
  157. package/modules/userId/eids.js +7 -11
  158. package/modules/weboramaRtdProvider.js +800 -643
  159. package/modules/weboramaRtdProvider.md +32 -0
  160. package/modules/yieldoneBidAdapter.js +7 -4
  161. package/package.json +3 -3
  162. package/src/adapters/bidderFactory.js +11 -9
  163. package/src/auction.js +3 -3
  164. package/test/spec/auctionmanager_spec.js +29 -20
  165. package/test/spec/modules/1plusXRtdProvider_spec.js +30 -14
  166. package/test/spec/modules/33acrossBidAdapter_spec.js +44 -1
  167. package/test/spec/modules/adyoulikeBidAdapter_spec.js +1 -1
  168. package/test/spec/modules/asoBidAdapter_spec.js +2 -2
  169. package/test/spec/modules/brightcomBidAdapter_spec.js +94 -1
  170. package/test/spec/modules/dacIdSystem_spec.js +93 -11
  171. package/test/spec/modules/eids_spec.js +11 -7
  172. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +25 -4
  173. package/test/spec/modules/ftrackIdSystem_spec.js +200 -90
  174. package/test/spec/modules/iasRtdProvider_spec.js +57 -1
  175. package/test/spec/modules/ixBidAdapter_spec.js +12 -0
  176. package/test/spec/modules/medianetAnalyticsAdapter_spec.js +50 -8
  177. package/test/spec/modules/medianetBidAdapter_spec.js +76 -0
  178. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -2
  179. package/test/spec/modules/mgidBidAdapter_spec.js +50 -0
  180. package/test/spec/modules/oguryBidAdapter_spec.js +33 -17
  181. package/test/spec/modules/prebidServerBidAdapter_spec.js +24 -0
  182. package/test/spec/modules/pubmaticBidAdapter_spec.js +60 -5
  183. package/test/spec/modules/pubwiseBidAdapter_spec.js +6 -4
  184. package/test/spec/modules/pulsepointBidAdapter_spec.js +123 -0
  185. package/test/spec/modules/smaatoBidAdapter_spec.js +307 -36
  186. package/test/spec/modules/teadsBidAdapter_spec.js +119 -6
  187. package/test/spec/modules/weboramaRtdProvider_spec.js +382 -0
  188. package/test/spec/modules/yieldoneBidAdapter_spec.js +2 -3
  189. package/test/spec/unit/core/bidderFactory_spec.js +0 -4
@@ -11,6 +11,7 @@ import {
11
11
  logWarn,
12
12
  getWindowSelf,
13
13
  mergeDeep,
14
+ pick
14
15
  } from '../src/utils.js';
15
16
  import { BANNER, VIDEO } from '../src/mediaTypes.js';
16
17
 
@@ -242,7 +243,8 @@ function _getMRAKey(bidRequest) {
242
243
  // Infer the necessary data from valid bid for a minimal ttxRequest and create HTTP request
243
244
  function _createServerRequest({ bidRequests, gdprConsent = {}, uspConsent, pageUrl, ttxSettings }) {
244
245
  const ttxRequest = {};
245
- const { siteId, test } = bidRequests[0].params;
246
+ const firstBidRequest = bidRequests[0];
247
+ const { siteId, test } = firstBidRequest.params;
246
248
 
247
249
  /*
248
250
  * Infer data for the request payload
@@ -254,13 +256,13 @@ function _createServerRequest({ bidRequests, gdprConsent = {}, uspConsent, pageU
254
256
  });
255
257
 
256
258
  ttxRequest.site = { id: siteId };
257
- ttxRequest.device = _buildDeviceORTB();
259
+ ttxRequest.device = _buildDeviceORTB(firstBidRequest.ortb2?.device);
258
260
 
259
261
  if (pageUrl) {
260
262
  ttxRequest.site.page = pageUrl;
261
263
  }
262
264
 
263
- ttxRequest.id = bidRequests[0].auctionId;
265
+ ttxRequest.id = firstBidRequest.auctionId;
264
266
 
265
267
  if (gdprConsent.consentString) {
266
268
  ttxRequest.user = setExtensions(ttxRequest.user, {
@@ -268,9 +270,9 @@ function _createServerRequest({ bidRequests, gdprConsent = {}, uspConsent, pageU
268
270
  });
269
271
  }
270
272
 
271
- if (Array.isArray(bidRequests[0].userIdAsEids) && bidRequests[0].userIdAsEids.length > 0) {
273
+ if (Array.isArray(firstBidRequest.userIdAsEids) && firstBidRequest.userIdAsEids.length > 0) {
272
274
  ttxRequest.user = setExtensions(ttxRequest.user, {
273
- 'eids': bidRequests[0].userIdAsEids
275
+ 'eids': firstBidRequest.userIdAsEids
274
276
  });
275
277
  }
276
278
 
@@ -294,9 +296,9 @@ function _createServerRequest({ bidRequests, gdprConsent = {}, uspConsent, pageU
294
296
  }
295
297
  };
296
298
 
297
- if (bidRequests[0].schain) {
299
+ if (firstBidRequest.schain) {
298
300
  ttxRequest.source = setExtensions(ttxRequest.source, {
299
- 'schain': bidRequests[0].schain
301
+ 'schain': firstBidRequest.schain
300
302
  });
301
303
  }
302
304
 
@@ -739,10 +741,9 @@ function _createSync({ siteId = 'zzz000000000003zzz', gdprConsent = {}, uspConse
739
741
  }
740
742
 
741
743
  // BUILD REQUESTS: DEVICE
742
- function _buildDeviceORTB() {
744
+ function _buildDeviceORTB(device = {}) {
743
745
  const win = getWindowSelf();
744
-
745
- return {
746
+ const deviceProps = {
746
747
  ext: {
747
748
  ttx: {
748
749
  ...getScreenDimensions(),
@@ -752,7 +753,13 @@ function _buildDeviceORTB() {
752
753
  mtp: win.navigator.maxTouchPoints
753
754
  }
754
755
  }
755
- };
756
+ }
757
+
758
+ if (device.sua) {
759
+ deviceProps.sua = pick(device.sua, [ 'browsers', 'platform', 'model' ]);
760
+ }
761
+
762
+ return deviceProps;
756
763
  }
757
764
 
758
765
  function getTopMostAccessibleWindow() {
@@ -227,17 +227,23 @@ function createEndpointQS(bidderRequest) {
227
227
  const qs = {};
228
228
  if (bidderRequest) {
229
229
  const ref = bidderRequest.refererInfo;
230
- if (ref?.location) {
231
- // RefererUrl will be removed in a future version.
232
- qs.RefererUrl = encodeURIComponent(ref.location);
233
- if (ref.numIframes > 0) {
234
- qs.SafeFrame = true;
230
+ if (ref) {
231
+ if (ref.location) {
232
+ // RefererUrl will be removed in a future version.
233
+ qs.RefererUrl = encodeURIComponent(ref.location);
234
+ if (!ref.reachedTop) {
235
+ qs.SafeFrame = true;
236
+ }
235
237
  }
238
+
239
+ qs.PageUrl = encodeURIComponent(ref.topmostLocation);
240
+ qs.PageReferrer = encodeURIComponent(ref.location);
236
241
  }
237
242
 
243
+ // retreive info from ortb2 object if present (prebid7)
238
244
  const siteInfo = bidderRequest.ortb2?.site;
239
245
  if (siteInfo) {
240
- qs.PageUrl = encodeURIComponent(siteInfo.page);
246
+ qs.PageUrl = encodeURIComponent(siteInfo.page || ref?.topmostLocation);
241
247
  qs.PageReferrer = encodeURIComponent(siteInfo.ref || ref?.location);
242
248
  }
243
249
  }
@@ -4,6 +4,7 @@ import {
4
4
  deepSetValue,
5
5
  getDNT,
6
6
  inIframe,
7
+ isArray,
7
8
  isFn,
8
9
  logWarn,
9
10
  parseSizesInput,
@@ -19,6 +20,7 @@ const BIDDER_CODE = 'aso';
19
20
  const DEFAULT_SERVER_URL = 'https://srv.aso1.net';
20
21
  const DEFAULT_SERVER_PATH = '/prebid/bidder';
21
22
  const OUTSTREAM_RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';
23
+ const VERSION = '$prebid.version$_1.1';
22
24
  const TTL = 300;
23
25
 
24
26
  export const spec = {
@@ -59,7 +61,7 @@ export const spec = {
59
61
 
60
62
  serverRequests.push({
61
63
  method: 'POST',
62
- url: getEnpoint(bidRequest),
64
+ url: getEndpoint(bidRequest),
63
65
  data: payload,
64
66
  options: {
65
67
  withCredentials: true,
@@ -272,11 +274,9 @@ function createVideoImp(bidRequest, videoParams) {
272
274
  return imp;
273
275
  }
274
276
 
275
- function getEnpoint(bidRequest) {
276
- const serverUrl = bidRequest.params.serverUrl || DEFAULT_SERVER_URL;
277
- const serverPath = bidRequest.params.serverPath || DEFAULT_SERVER_PATH;
278
-
279
- return serverUrl + serverPath + '?zid=' + bidRequest.params.zone + '&pbjs=$prebid.version$';
277
+ function getEndpoint(bidRequest) {
278
+ const serverUrl = bidRequest.params.server || DEFAULT_SERVER_URL;
279
+ return serverUrl + DEFAULT_SERVER_PATH + '?zid=' + bidRequest.params.zone + '&pbjs=' + VERSION;
280
280
  }
281
281
 
282
282
  function getConsentsIds(gdprConsent) {
@@ -341,6 +341,11 @@ function createBasePayload(bidRequest, bidderRequest) {
341
341
  deepSetValue(payload, 'user.ext.eids', eids);
342
342
  }
343
343
 
344
+ const schainData = deepAccess(bidRequest, 'schain.nodes');
345
+ if (isArray(schainData) && schainData.length > 0) {
346
+ deepSetValue(payload, 'source.ext.schain', bidRequest.schain);
347
+ }
348
+
344
349
  return payload;
345
350
  }
346
351
 
@@ -14,12 +14,11 @@ For more information, please visit [Adserver.Online](https://adserver.online).
14
14
 
15
15
  # Parameters
16
16
 
17
- | Name | Scope | Description | Example | Type |
18
- |---------------|----------|-------------------------|-----------|-----------|
19
- | `zone` | required | Zone ID | `73815` | `Integer` |
20
- | `attr` | optional | Custom targeting params | `{keywords: ["a", "b"]}` | `Object` |
21
-
22
-
17
+ | Name | Scope | Description | Example | Type |
18
+ |-----------|----------|-------------------------|------------------------|------------|
19
+ | `zone` | required | Zone ID | `73815` | `Integer` |
20
+ | `attr` | optional | Custom targeting params | `{foo: ["a", "b"]}` | `Object` |
21
+ | `server` | optional | Custom bidder endpoint | `https://endpoint.url` | `String` |
23
22
 
24
23
  # Test parameters for banner
25
24
  ```js
@@ -75,6 +75,26 @@ function buildRequests(bidReqs, bidderRequest) {
75
75
  deepSetValue(brightcomBidReq, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
76
76
  }
77
77
 
78
+ if (bidderRequest && bidderRequest.uspConsent) {
79
+ deepSetValue(brightcomBidReq, 'regs.ext.us_privacy', bidderRequest.uspConsent);
80
+ }
81
+
82
+ if (config.getConfig('coppa') === true) {
83
+ deepSetValue(brightcomBidReq, 'regs.coppa', 1);
84
+ }
85
+
86
+ if (bidReqs[0] && bidReqs[0].schain) {
87
+ deepSetValue(brightcomBidReq, 'source.ext.schain', bidReqs[0].schain)
88
+ }
89
+
90
+ if (bidReqs[0] && bidReqs[0].userIdAsEids) {
91
+ deepSetValue(brightcomBidReq, 'user.ext.eids', bidReqs[0].userIdAsEids || [])
92
+ }
93
+
94
+ if (bidReqs[0] && bidReqs[0].userId) {
95
+ deepSetValue(brightcomBidReq, 'user.ext.ids', bidReqs[0].userId || [])
96
+ }
97
+
78
98
  return {
79
99
  method: 'POST',
80
100
  url: URL,
@@ -103,7 +123,7 @@ function interpretResponse(serverResponse) {
103
123
  logWarn('Brightcom server returned empty/non-json response: ' + JSON.stringify(serverResponse.body));
104
124
  return [];
105
125
  }
106
- const { body: {id, seatbid} } = serverResponse;
126
+ const {body: {id, seatbid}} = serverResponse;
107
127
  try {
108
128
  const brightcomBidResponses = [];
109
129
  if (id &&
@@ -164,9 +184,9 @@ function _isViewabilityMeasurable(element) {
164
184
  return !_isIframe() && element !== null;
165
185
  }
166
186
 
167
- function _getViewability(element, topWin, { w, h } = {}) {
187
+ function _getViewability(element, topWin, {w, h} = {}) {
168
188
  return getWindowTop().document.visibilityState === 'visible'
169
- ? _getPercentInView(element, topWin, { w, h })
189
+ ? _getPercentInView(element, topWin, {w, h})
170
190
  : 0;
171
191
  }
172
192
 
@@ -182,8 +202,8 @@ function _getMinSize(sizes) {
182
202
  return sizes.reduce((min, size) => size.h * size.w < min.h * min.w ? size : min);
183
203
  }
184
204
 
185
- function _getBoundingBox(element, { w, h } = {}) {
186
- let { width, height, left, top, right, bottom } = element.getBoundingClientRect();
205
+ function _getBoundingBox(element, {w, h} = {}) {
206
+ let {width, height, left, top, right, bottom} = element.getBoundingClientRect();
187
207
 
188
208
  if ((width === 0 || height === 0) && w && h) {
189
209
  width = w;
@@ -192,7 +212,7 @@ function _getBoundingBox(element, { w, h } = {}) {
192
212
  bottom = top + h;
193
213
  }
194
214
 
195
- return { width, height, left, top, right, bottom };
215
+ return {width, height, left, top, right, bottom};
196
216
  }
197
217
 
198
218
  function _getIntersectionOfRects(rects) {
@@ -225,16 +245,16 @@ function _getIntersectionOfRects(rects) {
225
245
  return bbox;
226
246
  }
227
247
 
228
- function _getPercentInView(element, topWin, { w, h } = {}) {
229
- const elementBoundingBox = _getBoundingBox(element, { w, h });
248
+ function _getPercentInView(element, topWin, {w, h} = {}) {
249
+ const elementBoundingBox = _getBoundingBox(element, {w, h});
230
250
 
231
251
  // Obtain the intersection of the element and the viewport
232
- const elementInViewBoundingBox = _getIntersectionOfRects([ {
252
+ const elementInViewBoundingBox = _getIntersectionOfRects([{
233
253
  left: 0,
234
254
  top: 0,
235
255
  right: topWin.innerWidth,
236
256
  bottom: topWin.innerHeight
237
- }, elementBoundingBox ]);
257
+ }, elementBoundingBox]);
238
258
 
239
259
  let elementInViewArea, elementTotalArea;
240
260
 
@@ -5,12 +5,111 @@
5
5
  * @requires module:modules/userId
6
6
  */
7
7
 
8
- import { submodule } from '../src/hook.js';
9
- import { getStorageManager } from '../src/storageManager.js';
8
+ import {
9
+ logError,
10
+ logInfo,
11
+ logWarn
12
+ } from '../src/utils.js';
13
+ import {
14
+ ajax
15
+ } from '../src/ajax.js'
16
+ import {
17
+ submodule
18
+ } from '../src/hook.js';
19
+ import {
20
+ getStorageManager
21
+ } from '../src/storageManager.js';
10
22
 
11
23
  export const storage = getStorageManager();
12
24
 
13
- export const cookieKey = '_a1_f';
25
+ export const FUUID_COOKIE_NAME = '_a1_f';
26
+ export const AONEID_COOKIE_NAME = '_a1_d';
27
+ export const API_URL = 'https://penta.a.one.impact-ad.jp/aud';
28
+ const COOKIES_EXPIRES = 60 * 60 * 24 * 1000; // 24h
29
+ const LOG_PREFIX = 'User ID - dacId submodule: ';
30
+
31
+ /**
32
+ * @returns {{fuuid: string, uid: string}} -
33
+ */
34
+ function getCookieId() {
35
+ return {
36
+ fuuid: storage.getCookie(FUUID_COOKIE_NAME),
37
+ uid: storage.getCookie(AONEID_COOKIE_NAME)
38
+ };
39
+ }
40
+
41
+ /**
42
+ * set uid to cookie.
43
+ * @param {string} uid -
44
+ * @returns {void} -
45
+ */
46
+ function setAoneidToCookie(uid) {
47
+ if (uid) {
48
+ const expires = new Date(Date.now() + COOKIES_EXPIRES).toUTCString();
49
+ storage.setCookie(
50
+ AONEID_COOKIE_NAME,
51
+ uid,
52
+ expires,
53
+ 'none'
54
+ );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * @param {string} oid -
60
+ * @param {string} fuuid -
61
+ * @returns {string} -
62
+ */
63
+ function getApiUrl(oid, fuuid) {
64
+ return `${API_URL}?oid=${oid}&fu=${fuuid}`;
65
+ }
66
+
67
+ /**
68
+ * @param {string} oid -
69
+ * @param {string} fuuid -
70
+ * @returns {{callback: function}} -
71
+ */
72
+ function fetchAoneId(oid, fuuid) {
73
+ return {
74
+ callback: (callback) => {
75
+ const ret = {
76
+ fuuid,
77
+ uid: undefined
78
+ };
79
+ const callbacks = {
80
+ success: (response) => {
81
+ if (response) {
82
+ try {
83
+ const responseObj = JSON.parse(response);
84
+ if (responseObj.error) {
85
+ logWarn(LOG_PREFIX + 'There is no permission to use API: ' + responseObj.error);
86
+ return callback(ret);
87
+ }
88
+ if (!responseObj.uid) {
89
+ logWarn(LOG_PREFIX + 'AoneId is null');
90
+ return callback(ret);
91
+ }
92
+ ret.uid = responseObj.uid;
93
+ setAoneidToCookie(ret.uid);
94
+ } catch (error) {
95
+ logError(LOG_PREFIX + error);
96
+ }
97
+ }
98
+ callback(ret);
99
+ },
100
+ error: (error) => {
101
+ logError(LOG_PREFIX + error);
102
+ callback(ret);
103
+ }
104
+ };
105
+ const apiUrl = getApiUrl(oid, fuuid);
106
+ ajax(apiUrl, callbacks, undefined, {
107
+ method: 'GET',
108
+ withCredentials: true
109
+ });
110
+ },
111
+ };
112
+ }
14
113
 
15
114
  export const dacIdSystemSubmodule = {
16
115
  /**
@@ -20,38 +119,57 @@ export const dacIdSystemSubmodule = {
20
119
  name: 'dacId',
21
120
 
22
121
  /**
23
- * performs action to obtain id
24
- * @function
25
- * @returns { {id: {dacId: string}} | undefined }
122
+ * decode the stored id value for passing to bid requests
123
+ * @param { {fuuid: string, uid: string} } id
124
+ * @returns { {dacId: {fuuid: string, dacId: string} } | undefined }
26
125
  */
27
- getId: function() {
28
- const newId = storage.getCookie(cookieKey);
29
- if (!newId) {
30
- return undefined;
31
- }
32
- const result = {
33
- dacId: newId
126
+ decode(id) {
127
+ if (id && typeof id === 'object') {
128
+ return {
129
+ dacId: {
130
+ fuuid: id.fuuid,
131
+ id: id.uid
132
+ }
133
+ }
34
134
  }
35
- return {id: result};
36
135
  },
37
136
 
38
137
  /**
39
- * decode the stored id value for passing to bid requests
138
+ * performs action to obtain id
40
139
  * @function
41
- * @param { {dacId: string} } value
42
- * @returns { {dacId: {id: string} } | undefined }
140
+ * @returns { {id: {fuuid: string, uid: string}} | undefined }
43
141
  */
44
- decode: function(value) {
45
- if (value && typeof value === 'object') {
46
- const result = {};
47
- if (value.dacId) {
48
- result.id = value.dacId
49
- }
50
- return {dacId: result};
142
+ getId(config) {
143
+ const cookie = getCookieId();
144
+
145
+ if (!cookie.fuuid) {
146
+ logInfo(LOG_PREFIX + 'There is no fuuid in cookie')
147
+ return undefined;
51
148
  }
52
- return undefined;
53
- },
54
149
 
55
- }
150
+ if (cookie.fuuid && cookie.uid) {
151
+ logInfo(LOG_PREFIX + 'There is fuuid and AoneId in cookie')
152
+ return {
153
+ id: {
154
+ fuuid: cookie.fuuid,
155
+ uid: cookie.uid
156
+ }
157
+ };
158
+ }
159
+
160
+ const configParams = (config && config.params) || {};
161
+ if (!configParams || typeof configParams.oid !== 'string') {
162
+ logWarn(LOG_PREFIX + 'oid is not defined');
163
+ return {
164
+ id: {
165
+ fuuid: cookie.fuuid,
166
+ uid: undefined
167
+ }
168
+ };
169
+ }
170
+
171
+ return fetchAoneId(configParams.oid, cookie.fuuid);
172
+ }
173
+ };
56
174
 
57
175
  submodule('userId', dacIdSystemSubmodule);
@@ -1,7 +1,7 @@
1
1
  ## AudienceOne User ID Submodule
2
2
 
3
3
  AudienceOne ID, provided by [D.A.Consortium Inc.](https://www.dac.co.jp/), is ID for ad targeting by using 1st party cookie.
4
- Please contact D.A.Consortium Inc. before using this ID.
4
+ Please visit [https://solutions.dac.co.jp/audienceone](https://solutions.dac.co.jp/audienceone) and request your Owner ID to get started.
5
5
 
6
6
  ## Building Prebid with AudienceOne ID Support
7
7
 
@@ -17,7 +17,10 @@ The following configuration parameters are available:
17
17
  pbjs.setConfig({
18
18
  userSync: {
19
19
  userIds: [{
20
- name: 'dacId'
20
+ name: 'dacId',
21
+ params: {
22
+ 'oid': '55h67qm4ck37vyz5'
23
+ }
21
24
  }]
22
25
  }
23
26
  });
@@ -26,3 +29,5 @@ pbjs.setConfig({
26
29
  | Param under userSync.userIds[] | Scope | Type | Description | Example |
27
30
  | --- | --- | --- | --- | --- |
28
31
  | name | Required | String | The name of this module. | `"dacId"` |
32
+ | params | Required | Object | Details of module params. | |
33
+ | params.oid | Required | String | This is the Owner ID value obtained via D.A.Consortium Inc. | `"55h67qm4ck37vyz5"` |
@@ -1,34 +1,33 @@
1
- ## Overview
1
+ # Overview
2
+ This module allows Prebid.js to support FLEDGE by integrating it with GPT's [experimental FLEDGE
3
+ support](https://github.com/google/ads-privacy/tree/master/proposals/fledge-multiple-seller-testing).
2
4
 
3
- This module enables the handling of fledge auction by GPT.
4
- Bid adapters can now return component auction configs in addition to bids.
5
+ To learn more about FLEDGE in general, go [here](https://github.com/WICG/turtledove/blob/main/FLEDGE.md).
5
6
 
6
- Those component auction configs will be registered to the GPT ad slot,
7
- and GPT will be responsible to run fledge auction and render the winning fledge ad.
7
+ This document covers the steps necessary for publishers to enable FLEDGE on their inventory. It also describes
8
+ the changes Bid Adapters need to implement in order to support FLEDGE.
8
9
 
9
- Find out more [here](https://github.com/WICG/turtledove/blob/main/FLEDGE.md).
10
-
11
- ## Integration
12
-
13
- Build the fledge module into the Prebid.js package with:
10
+ ## Publisher Integration
11
+ Publishers wishing to enable FLEDGE support must do two things. First, they must compile Prebid.js with support for this module.
12
+ This is accomplished by adding the `fledgeForGpt` module to the list of modules they are already using:
14
13
 
15
14
  ```
16
15
  gulp build --modules=fledgeForGpt,...
17
16
  ```
18
17
 
19
- ## Module Configuration Parameters
18
+ Second, they must enable FLEDGE in their Prebid.js configuration. To provide a high degree of flexiblity for testing, FLEDGE
19
+ settings exist at the module level, the bidder level, and the slot level.
20
+
21
+ ### Module Configuration
22
+ This module exposes the following settings:
20
23
 
21
24
  |Name |Type |Description |Notes |
22
25
  | :------------ | :------------ | :------------ |:------------ |
23
26
  |enabled | Boolean |Enable/disable the module |Defaults to `false` |
24
27
 
25
- ## Configuration
28
+ As noted above, FLEDGE support is disabled by default. To enable it, set the `enabled` value to `true` for this module
29
+ using the `setConfig` method of Prebid.js:
26
30
 
27
- Fledge support need to be enabled at 3 levels:
28
- - `fledgeForGpt` module
29
- - bidder
30
- - adunit
31
- ### enabling the fledgeForGpt module
32
31
  ```js
33
32
  pbjs.que.push(function() {
34
33
  pbjs.setConfig({
@@ -39,7 +38,17 @@ pbjs.que.push(function() {
39
38
  });
40
39
  ```
41
40
 
42
- ### enablingthe bidder
41
+ ### Bidder Configuration
42
+ This module adds the following setting for bidders:
43
+
44
+ |Name |Type |Description |Notes |
45
+ | :------------ | :------------ | :------------ |:------------ |
46
+ | fledgeEnabled | Boolean | Enable/disable a bidder to participate in FLEDGE | Defaults to `false` |
47
+
48
+ In addition to enabling FLEDGE at the module level, individual bidders must also be enabled. This allows publishers to
49
+ selectively test with one or more bidders as they desire. To enable one or more bidders, use the `setBidderConfig` method
50
+ of Prebid.js:
51
+
43
52
  ```js
44
53
  pbjs.setBidderConfig({
45
54
  bidders: ["openx"],
@@ -49,12 +58,81 @@ pbjs.setBidderConfig({
49
58
  });
50
59
  ```
51
60
 
52
- ### enabling the adunit
53
- ortb2Imp.ext.ae on the adunit must be set 1
61
+ ### AdUnit Configuration
62
+ Enabling an adunit for FLEDGE eligibility is accomplished by setting an attribute of the `ortb2Imp` object for that
63
+ adunit.
64
+
65
+ |Name |Type |Description |Notes |
66
+ | :------------ | :------------ | :------------ |:------------ |
67
+ | ortb2Imp.ext.ae | Integer | Auction Environment: 1 indicates FLEDGE eligible, 0 indicates it is not | Absence indicates this is not FLEDGE eligible |
68
+
69
+ The `ae` field stands for Auction Environment and was chosen to be consistent with the field that GAM passes to bidders
70
+ in their Open Bidding and Exchange Bidding APIs. More details on that can be found
71
+ [here](https://github.com/google/ads-privacy/tree/master/proposals/fledge-rtb#bid-request-changes-indicating-interest-group-auction-support)
72
+ In practice, this looks as follows:
73
+
54
74
  ```js
55
- ortb2Imp: {
56
- ext: {
57
- ae: 1
75
+ pbjs.addAdUnits({
76
+ code: "my-adunit-div",
77
+ // other config here
78
+ ortb2Imp: {
79
+ ext: {
80
+ ae: 1
81
+ }
82
+ }
83
+ });
84
+ ```
85
+
86
+ ## Bid Adapter Integration
87
+ Chrome has enabled a two-tier auction in FLEDGE. This allows multiple sellers (frequently SSPs) to act on behalf of the publisher with
88
+ a single entity serving as the final decision maker. In their [current approach](https://github.com/google/ads-privacy/tree/master/proposals/fledge-multiple-seller-testing),
89
+ GPT has opted to run the final auction layer while allowing other SSPs/sellers to participate as
90
+ [Component Auctions](https://github.com/WICG/turtledove/blob/main/FLEDGE.md#21-initiating-an-on-device-auction) which feed their
91
+ bids to the final layer. To learn more about Component Auctions, go [here](https://github.com/WICG/turtledove/blob/main/FLEDGE.md#24-scoring-bids-in-component-auctions).
92
+
93
+ The FLEDGE auction, including Component Auctions, are configured via an `AuctionConfig` object that defines the parameters of the auction for a given
94
+ seller. This module enables FLEDGE support by allowing bid adaptors to return `AuctionConfig` objects in addition to bids. If a bid adaptor returns an
95
+ `AuctionConfig` object, Prebid.js will register it with the appropriate GPT ad slot so the bidder can participate as a Component Auction in the overall
96
+ FLEDGE auction for that slot. More details on the GPT API can be found [here](https://developers.google.com/publisher-tag/reference#googletag.config.componentauctionconfig).
97
+
98
+ Modifying a bid adapter to support FLEDGE is a straightforward process and consists of the following steps:
99
+ 1. Detecting when a bid request is FLEDGE eligible
100
+ 2. Responding with AuctionConfig
101
+
102
+ FLEDGE eligibility is made available to bid adapters through the `bidderRequest.fledgeEnabled` field.
103
+ The [`bidderRequest`](https://docs.prebid.org/dev-docs/bidder-adaptor.html#bidderrequest-parameters) object is passed to
104
+ the [`buildRequests`](https://docs.prebid.org/dev-docs/bidder-adaptor.html#building-the-request) method of an adapter. Bid adapters
105
+ who wish to participate should read this flag and pass it to their server. FLEDGE eligibility depends on a number of parameters:
106
+
107
+ 1. Chrome enablement
108
+ 2. Publisher participatipon in the [Origin Trial](https://developer.chrome.com/docs/privacy-sandbox/unified-origin-trial/#configure)
109
+ 3. Publisher Prebid.js configuration (detailed above)
110
+
111
+ When a bid request is FLEDGE enabled, a bid adapter can return a tuple consisting of bids and AuctionConfig objects rather than just a list of bids:
112
+
113
+ ```js
114
+ function interpretResponse(resp, req) {
115
+ // Load the bids from the response - this is adapter specific
116
+ const bids = parseBids(resp);
117
+
118
+ // Load the auctionConfigs from the response - also adapter specific
119
+ const auctionConfigs = parseAuctionConfigs(resp);
120
+
121
+ if (auctionConfigs) {
122
+ // Return a tuple of bids and auctionConfigs. It is possible that bids could be null.
123
+ return {bids, auctionConfigs};
124
+ } else {
125
+ return bids;
58
126
  }
59
127
  }
60
128
  ```
129
+
130
+ An AuctionConfig must be associated with an adunit and auction, and this is accomplished using the value in the `bidId` field from the objects in the
131
+ `validBidRequests` array passed to the `buildRequests` function - see [here](https://docs.prebid.org/dev-docs/bidder-adaptor.html#ad-unit-params-in-the-validbidrequests-array)
132
+ for more details. This means that the AuctionConfig objects returned from `interpretResponse` must contain a `bidId` field whose value corresponds to
133
+ the request it should be associated with. This may raise the question: why isn't the AuctionConfig object returned as part of the bid? The
134
+ answer is that it's possible to participate in the FLEDGE auction without returning a contextual bid.
135
+
136
+ An example of this can be seen in the OpenX OpenRTB bid adapter [here](https://github.com/prebid/Prebid.js/blob/master/modules/openxOrtbBidAdapter.js#L327).
137
+
138
+ Other than the addition of the `bidId` field, the AuctionConfig object should adhere to the requirements set forth in FLEDGE. The details of creating an AuctionConfig object are beyond the scope of this document.