prebid.js 6.0.0 → 6.4.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 (201) hide show
  1. package/.babelrc.js +1 -7
  2. package/.circleci/config.yml +1 -1
  3. package/README.md +1 -1
  4. package/browsers.json +13 -29
  5. package/gulpfile.js +88 -82
  6. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  7. package/karma.conf.maker.js +2 -2
  8. package/modules/33acrossBidAdapter.js +189 -102
  9. package/modules/adagioBidAdapter.js +1 -1
  10. package/modules/addefendBidAdapter.js +1 -0
  11. package/modules/adheseBidAdapter.js +7 -2
  12. package/modules/adkernelBidAdapter.js +147 -61
  13. package/modules/adlivetechBidAdapter.md +61 -0
  14. package/modules/adlooxAdServerVideo.js +2 -2
  15. package/modules/adlooxAnalyticsAdapter.js +4 -4
  16. package/modules/admanBidAdapter.js +1 -0
  17. package/modules/admixerBidAdapter.js +3 -2
  18. package/modules/adnuntiusBidAdapter.js +5 -2
  19. package/modules/adomikAnalyticsAdapter.js +16 -4
  20. package/modules/adplusBidAdapter.js +203 -0
  21. package/modules/adplusBidAdapter.md +39 -0
  22. package/modules/adxcgBidAdapter.js +311 -359
  23. package/modules/adxcgBidAdapter.md +22 -21
  24. package/modules/adyoulikeBidAdapter.js +7 -2
  25. package/modules/aniviewBidAdapter.js +1 -1
  26. package/modules/appnexusBidAdapter.js +23 -3
  27. package/modules/beachfrontBidAdapter.js +14 -17
  28. package/modules/beopBidAdapter.js +6 -4
  29. package/modules/bidViewability.js +3 -3
  30. package/modules/bidViewabilityIO.js +3 -3
  31. package/modules/codefuelBidAdapter.js +1 -3
  32. package/modules/codefuelBidAdapter.md +3 -3
  33. package/modules/colossussspBidAdapter.js +7 -0
  34. package/modules/compassBidAdapter.js +201 -0
  35. package/modules/compassBidAdapter.md +79 -0
  36. package/modules/craftBidAdapter.js +5 -3
  37. package/modules/criteoBidAdapter.js +1 -1
  38. package/modules/currency.js +2 -2
  39. package/modules/cwireBidAdapter.js +3 -0
  40. package/modules/dailyhuntBidAdapter.js +435 -0
  41. package/modules/dailyhuntBidAdapter.md +4 -0
  42. package/modules/datablocksBidAdapter.js +3 -3
  43. package/modules/dchain.js +149 -0
  44. package/modules/dchain.md +45 -0
  45. package/modules/deepintentBidAdapter.js +1 -1
  46. package/modules/dspxBidAdapter.js +1 -1
  47. package/modules/emx_digitalBidAdapter.js +9 -1
  48. package/modules/engageyaBidAdapter.js +68 -54
  49. package/modules/feedadBidAdapter.js +2 -2
  50. package/modules/feedadBidAdapter.md +4 -2
  51. package/modules/freewheel-sspBidAdapter.js +6 -0
  52. package/modules/futureads.md +48 -0
  53. package/modules/glimpseBidAdapter.js +44 -16
  54. package/modules/goldbachBidAdapter.js +1176 -0
  55. package/modules/goldbachBidAdapter.md +151 -0
  56. package/modules/gptPreAuction.js +11 -5
  57. package/modules/gridBidAdapter.js +5 -4
  58. package/modules/gumgumBidAdapter.js +7 -3
  59. package/modules/id5IdSystem.md +6 -6
  60. package/modules/imRtdProvider.js +31 -0
  61. package/modules/improvedigitalBidAdapter.js +19 -3
  62. package/modules/instreamTracking.js +4 -4
  63. package/modules/intersectionRtdProvider.js +114 -0
  64. package/modules/invibesBidAdapter.js +64 -14
  65. package/modules/invibesBidAdapter.md +2 -1
  66. package/modules/ipromBidAdapter.js +79 -0
  67. package/modules/ixBidAdapter.js +185 -22
  68. package/modules/kinessoIdSystem.js +1 -1
  69. package/modules/limelightDigitalBidAdapter.js +2 -1
  70. package/modules/livewrappedBidAdapter.js +8 -2
  71. package/modules/lotamePanoramaIdSystem.js +80 -8
  72. package/modules/luponmediaBidAdapter.js +570 -0
  73. package/modules/mediasquareBidAdapter.js +1 -9
  74. package/modules/merkleIdSystem.js +5 -0
  75. package/modules/missenaBidAdapter.js +89 -0
  76. package/modules/nativoBidAdapter.js +27 -1
  77. package/modules/nextMillenniumBidAdapter.js +37 -7
  78. package/modules/oguryBidAdapter.js +2 -1
  79. package/modules/openxBidAdapter.js +6 -1
  80. package/modules/prebidServerBidAdapter/index.js +19 -15
  81. package/modules/pubgeniusBidAdapter.js +1 -1
  82. package/modules/pubmaticBidAdapter.js +5 -3
  83. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  84. package/modules/relaidoBidAdapter.js +86 -65
  85. package/modules/richaudienceBidAdapter.js +2 -3
  86. package/modules/rtdModule/index.js +48 -18
  87. package/modules/rubiconBidAdapter.js +31 -19
  88. package/modules/saambaaBidAdapter.js +420 -0
  89. package/modules/saambaaBidAdapter.md +65 -68
  90. package/modules/seedtagBidAdapter.js +6 -0
  91. package/modules/sharedIdSystem.js +27 -1
  92. package/modules/smaatoBidAdapter.js +9 -1
  93. package/modules/smartxBidAdapter.js +17 -1
  94. package/modules/sspBCBidAdapter.js +34 -3
  95. package/modules/tappxBidAdapter.js +3 -1
  96. package/modules/targetVideoBidAdapter.js +187 -0
  97. package/modules/targetVideoBidAdapter.md +34 -0
  98. package/modules/telariaBidAdapter.js +2 -2
  99. package/modules/trustxBidAdapter.js +18 -17
  100. package/modules/undertoneBidAdapter.js +8 -1
  101. package/modules/userId/index.js +27 -2
  102. package/modules/ventes.md +71 -0
  103. package/modules/ventesBidAdapter.js +104 -64
  104. package/modules/ventesBidAdapter.md +0 -1
  105. package/modules/vidoomyBidAdapter.js +65 -108
  106. package/modules/visxBidAdapter.js +20 -3
  107. package/modules/visxBidAdapter.md +4 -6
  108. package/modules/weboramaRtdProvider.js +288 -73
  109. package/modules/weboramaRtdProvider.md +27 -10
  110. package/modules/yahoosspBidAdapter.js +5 -1
  111. package/modules/yahoosspBidAdapter.md +1 -1
  112. package/modules/yieldlabBidAdapter.js +41 -10
  113. package/modules/yieldlabBidAdapter.md +91 -48
  114. package/modules/yieldoneBidAdapter.js +115 -11
  115. package/modules/zetaSspBidAdapter.md +33 -1
  116. package/modules/zeta_global_sspBidAdapter.js +22 -1
  117. package/package.json +6 -1
  118. package/plugins/pbjsGlobals.js +28 -1
  119. package/src/adapterManager.js +14 -8
  120. package/src/auction.js +5 -4
  121. package/src/prebid.js +1 -2
  122. package/src/targeting.js +24 -3
  123. package/src/utils.js +41 -7
  124. package/test/helpers/prebidGlobal.js +1 -0
  125. package/test/spec/integration/faker/googletag.js +6 -0
  126. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  127. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  128. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  129. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  130. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  131. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  132. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  133. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  134. package/test/spec/modules/appnexusBidAdapter_spec.js +63 -1
  135. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  136. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  137. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  138. package/test/spec/modules/bidViewability_spec.js +4 -4
  139. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  140. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  141. package/test/spec/modules/compassBidAdapter_spec.js +397 -0
  142. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  143. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  144. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  145. package/test/spec/modules/dchain_spec.js +329 -0
  146. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  147. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  148. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  149. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  150. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  151. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  152. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  153. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  154. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  155. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  156. package/test/spec/modules/improvedigitalBidAdapter_spec.js +3 -1
  157. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  158. package/test/spec/modules/invibesBidAdapter_spec.js +148 -4
  159. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  160. package/test/spec/modules/ixBidAdapter_spec.js +293 -2
  161. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  162. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  163. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  164. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  165. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  166. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  167. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  168. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  169. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  170. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  171. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  172. package/test/spec/modules/openxBidAdapter_spec.js +5 -0
  173. package/test/spec/modules/prebidServerBidAdapter_spec.js +62 -2
  174. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  175. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  176. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  177. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  178. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  179. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  180. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  181. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  182. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  183. package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
  184. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  185. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  186. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  187. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  188. package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
  189. package/test/spec/modules/userId_spec.js +51 -0
  190. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  191. package/test/spec/modules/visxBidAdapter_spec.js +121 -5
  192. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  193. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  194. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  195. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  196. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  197. package/test/spec/unit/core/adapterManager_spec.js +24 -6
  198. package/test/spec/unit/core/targeting_spec.js +116 -0
  199. package/test/spec/utils_spec.js +38 -0
  200. package/test/test_deps.js +3 -0
  201. package/test/test_index.js +1 -3
@@ -0,0 +1,149 @@
1
+ import includes from 'core-js-pure/features/array/includes.js';
2
+ import { config } from '../src/config.js';
3
+ import { getHook } from '../src/hook.js';
4
+ import { _each, isStr, isArray, isPlainObject, hasOwn, deepClone, deepAccess, logWarn, logError } from '../src/utils.js';
5
+
6
+ const shouldBeAString = ' should be a string';
7
+ const shouldBeAnObject = ' should be an object';
8
+ const shouldBeAnArray = ' should be an Array';
9
+ const shouldBeValid = ' is not a valid dchain property';
10
+ const MODE = {
11
+ STRICT: 'strict',
12
+ RELAXED: 'relaxed',
13
+ OFF: 'off'
14
+ };
15
+ const MODES = []; // an array of modes
16
+ _each(MODE, mode => MODES.push(mode));
17
+
18
+ export function checkDchainSyntax(bid, mode) {
19
+ let dchainObj = deepClone(bid.meta.dchain);
20
+ let failPrefix = 'Detected something wrong in bid.meta.dchain object for bid:';
21
+ let failMsg = '';
22
+ const dchainPropList = ['ver', 'complete', 'nodes', 'ext'];
23
+
24
+ function appendFailMsg(msg) {
25
+ failMsg += '\n' + msg;
26
+ }
27
+
28
+ function printFailMsg() {
29
+ if (mode === MODE.STRICT) {
30
+ logError(failPrefix, bid, '\n', dchainObj, failMsg);
31
+ } else {
32
+ logWarn(failPrefix, bid, `\n`, dchainObj, failMsg);
33
+ }
34
+ }
35
+
36
+ let dchainProps = Object.keys(dchainObj);
37
+ dchainProps.forEach(prop => {
38
+ if (!includes(dchainPropList, prop)) {
39
+ appendFailMsg(`dchain.${prop}` + shouldBeValid);
40
+ }
41
+ });
42
+
43
+ if (dchainObj.complete !== 0 && dchainObj.complete !== 1) {
44
+ appendFailMsg(`dchain.complete should be 0 or 1`);
45
+ }
46
+
47
+ if (!isStr(dchainObj.ver)) {
48
+ appendFailMsg(`dchain.ver` + shouldBeAString);
49
+ }
50
+
51
+ if (hasOwn(dchainObj, 'ext')) {
52
+ if (!isPlainObject(dchainObj.ext)) {
53
+ appendFailMsg(`dchain.ext` + shouldBeAnObject);
54
+ }
55
+ }
56
+
57
+ if (!isArray(dchainObj.nodes)) {
58
+ appendFailMsg(`dchain.nodes` + shouldBeAnArray);
59
+ printFailMsg();
60
+ if (mode === MODE.STRICT) return false;
61
+ } else {
62
+ const nodesPropList = ['asi', 'bsid', 'rid', 'name', 'domain', 'ext'];
63
+ dchainObj.nodes.forEach((node, index) => {
64
+ if (!isPlainObject(node)) {
65
+ appendFailMsg(`dchain.nodes[${index}]` + shouldBeAnObject);
66
+ } else {
67
+ let nodeProps = Object.keys(node);
68
+ nodeProps.forEach(prop => {
69
+ if (!includes(nodesPropList, prop)) {
70
+ appendFailMsg(`dchain.nodes[${index}].${prop}` + shouldBeValid);
71
+ }
72
+
73
+ if (prop === 'ext') {
74
+ if (!isPlainObject(node.ext)) {
75
+ appendFailMsg(`dchain.nodes[${index}].ext` + shouldBeAnObject);
76
+ }
77
+ } else {
78
+ if (!isStr(node[prop])) {
79
+ appendFailMsg(`dchain.nodes[${index}].${prop}` + shouldBeAString);
80
+ }
81
+ }
82
+ });
83
+ }
84
+ });
85
+ }
86
+
87
+ if (failMsg.length > 0) {
88
+ printFailMsg();
89
+ if (mode === MODE.STRICT) {
90
+ return false;
91
+ }
92
+ }
93
+ return true;
94
+ }
95
+
96
+ function isValidDchain(bid) {
97
+ let mode = MODE.STRICT;
98
+ const dchainConfig = config.getConfig('dchain');
99
+
100
+ if (dchainConfig && isStr(dchainConfig.validation) && MODES.indexOf(dchainConfig.validation) != -1) {
101
+ mode = dchainConfig.validation;
102
+ }
103
+
104
+ if (mode === MODE.OFF) {
105
+ return true;
106
+ } else {
107
+ return checkDchainSyntax(bid, mode);
108
+ }
109
+ }
110
+
111
+ export function addBidResponseHook(fn, adUnitCode, bid) {
112
+ const basicDchain = {
113
+ ver: '1.0',
114
+ complete: 0,
115
+ nodes: []
116
+ };
117
+
118
+ if (deepAccess(bid, 'meta.networkId') && deepAccess(bid, 'meta.networkName')) {
119
+ basicDchain.nodes.push({ name: bid.meta.networkName, bsid: bid.meta.networkId.toString() });
120
+ }
121
+ basicDchain.nodes.push({ name: bid.bidderCode });
122
+
123
+ let bidDchain = deepAccess(bid, 'meta.dchain');
124
+ if (bidDchain && isPlainObject(bidDchain)) {
125
+ let result = isValidDchain(bid);
126
+
127
+ if (result) {
128
+ // extra check in-case mode is OFF and there is a setup issue
129
+ if (isArray(bidDchain.nodes)) {
130
+ bid.meta.dchain.nodes.push({ asi: bid.bidderCode });
131
+ } else {
132
+ logWarn('bid.meta.dchain.nodes did not exist or was not an array; did not append prebid dchain.', bid);
133
+ }
134
+ } else {
135
+ // remove invalid dchain
136
+ delete bid.meta.dchain;
137
+ }
138
+ } else {
139
+ bid.meta.dchain = basicDchain;
140
+ }
141
+
142
+ fn(adUnitCode, bid);
143
+ }
144
+
145
+ export function init() {
146
+ getHook('addBidResponse').before(addBidResponseHook, 35);
147
+ }
148
+
149
+ init();
@@ -0,0 +1,45 @@
1
+ # dchain module
2
+
3
+ Refer:
4
+ - https://iabtechlab.com/buyers-json-demand-chain/
5
+
6
+ ## Sample code for dchain setConfig and dchain object
7
+ ```
8
+ pbjs.setConfig({
9
+ "dchain": {
10
+ "validation": "strict"
11
+ }
12
+ });
13
+ ```
14
+
15
+ ```
16
+ bid.meta.dchain: {
17
+ "complete": 0,
18
+ "ver": "1.0",
19
+ "ext": {...},
20
+ "nodes": [{
21
+ "asi": "abc",
22
+ "bsid": "123",
23
+ "rid": "d4e5f6",
24
+ "name": "xyz",
25
+ "domain": "mno",
26
+ "ext": {...}
27
+ }, ...]
28
+ }
29
+ ```
30
+
31
+ ## Workflow
32
+ The dchain module is not enabled by default as it may not be necessary for all publishers.
33
+ If required, dchain module can be included as following
34
+ ```
35
+ $ gulp build --modules=dchain,pubmaticBidAdapter,openxBidAdapter,rubiconBidAdapter,sovrnBidAdapter
36
+ ```
37
+
38
+ The dchain module will validate a bidder's dchain object (if it was defined). Bidders should assign their dchain object into `bid.meta` field. If the dchain object is valid, it will remain in the bid object for later use.
39
+
40
+ If it was not defined, the dchain will create a default dchain object for prebid.
41
+
42
+ ## Validation modes
43
+ - ```strict```: It is the default validation mode. In this mode, dchain object will not be accpeted from adapters if it is invalid. Errors are thrown for invalid dchain object.
44
+ - ```relaxed```: In this mode, errors are thrown for an invalid dchain object but the invalid dchain object is still accepted from adapters.
45
+ - ```off```: In this mode, no validations are performed and dchain object is accepted as is from adapters.
@@ -162,7 +162,7 @@ function buildImpression(bid) {
162
162
  impression = {
163
163
  id: bid.bidId,
164
164
  tagid: bid.params.tagId || '',
165
- secure: window.location.protocol === 'https' ? 1 : 0,
165
+ secure: window.location.protocol === 'https:' ? 1 : 0,
166
166
  displaymanager: 'di_prebid',
167
167
  displaymanagerver: DI_M_V,
168
168
  ext: buildCustomParams(bid)
@@ -12,7 +12,7 @@ const GVLID = 602;
12
12
  export const spec = {
13
13
  code: BIDDER_CODE,
14
14
  gvlid: GVLID,
15
- aliases: ['dspx'],
15
+ aliases: [],
16
16
  supportedMediaTypes: [BANNER, VIDEO],
17
17
  isBidRequestValid: function(bid) {
18
18
  return !!(bid.params.placement);
@@ -257,10 +257,18 @@ export const spec = {
257
257
  tagid,
258
258
  secure
259
259
  };
260
+
261
+ // adding gpid support
262
+ let gpid = deepAccess(bid, 'ortb2Imp.ext.data.adserver.adslot');
263
+ if (!gpid) {
264
+ gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
265
+ }
266
+ if (gpid) {
267
+ data.ext = {gpid: gpid.toString()};
268
+ }
260
269
  let typeSpecifics = isVideo ? { video: emxAdapter.buildVideo(bid) } : { banner: emxAdapter.buildBanner(bid) };
261
270
  let bidfloorObj = bidfloor > 0 ? { bidfloor, bidfloorcur: DEFAULT_CUR } : {};
262
271
  let emxBid = Object.assign(data, typeSpecifics, bidfloorObj);
263
-
264
272
  emxImps.push(emxBid);
265
273
  });
266
274
 
@@ -1,7 +1,4 @@
1
- import {
2
- BANNER,
3
- NATIVE
4
- } from '../src/mediaTypes.js';
1
+ import { BANNER, NATIVE } from '../src/mediaTypes.js';
5
2
  import { createTrackPixelHtml } from '../src/utils.js';
6
3
 
7
4
  const {
@@ -10,14 +7,21 @@ const {
10
7
  const BIDDER_CODE = 'engageya';
11
8
  const ENDPOINT_URL = 'https://recs.engageya.com/rec-api/getrecs.json';
12
9
  const ENDPOINT_METHOD = 'GET';
10
+ const SUPPORTED_SIZES = [
11
+ [100, 75], [236, 202], [100, 100], [130, 130], [200, 200], [250, 250], [300, 272], [300, 250], [300, 230], [300, 214], [300, 187], [300, 166], [300, 150], [300, 133], [300, 120], [400, 200], [300, 200], [250, 377], [620, 410], [207, 311], [310, 166], [310, 333], [190, 106], [228, 132], [300, 174], [80, 60], [600, 500], [600, 600], [1080, 610], [1080, 610], [624, 350], [650, 1168], [1080, 1920], [300, 374], [336, 280]
12
+ ];
13
13
 
14
- function getPageUrl() {
15
- var pUrl = window.location.href;
16
- if (isInIframe()) {
17
- pUrl = document.referrer ? document.referrer : pUrl;
14
+ function getPageUrl(bidRequest, bidderRequest) {
15
+ if (bidRequest.params.pageUrl && bidRequest.params.pageUrl != '[PAGE_URL]') {
16
+ return bidRequest.params.pageUrl;
18
17
  }
19
- pUrl = encodeURIComponent(pUrl);
20
- return pUrl;
18
+ if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
19
+ return bidderRequest.refererInfo.referer;
20
+ }
21
+ const pageUrl = (isInIframe() && document.referrer)
22
+ ? document.referrer
23
+ : window.location.href;
24
+ return encodeURIComponent(pageUrl);
21
25
  }
22
26
 
23
27
  function isInIframe() {
@@ -33,13 +37,14 @@ function getImageSrc(rec) {
33
37
  return rec.thumbnail_path.indexOf('http') === -1 ? 'https:' + rec.thumbnail_path : rec.thumbnail_path;
34
38
  }
35
39
 
36
- function getImpressionTrackers(rec) {
40
+ function getImpressionTrackers(rec, response) {
41
+ const responseTrackers = [response.viewPxl];
37
42
  if (!rec.trackers) {
38
- return [];
43
+ return responseTrackers;
39
44
  }
40
45
  const impressionTrackers = rec.trackers.impressionPixels || [];
41
46
  const viewTrackers = rec.trackers.viewPixels || [];
42
- return [...impressionTrackers, ...viewTrackers];
47
+ return [...impressionTrackers, ...viewTrackers, ...responseTrackers];
43
48
  }
44
49
 
45
50
  function parseNativeResponse(rec, response) {
@@ -56,7 +61,7 @@ function parseNativeResponse(rec, response) {
56
61
  displayUrl: rec.url,
57
62
  cta: '',
58
63
  sponsoredBy: rec.displayName,
59
- impressionTrackers: getImpressionTrackers(rec),
64
+ impressionTrackers: getImpressionTrackers(rec, response),
60
65
  };
61
66
  }
62
67
 
@@ -74,56 +79,65 @@ function parseBannerResponse(rec, response) {
74
79
  }
75
80
  const title = rec.title && rec.title.trim() ? `<div class="eng_tag_ttl" style="display: none">${rec.title}</div>` : '';
76
81
  const displayName = rec.displayName && title ? `<div class="eng_tag_brnd" style="display: none">${rec.displayName}</div>` : '';
77
- const trackers = getImpressionTrackers(rec)
82
+ const trackers = getImpressionTrackers(rec, response)
78
83
  .map(createTrackPixelHtml)
79
84
  .join('');
80
85
  return `<html><body>${style}<div id="ENG_TAG"><a href="${rec.clickUrl}" target=_blank><img class="eng_tag_img" src="${getImageSrc(rec)}" style="width:${response.imageWidth}px;height:${response.imageHeight}px;" alt="${rec.title}"/>${displayName}${title}</a>${trackers}</div></body></html>`;
81
86
  }
82
87
 
88
+ function getImageSize(bidRequest) {
89
+ if (bidRequest.sizes && bidRequest.sizes.length > 0) {
90
+ return bidRequest.sizes[0];
91
+ } else if (bidRequest.nativeParams && bidRequest.nativeParams.image && bidRequest.nativeParams.image.sizes) {
92
+ return bidRequest.nativeParams.image.sizes;
93
+ }
94
+ return [-1, -1];
95
+ }
96
+
97
+ function isValidSize([width, height]) {
98
+ if (!width || !height) {
99
+ return false;
100
+ }
101
+ return SUPPORTED_SIZES.some(([supportedWidth, supportedHeight]) => supportedWidth === width && supportedHeight === height);
102
+ }
103
+
83
104
  export const spec = {
84
105
  code: BIDDER_CODE,
85
106
  supportedMediaTypes: [BANNER, NATIVE],
86
- isBidRequestValid: function (bid) {
87
- return bid && bid.params && bid.params.hasOwnProperty('widgetId') && bid.params.hasOwnProperty('websiteId') && !isNaN(bid.params.widgetId) && !isNaN(bid.params.websiteId);
107
+
108
+ isBidRequestValid: function (bidRequest) {
109
+ return bidRequest &&
110
+ bidRequest.params &&
111
+ bidRequest.params.hasOwnProperty('widgetId') &&
112
+ bidRequest.params.hasOwnProperty('websiteId') &&
113
+ !isNaN(bidRequest.params.widgetId) &&
114
+ !isNaN(bidRequest.params.websiteId) &&
115
+ isValidSize(getImageSize(bidRequest));
88
116
  },
89
117
 
90
118
  buildRequests: function (validBidRequests, bidderRequest) {
91
- var bidRequests = [];
92
- if (validBidRequests && validBidRequests.length > 0) {
93
- validBidRequests.forEach(function (bidRequest) {
94
- if (bidRequest.params) {
95
- var mediaType = bidRequest.hasOwnProperty('nativeParams') ? 1 : 2;
96
- var imageWidth = -1;
97
- var imageHeight = -1;
98
- if (bidRequest.sizes && bidRequest.sizes.length > 0) {
99
- imageWidth = bidRequest.sizes[0][0];
100
- imageHeight = bidRequest.sizes[0][1];
101
- } else if (bidRequest.nativeParams && bidRequest.nativeParams.image && bidRequest.nativeParams.image.sizes) {
102
- imageWidth = bidRequest.nativeParams.image.sizes[0];
103
- imageHeight = bidRequest.nativeParams.image.sizes[1];
104
- }
105
-
106
- var widgetId = bidRequest.params.widgetId;
107
- var websiteId = bidRequest.params.websiteId;
108
- var pageUrl = (bidRequest.params.pageUrl && bidRequest.params.pageUrl != '[PAGE_URL]') ? bidRequest.params.pageUrl : '';
109
- if (!pageUrl) {
110
- pageUrl = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) ? bidderRequest.refererInfo.referer : getPageUrl();
111
- }
112
- var bidId = bidRequest.bidId;
113
- var finalUrl = ENDPOINT_URL + '?pubid=0&webid=' + websiteId + '&wid=' + widgetId + '&url=' + pageUrl + '&ireqid=' + bidId + '&pbtpid=' + mediaType + '&imw=' + imageWidth + '&imh=' + imageHeight;
114
- if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprApplies && bidderRequest.consentString) {
115
- finalUrl += '&is_gdpr=1&gdpr_consent=' + bidderRequest.consentString;
116
- }
117
- bidRequests.push({
118
- url: finalUrl,
119
- method: ENDPOINT_METHOD,
120
- data: ''
121
- });
122
- }
123
- });
119
+ if (!validBidRequests) {
120
+ return [];
124
121
  }
125
-
126
- return bidRequests;
122
+ return validBidRequests.map(bidRequest => {
123
+ if (bidRequest.params) {
124
+ const mediaType = bidRequest.hasOwnProperty('nativeParams') ? 1 : 2;
125
+ const [imageWidth, imageHeight] = getImageSize(bidRequest);
126
+ const widgetId = bidRequest.params.widgetId;
127
+ const websiteId = bidRequest.params.websiteId;
128
+ const pageUrl = getPageUrl(bidRequest, bidderRequest);
129
+ const bidId = bidRequest.bidId;
130
+ let finalUrl = ENDPOINT_URL + '?pubid=0&webid=' + websiteId + '&wid=' + widgetId + '&url=' + pageUrl + '&ireqid=' + bidId + '&pbtpid=' + mediaType + '&imw=' + imageWidth + '&imh=' + imageHeight;
131
+ if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprApplies && bidderRequest.consentString) {
132
+ finalUrl += '&is_gdpr=1&gdpr_consent=' + bidderRequest.consentString;
133
+ }
134
+ return {
135
+ url: finalUrl,
136
+ method: ENDPOINT_METHOD,
137
+ data: ''
138
+ };
139
+ }
140
+ }).filter(Boolean);
127
141
  },
128
142
 
129
143
  interpretResponse: function (serverResponse, bidRequest) {
@@ -135,12 +149,12 @@ export const spec = {
135
149
  return response.recs.map(rec => {
136
150
  let bid = {
137
151
  requestId: response.ireqId,
138
- cpm: rec.ecpm,
139
152
  width: response.imageWidth,
140
153
  height: response.imageHeight,
141
154
  creativeId: rec.postId,
155
+ cpm: rec.pecpm || (rec.ecpm / 100),
142
156
  currency: 'USD',
143
- netRevenue: false,
157
+ netRevenue: !!rec.pecpm,
144
158
  ttl: 360,
145
159
  meta: { advertiserDomains: rec.domain ? [rec.domain] : [] },
146
160
  }
@@ -176,13 +176,13 @@ function isMediaTypesEmpty(mediaTypes) {
176
176
  * @return {FeedAdApiBidRequest}
177
177
  */
178
178
  function createApiBidRParams(request) {
179
- return {
179
+ return Object.assign({}, request.params, {
180
180
  ad_type: 0,
181
181
  client_token: request.params.clientToken,
182
182
  placement_id: request.params.placementId,
183
183
  sdk_version: `prebid_${VERSION}`,
184
184
  app_hybrid: false,
185
- };
185
+ });
186
186
  }
187
187
 
188
188
  /**
@@ -26,6 +26,7 @@ Prebid.JS adapter that connects to the FeedAd demand sources.
26
26
  params: {
27
27
  clientToken: 'your-client-token' // see below for more info
28
28
  placementId: 'your-placement-id' // see below for more info
29
+ decoration: 'decoration parameters' // optional, see below for info
29
30
  }
30
31
  }
31
32
  ]
@@ -35,7 +36,8 @@ Prebid.JS adapter that connects to the FeedAd demand sources.
35
36
 
36
37
  # Required Parameters
37
38
 
38
- | Parameter | Description |
39
- | --------- | ----------- |
39
+ | Parameter | Description |
40
+ |---------------| ----------- |
40
41
  | `clientToken` | Your FeedAd web client token. You can view your client token inside the FeedAd admin panel. |
41
42
  | `placementId` | You can choose placement IDs yourself. A placement ID should be named after the ad position inside your product. For example, if you want to display an ad inside a list of news articles, you could name it "ad-news-overview".<br> A placement ID may consist of lowercase `a-z`, `0-9`, `-` and `_`. You do not have to manually create the placement IDs before using them. Just specify them within the code, and they will appear in the FeedAd admin panel after the first request. <br> [Learn more](/concept/feed_ad/index.html) about Placement IDs and how they are grouped to play the same Creative. |
43
+ | `decoration` | Optional. If you want to apply a [decoration](https://docs.feedad.com/web/feed_ad/#decorations) to the ad.
@@ -312,6 +312,12 @@ export const spec = {
312
312
  requestParams._fw_us_privacy = bidderRequest.uspConsent;
313
313
  }
314
314
 
315
+ // Add schain object
316
+ var schain = currentBidRequest.schain;
317
+ if (schain) {
318
+ requestParams.schain = schain;
319
+ }
320
+
315
321
  var vastParams = currentBidRequest.params.vastUrlParams;
316
322
  if (typeof vastParams === 'object') {
317
323
  for (var key in vastParams) {
@@ -0,0 +1,48 @@
1
+ # Overview
2
+ Module Name: Future Ads Bidder Adapter
3
+ Module Type: Bidder Adapter
4
+ Maintainer: contact@futureads.io
5
+ # Description
6
+ Connects to Future Ads demand source to fetch bids.
7
+ Banner and Video formats are supported.
8
+ Please use ```futureads``` as the bidder code.
9
+ # Test Parameters
10
+ ```
11
+ var adUnits = [
12
+ {
13
+ code: 'desktop-banner-ad-div',
14
+ sizes: [[300, 250]], // a display size
15
+ bids: [
16
+ {
17
+ bidder: "futureads",
18
+ params: {
19
+ zone: '2eb6bd58-865c-47ce-af7f-a918108c3fd2'
20
+ }
21
+ }
22
+ ]
23
+ },{
24
+ code: 'mobile-banner-ad-div',
25
+ sizes: [[300, 50]], // a mobile size
26
+ bids: [
27
+ {
28
+ bidder: "futureads",
29
+ params: {
30
+ zone: '62211486-c50b-4356-9f0f-411778d31fcc'
31
+ }
32
+ }
33
+ ]
34
+ },{
35
+ code: 'video-ad',
36
+ sizes: [[300, 50]],
37
+ mediaType: 'video',
38
+ bids: [
39
+ {
40
+ bidder: "futureads",
41
+ params: {
42
+ zone: 'ebeb1e79-8cb4-4473-b2d0-2e24b7ff47fd'
43
+ }
44
+ }
45
+ ]
46
+ },
47
+ ];
48
+ ```
@@ -1,19 +1,22 @@
1
1
  import { BANNER } from '../src/mediaTypes.js'
2
+ import { config } from '../src/config.js'
2
3
  import { getStorageManager } from '../src/storageManager.js'
3
4
  import { isArray } from '../src/utils.js'
4
5
  import { registerBidder } from '../src/adapters/bidderFactory.js'
5
6
 
6
7
  const storageManager = getStorageManager()
7
8
 
9
+ const GVLID = 1012
8
10
  const BIDDER_CODE = 'glimpse'
9
11
  const ENDPOINT = 'https://api.glimpsevault.io/ads/serving/public/v1/prebid'
10
12
  const LOCAL_STORAGE_KEY = {
11
- glimpse: {
13
+ vault: {
12
14
  jwt: 'gp_vault_jwt',
13
15
  },
14
16
  }
15
17
 
16
18
  export const spec = {
19
+ gvlid: GVLID,
17
20
  code: BIDDER_CODE,
18
21
  supportedMediaTypes: [BANNER],
19
22
 
@@ -37,20 +40,28 @@ export const spec = {
37
40
  * @returns {ServerRequest}
38
41
  */
39
42
  buildRequests: (validBidRequests, bidderRequest) => {
40
- const networkId = window.networkId || -1
41
- const bids = validBidRequests.map(processBidRequest)
43
+ const demo = config.getConfig('glimpse.demo') || false
44
+ const account = config.getConfig('glimpse.account') || -1
45
+ const demand = config.getConfig('glimpse.demand') || 'glimpse'
46
+ const keywords = config.getConfig('glimpse.keywords') || {}
47
+
48
+ const auth = getVaultJwt()
42
49
  const referer = getReferer(bidderRequest)
43
50
  const gdprConsent = getGdprConsentChoice(bidderRequest)
44
- const jwt = getVaultJwt()
51
+ const bids = validBidRequests.map((bidRequest) => {
52
+ return processBidRequest(bidRequest, keywords)
53
+ })
45
54
 
46
55
  const data = {
47
- auth: jwt,
56
+ auth,
48
57
  data: {
49
58
  bidderCode: spec.code,
50
- networkId,
51
- bids,
59
+ demo,
60
+ account,
61
+ demand,
52
62
  referer,
53
63
  gdprConsent,
64
+ bids,
54
65
  }
55
66
  }
56
67
 
@@ -65,10 +76,9 @@ export const spec = {
65
76
  /**
66
77
  * Parse response from Glimpse server
67
78
  * @param bidResponse {ServerResponse}
68
- * @param bidRequest {BidRequest}
69
79
  * @returns {Bid[]}
70
80
  */
71
- interpretResponse: (bidResponse, bidRequest) => {
81
+ interpretResponse: (bidResponse) => {
72
82
  const isValidResponse = isValidBidResponse(bidResponse)
73
83
 
74
84
  if (isValidResponse) {
@@ -81,16 +91,20 @@ export const spec = {
81
91
  },
82
92
  }
83
93
 
84
- function processBidRequest(bidRequest) {
94
+ function processBidRequest(bidRequest, globalKeywords) {
85
95
  const sizes = normalizeSizes(bidRequest.sizes)
86
- const keywords = bidRequest.params.keywords || []
96
+ const bidKeywords = bidRequest.params.keywords || {}
97
+ const keywords = {
98
+ ...globalKeywords,
99
+ ...bidKeywords,
100
+ }
87
101
 
88
102
  return {
103
+ unitCode: bidRequest.adUnitCode,
89
104
  bidId: bidRequest.bidId,
90
105
  placementId: bidRequest.params.placementId,
91
- unitCode: bidRequest.adUnitCode,
92
- sizes,
93
106
  keywords,
107
+ sizes,
94
108
  }
95
109
  }
96
110
 
@@ -127,7 +141,14 @@ function getGdprConsentChoice(bidderRequest) {
127
141
  hasValue(bidderRequest.gdprConsent)
128
142
 
129
143
  if (hasGdprConsent) {
130
- return bidderRequest.gdprConsent
144
+ const gdprConsent = bidderRequest.gdprConsent
145
+ const hasGdprApplies = hasBooleanValue(gdprConsent.gdprApplies)
146
+
147
+ return {
148
+ consentString: gdprConsent.consentString || '',
149
+ vendorData: gdprConsent.vendorData || {},
150
+ gdprApplies: hasGdprApplies ? gdprConsent.gdprApplies : true,
151
+ }
131
152
  }
132
153
 
133
154
  return {
@@ -138,11 +159,11 @@ function getGdprConsentChoice(bidderRequest) {
138
159
  }
139
160
 
140
161
  function setVaultJwt(auth) {
141
- storageManager.setDataInLocalStorage(LOCAL_STORAGE_KEY.glimpse.jwt, auth)
162
+ storageManager.setDataInLocalStorage(LOCAL_STORAGE_KEY.vault.jwt, auth)
142
163
  }
143
164
 
144
165
  function getVaultJwt() {
145
- return storageManager.getDataFromLocalStorage(LOCAL_STORAGE_KEY.glimpse.jwt) || ''
166
+ return storageManager.getDataFromLocalStorage(LOCAL_STORAGE_KEY.vault.jwt) || ''
146
167
  }
147
168
 
148
169
  function isValidBidResponse(bidResponse) {
@@ -162,6 +183,13 @@ function hasValue(value) {
162
183
  )
163
184
  }
164
185
 
186
+ function hasBooleanValue(value) {
187
+ return (
188
+ hasValue(value) &&
189
+ typeof value === 'boolean'
190
+ )
191
+ }
192
+
165
193
  function hasStringValue(value) {
166
194
  return (
167
195
  hasValue(value) &&