prebid.js 5.17.0 → 6.0.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 (145) hide show
  1. package/.babelrc.js +3 -6
  2. package/README.md +3 -1
  3. package/browsers.json +1 -8
  4. package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
  5. package/modules/.submodules.json +1 -0
  6. package/modules/adfBidAdapter.js +21 -16
  7. package/modules/adgenerationBidAdapter.js +28 -4
  8. package/modules/adkernelBidAdapter.js +2 -1
  9. package/modules/admixerBidAdapter.js +11 -0
  10. package/modules/adtelligentBidAdapter.js +2 -1
  11. package/modules/airgridRtdProvider.js +1 -1
  12. package/modules/akamaiDapRtdProvider.js +474 -0
  13. package/modules/akamaiDapRtdProvider.md +47 -0
  14. package/modules/aolBidAdapter.js +2 -1
  15. package/modules/appnexusBidAdapter.js +5 -3
  16. package/modules/atsAnalyticsAdapter.js +67 -46
  17. package/modules/atsAnalyticsAdapter.md +1 -0
  18. package/modules/betweenBidAdapter.js +20 -3
  19. package/modules/bliinkBidAdapter.js +58 -32
  20. package/modules/bliinkBidAdapter.md +29 -6
  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 +183 -0
  25. package/modules/codefuelBidAdapter.md +111 -0
  26. package/modules/connectIdSystem.js +104 -0
  27. package/modules/connectIdSystem.md +33 -0
  28. package/modules/cwireBidAdapter.js +272 -0
  29. package/modules/cwireBidAdapter.md +43 -0
  30. package/modules/deepintentBidAdapter.js +106 -9
  31. package/modules/deepintentBidAdapter.md +36 -1
  32. package/modules/deltaprojectsBidAdapter.js +252 -0
  33. package/modules/deltaprojectsBidAdapter.md +32 -0
  34. package/modules/dgkeywordRtdProvider.js +0 -1
  35. package/modules/engageyaBidAdapter.js +157 -0
  36. package/modules/gridBidAdapter.js +1 -0
  37. package/modules/gumgumBidAdapter.js +8 -0
  38. package/modules/inskinBidAdapter.js +7 -3
  39. package/modules/ixBidAdapter.js +8 -1
  40. package/modules/jixieBidAdapter.js +8 -2
  41. package/modules/justpremiumBidAdapter.js +6 -1
  42. package/modules/limelightDigitalBidAdapter.js +22 -2
  43. package/modules/livewrappedAnalyticsAdapter.js +53 -3
  44. package/modules/mediakeysBidAdapter.js +2 -1
  45. package/modules/multibid/index.js +3 -3
  46. package/modules/nativoBidAdapter.js +6 -2
  47. package/modules/nextMillenniumBidAdapter.js +12 -3
  48. package/modules/oguryBidAdapter.js +36 -7
  49. package/modules/openxBidAdapter.js +34 -22
  50. package/modules/operaadsBidAdapter.js +21 -1
  51. package/modules/otmBidAdapter.js +146 -0
  52. package/modules/otmBidAdapter.md +27 -26
  53. package/modules/outbrainBidAdapter.js +5 -0
  54. package/modules/pixfutureBidAdapter.js +24 -4
  55. package/modules/pixfutureBidAdapter.md +127 -0
  56. package/modules/playwireBidAdapter.md +61 -0
  57. package/modules/prebidServerBidAdapter/index.js +1 -1
  58. package/modules/proxistoreBidAdapter.js +4 -6
  59. package/modules/publinkIdSystem.js +11 -6
  60. package/modules/pubmaticBidAdapter.js +9 -0
  61. package/modules/pubmaticBidAdapter.md +1 -1
  62. package/modules/rtdModule/index.js +2 -2
  63. package/modules/sonobiBidAdapter.js +7 -0
  64. package/modules/sortableBidAdapter.js +1 -0
  65. package/modules/talkadsBidAdapter.js +129 -0
  66. package/modules/talkadsBidAdapter.md +60 -0
  67. package/modules/teadsBidAdapter.js +3 -0
  68. package/modules/tripleliftBidAdapter.js +22 -5
  69. package/modules/trustxBidAdapter.js +8 -6
  70. package/modules/undertoneBidAdapter.js +9 -5
  71. package/modules/undertoneBidAdapter.md +5 -1
  72. package/modules/unicornBidAdapter.js +3 -3
  73. package/modules/userId/eids.js +18 -0
  74. package/modules/userId/eids.md +7 -0
  75. package/modules/userId/userId.md +12 -0
  76. package/modules/ventesBidAdapter.js +370 -0
  77. package/modules/ventesBidAdapter.md +94 -0
  78. package/modules/videobyteBidAdapter.js +13 -6
  79. package/modules/videobyteBidAdapter.md +49 -0
  80. package/modules/visxBidAdapter.js +15 -22
  81. package/modules/yahoosspBidAdapter.js +637 -0
  82. package/modules/yahoosspBidAdapter.md +795 -0
  83. package/modules/yieldlabBidAdapter.js +48 -3
  84. package/modules/yieldlabBidAdapter.md +16 -1
  85. package/modules/yieldmoSyntheticInventoryModule.js +46 -0
  86. package/modules/yieldmoSyntheticInventoryModule.md +68 -0
  87. package/package.json +1 -1
  88. package/src/adapterManager.js +5 -0
  89. package/src/adapters/bidderFactory.js +4 -3
  90. package/src/auction.js +11 -11
  91. package/src/constants.json +1 -0
  92. package/src/secureCreatives.js +6 -7
  93. package/src/targeting.js +11 -9
  94. package/test/spec/modules/adfBidAdapter_spec.js +83 -29
  95. package/test/spec/modules/adgenerationBidAdapter_spec.js +121 -50
  96. package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
  97. package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
  98. package/test/spec/modules/appnexusBidAdapter_spec.js +2 -1
  99. package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
  100. package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
  101. package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
  102. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  103. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  104. package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
  105. package/test/spec/modules/connectIdSystem_spec.js +189 -0
  106. package/test/spec/modules/cwireBidAdapter_spec.js +246 -0
  107. package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
  108. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  109. package/test/spec/modules/engageyaBidAdapter_spec.js +286 -0
  110. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
  111. package/test/spec/modules/ixBidAdapter_spec.js +13 -3
  112. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  113. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  114. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
  115. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +67 -12
  116. package/test/spec/modules/multibid_spec.js +31 -31
  117. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
  118. package/test/spec/modules/oguryBidAdapter_spec.js +125 -37
  119. package/test/spec/modules/openxBidAdapter_spec.js +85 -13
  120. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  121. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  122. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  123. package/test/spec/modules/publinkIdSystem_spec.js +6 -6
  124. package/test/spec/modules/pubmaticBidAdapter_spec.js +39 -1
  125. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  126. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  127. package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
  128. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  129. package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
  130. package/test/spec/modules/trustxBidAdapter_spec.js +3 -3
  131. package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
  132. package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
  133. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  134. package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
  135. package/test/spec/modules/visxBidAdapter_spec.js +48 -4
  136. package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
  137. package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
  138. package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
  139. package/test/spec/unit/core/adapterManager_spec.js +32 -0
  140. package/test/spec/unit/core/bidderFactory_spec.js +61 -1
  141. package/test/spec/unit/pbjs_api_spec.js +37 -2
  142. package/test/spec/unit/secureCreatives_spec.js +54 -25
  143. package/wdio.conf.js +1 -1
  144. package/modules/turktelekomBidAdapter.md +0 -49
  145. package/yarn.lock +0 -13122
@@ -1,9 +1,9 @@
1
- import { convertCamelToUnderscore, isArray, isNumber, isPlainObject, deepAccess, isEmpty, transformBidderParamKeywords, isFn } from '../src/utils.js';
2
1
  import { registerBidder } from '../src/adapters/bidderFactory.js';
3
2
  import { getStorageManager } from '../src/storageManager.js';
4
3
  import { BANNER } from '../src/mediaTypes.js';
5
4
  import { config } from '../src/config.js';
6
5
  import includes from 'core-js-pure/features/array/includes.js';
6
+ import { convertCamelToUnderscore, isArray, isNumber, isPlainObject, deepAccess, isEmpty, transformBidderParamKeywords, isFn } from '../src/utils.js';
7
7
  import { auctionManager } from '../src/auctionManager.js';
8
8
  import find from 'core-js-pure/features/array/find.js';
9
9
 
@@ -12,7 +12,7 @@ const storageManager = getStorageManager();
12
12
  const USER_PARAMS = ['age', 'externalUid', 'segments', 'gender', 'dnt', 'language'];
13
13
  export const spec = {
14
14
  code: 'pixfuture',
15
- hostname: 'https://prebid-js.pixfuture.com',
15
+ hostname: 'https://gosrv.pixfuture.com',
16
16
 
17
17
  getHostname() {
18
18
  let ret = this.hostname;
@@ -77,7 +77,7 @@ export const spec = {
77
77
  };
78
78
 
79
79
  if (bidderRequest && bidderRequest.uspConsent) {
80
- payload.us_privacy = bidderRequest.uspConsent
80
+ payload.us_privacy = bidderRequest.uspConsent;
81
81
  }
82
82
 
83
83
  if (bidderRequest && bidderRequest.refererInfo) {
@@ -112,7 +112,7 @@ export const spec = {
112
112
  }
113
113
 
114
114
  const ret = {
115
- url: `${hostname}/`,
115
+ url: `${hostname}/pixservices`,
116
116
  method: 'POST',
117
117
  options: {withCredentials: false},
118
118
  data: {
@@ -153,6 +153,16 @@ export const spec = {
153
153
 
154
154
  return bids;
155
155
  },
156
+ getUserSyncs: function (syncOptions, bid, gdprConsent) {
157
+ var pixid = '';
158
+ if (typeof bid[0] === 'undefined' || bid[0] === null) { pixid = '0'; } else { pixid = bid[0].body.pix_id; }
159
+ if (syncOptions.iframeEnabled && hasPurpose1Consent({gdprConsent})) {
160
+ return [{
161
+ type: 'iframe',
162
+ url: 'https://gosrv.pixfuture.com/cookiesync?adsync=' + gdprConsent.consentString + '&pixid=' + pixid + '&gdprconcent=' + gdprConsent.gdprApplies
163
+ }];
164
+ }
165
+ }
156
166
  };
157
167
 
158
168
  function newBid(serverBid, rtbBid, placementId, uuid) {
@@ -179,6 +189,16 @@ function newBid(serverBid, rtbBid, placementId, uuid) {
179
189
  return bid;
180
190
  }
181
191
 
192
+ function hasPurpose1Consent(bidderRequest) {
193
+ let result = true;
194
+ if (bidderRequest && bidderRequest.gdprConsent) {
195
+ if (bidderRequest.gdprConsent.gdprApplies && bidderRequest.gdprConsent.apiVersion === 2) {
196
+ result = !!(deepAccess(bidderRequest.gdprConsent, 'vendorData.purpose.consents.1') === true);
197
+ }
198
+ }
199
+ return result;
200
+ }
201
+
182
202
  // Functions related optional parameters
183
203
  function bidToTag(bid) {
184
204
  const tag = {};
@@ -25,3 +25,130 @@ var adUnits = [{
25
25
  "pix_id": "Abc123"
26
26
  }];
27
27
  ```
28
+
29
+ # Test Example
30
+ ...
31
+ <html>
32
+
33
+ <head>
34
+ <link rel="icon" type="image/png" href="/favicon.ico">
35
+ <script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
36
+ <script async src="https://cdn.pixfuture.com/pixfuture_prebidjs/prebid.js"></script>
37
+ <script>
38
+ var div_1_sizes = [
39
+ [300, 250],
40
+ [300, 600]
41
+ ];
42
+ var div_2_sizes = [
43
+ [728, 90],
44
+ [970, 250]
45
+ ];
46
+ var PREBID_TIMEOUT = 1000;
47
+ var FAILSAFE_TIMEOUT = 3000;
48
+
49
+ var adUnits = [
50
+ {
51
+ code: '/19968336/header-bid-tag-0',
52
+ mediaTypes: {
53
+ banner: {
54
+ sizes: div_1_sizes
55
+ }
56
+ },
57
+ bids: [{
58
+ bidder: 'pixfuture',
59
+ params: {
60
+ "pix_id": "777"
61
+ }
62
+ }]
63
+ },
64
+ {
65
+ code: '/19968336/header-bid-tag-1',
66
+ mediaTypes: {
67
+ banner: {
68
+ sizes: div_2_sizes
69
+ }
70
+ },
71
+ bids: [{
72
+ bidder: 'appnexus',
73
+ params: {
74
+ placementId: 13144370
75
+ }
76
+ }]
77
+ }
78
+ ];
79
+
80
+ // ======== DO NOT EDIT BELOW THIS LINE =========== //
81
+ var googletag = googletag || {};
82
+ googletag.cmd = googletag.cmd || [];
83
+ googletag.cmd.push(function() {
84
+ googletag.pubads().disableInitialLoad();
85
+ });
86
+
87
+ var pbjs = pbjs || {};
88
+ pbjs.que = pbjs.que || [];
89
+
90
+ pbjs.que.push(function() {
91
+ pbjs.addAdUnits(adUnits);
92
+ pbjs.requestBids({
93
+ bidsBackHandler: initAdserver,
94
+ timeout: PREBID_TIMEOUT
95
+ });
96
+ });
97
+
98
+ function initAdserver() {
99
+ if (pbjs.initAdserverSet) return;
100
+ pbjs.initAdserverSet = true;
101
+ googletag.cmd.push(function() {
102
+ pbjs.que.push(function() {
103
+ pbjs.setTargetingForGPTAsync();
104
+ googletag.pubads().refresh();
105
+ });
106
+ });
107
+ }
108
+ // in case PBJS doesn't load
109
+ setTimeout(function() {
110
+ initAdserver();
111
+ }, FAILSAFE_TIMEOUT);
112
+
113
+ googletag.cmd.push(function() {
114
+ googletag.defineSlot('/19968336/header-bid-tag-0', div_1_sizes, 'div-1').addService(googletag.pubads());
115
+ googletag.pubads().enableSingleRequest();
116
+ googletag.enableServices();
117
+ });
118
+ googletag.cmd.push(function() {
119
+ googletag.defineSlot('/19968336/header-bid-tag-1', div_2_sizes, 'div-2').addService(googletag.pubads());
120
+ googletag.pubads().enableSingleRequest();
121
+ googletag.enableServices();
122
+ });
123
+
124
+ </script>
125
+
126
+ </head>
127
+
128
+ <body>
129
+ <h2>Basic Prebid.js Example</h2>
130
+ <h5>Div-1</h5>
131
+ <div id='div-1'>
132
+ <script type='text/javascript'>
133
+ googletag.cmd.push(function() {
134
+ googletag.display('div-1');
135
+ });
136
+
137
+ </script>
138
+ </div>
139
+
140
+ <br>
141
+
142
+ <h5>Div-2</h5>
143
+ <div id='div-2'>
144
+ <script type='text/javascript'>
145
+ googletag.cmd.push(function() {
146
+ googletag.display('div-2');
147
+ });
148
+
149
+ </script>
150
+ </div>
151
+
152
+ </body>
153
+
154
+ </html>
@@ -0,0 +1,61 @@
1
+ # Overview
2
+
3
+ Module Name: Playwire Bidder Adapter
4
+ Module Type: Bidder Adapter
5
+ Maintainer: grid-tech@themediagrid.com
6
+
7
+ # Description
8
+
9
+ Module that connects to Grid demand source to fetch bids.
10
+ The adapter is GDPR compliant and supports banner and video (instream and outstream).
11
+
12
+ # Test Parameters
13
+ ```
14
+ var adUnits = [
15
+ {
16
+ code: 'test-div',
17
+ sizes: [[300, 250]],
18
+ bids: [
19
+ {
20
+ bidder: "playwire",
21
+ params: {
22
+ uid: '1',
23
+ bidFloor: 0.5
24
+ }
25
+ }
26
+ ]
27
+ },{
28
+ code: 'test-div',
29
+ sizes: [[728, 90]],
30
+ bids: [
31
+ {
32
+ bidder: "playwire",
33
+ params: {
34
+ uid: 2,
35
+ keywords: {
36
+ brandsafety: ['disaster'],
37
+ topic: ['stress', 'fear']
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ },
43
+ {
44
+ code: 'test-div',
45
+ sizes: [[728, 90]],
46
+ mediaTypes: { video: {
47
+ context: 'instream',
48
+ playerSize: [728, 90],
49
+ mimes: ['video/mp4']
50
+ },
51
+ bids: [
52
+ {
53
+ bidder: "playwire",
54
+ params: {
55
+ uid: 11
56
+ }
57
+ }
58
+ ]
59
+ }
60
+ ];
61
+ ```
@@ -799,7 +799,7 @@ const OPEN_RTB_PROTOCOL = {
799
799
  if (requestedBidders && isArray(requestedBidders)) {
800
800
  eidPermissions.forEach(i => {
801
801
  if (i.bidders) {
802
- i.bidders = i.bidders.filter(bidder => requestedBidders.includes(bidder))
802
+ i.bidders = i.bidders.filter(bidder => includes(requestedBidders, bidder))
803
803
  }
804
804
  });
805
805
  }
@@ -4,7 +4,8 @@ import { registerBidder } from '../src/adapters/bidderFactory.js';
4
4
  const BIDDER_CODE = 'proxistore';
5
5
  const PROXISTORE_VENDOR_ID = 418;
6
6
  const COOKIE_BASE_URL = 'https://abs.proxistore.com/v3/rtb/prebid/multi';
7
- const COOKIE_LESS_URL = 'https://abs.cookieless-proxistore.com/v3/rtb/prebid/multi';
7
+ const COOKIE_LESS_URL =
8
+ 'https://abs.cookieless-proxistore.com/v3/rtb/prebid/multi';
8
9
 
9
10
  function _createServerRequest(bidRequests, bidderRequest) {
10
11
  var sizeIds = [];
@@ -181,11 +182,7 @@ function _assignFloor(bid) {
181
182
  size: '*',
182
183
  });
183
184
 
184
- if (
185
- isPlainObject(floor) &&
186
- !isNaN(floor.floor) &&
187
- floor.currency === 'EUR'
188
- ) {
185
+ if (isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'EUR') {
189
186
  return floor.floor;
190
187
  }
191
188
  return null;
@@ -196,6 +193,7 @@ export const spec = {
196
193
  isBidRequestValid: isBidRequestValid,
197
194
  buildRequests: buildRequests,
198
195
  interpretResponse: interpretResponse,
196
+ gvlid: PROXISTORE_VENDOR_ID,
199
197
  };
200
198
 
201
199
  registerBidder(spec);
@@ -81,13 +81,18 @@ function getlocalValue() {
81
81
  }
82
82
 
83
83
  if (typeof value === 'string') {
84
- try {
85
- const obj = JSON.parse(value);
86
- if (obj && obj.exp && obj.exp > Date.now()) {
87
- return obj.publink;
84
+ // if it's a json object parse it and return the publink value, otherwise assume the value is the id
85
+ if (value.charAt(0) === '{') {
86
+ try {
87
+ const obj = JSON.parse(value);
88
+ if (obj) {
89
+ return obj.publink;
90
+ }
91
+ } catch (e) {
92
+ logError(e);
88
93
  }
89
- } catch (e) {
90
- logError(e);
94
+ } else {
95
+ return value;
91
96
  }
92
97
  }
93
98
  }
@@ -17,6 +17,7 @@ const DEFAULT_HEIGHT = 0;
17
17
  const PREBID_NATIVE_HELP_LINK = 'http://prebid.org/dev-docs/show-native-ads.html';
18
18
  const PUBLICATION = 'pubmatic'; // Your publication on Blue Billywig, potentially with environment (e.g. publication.bbvms.com or publication.test.bbvms.com)
19
19
  const RENDERER_URL = 'https://pubmatic.bbvms.com/r/'.concat('$RENDERER', '.js'); // URL of the renderer application
20
+ const MSG_VIDEO_PLACEMENT_MISSING = 'Video.Placement param missing';
20
21
  const CUSTOM_PARAMS = {
21
22
  'kadpageurl': '', // Custom page url
22
23
  'gender': '', // User gender
@@ -537,12 +538,20 @@ function _createBannerRequest(bid) {
537
538
  return bannerObj;
538
539
  }
539
540
 
541
+ export function checkVideoPlacement(videoData, adUnitCode) {
542
+ // Check for video.placement property. If property is missing display log message.
543
+ if (!deepAccess(videoData, 'placement')) {
544
+ logWarn(MSG_VIDEO_PLACEMENT_MISSING + ' for ' + adUnitCode);
545
+ };
546
+ }
547
+
540
548
  function _createVideoRequest(bid) {
541
549
  var videoData = mergeDeep(deepAccess(bid.mediaTypes, 'video'), bid.params.video);
542
550
  var videoObj;
543
551
 
544
552
  if (videoData !== UNDEFINED) {
545
553
  videoObj = {};
554
+ checkVideoPlacement(videoData, bid.adUnitCode);
546
555
  for (var key in VIDEO_CUSTOM_PARAMS) {
547
556
  if (videoData.hasOwnProperty(key)) {
548
557
  videoObj[key] = _checkParamDataType(key, videoData[key], VIDEO_CUSTOM_PARAMS[key]);
@@ -25,7 +25,7 @@ var adUnits = [
25
25
  bidder: 'pubmatic',
26
26
  params: {
27
27
  publisherId: '156209', // required, must be a string, not an integer or other js type.
28
- oustreamAU: 'renderer_test_pubmatic', // required if mediaTypes-> video-> context is 'outstream' and optional if renderer is defined in adUnits or in mediaType video. This value can be get by BlueBillyWig Team.
28
+ outstreamAU: 'renderer_test_pubmatic', // required if mediaTypes-> video-> context is 'outstream' and optional if renderer is defined in adUnits or in mediaType video. This value can be get by BlueBillyWig Team.
29
29
  adSlot: 'pubmatic_test2', // optional, must be a string, not an integer or other js type.
30
30
  pmzoneid: 'zone1, zone11', // optional
31
31
  lat: '40.712775', // optional
@@ -42,10 +42,10 @@
42
42
  * @function?
43
43
  * @summary modify bid request data
44
44
  * @name RtdSubmodule#getBidRequestData
45
- * @param {SubmoduleConfig} config
46
- * @param {UserConsentData} userConsent
47
45
  * @param {Object} reqBidsConfigObj
48
46
  * @param {function} callback
47
+ * @param {SubmoduleConfig} config
48
+ * @param {UserConsentData} userConsent
49
49
  */
50
50
 
51
51
  /**
@@ -83,8 +83,15 @@ export const spec = {
83
83
  'lib_name': 'prebid',
84
84
  'lib_v': '$prebid.version$',
85
85
  'us': 0,
86
+
86
87
  };
87
88
 
89
+ const fpd = config.getConfig('ortb2');
90
+
91
+ if (fpd) {
92
+ payload.fpd = JSON.stringify(fpd);
93
+ }
94
+
88
95
  if (config.getConfig('userSync') && config.getConfig('userSync').syncsPerBidder) {
89
96
  payload.us = config.getConfig('userSync').syncsPerBidder;
90
97
  }
@@ -227,6 +227,7 @@ export const spec = {
227
227
  rv.ext[partner] = params;
228
228
  });
229
229
  }
230
+ rv.ext.gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
230
231
  return rv;
231
232
  });
232
233
  const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
@@ -0,0 +1,129 @@
1
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
2
+ import { NATIVE, BANNER } from '../src/mediaTypes.js';
3
+ import * as utils from '../src/utils.js';
4
+ import {ajax} from '../src/ajax.js';
5
+
6
+ const CURRENCY = 'EUR';
7
+ const BIDDER_CODE = 'talkads';
8
+
9
+ export const spec = {
10
+ code: BIDDER_CODE,
11
+ supportedMediaTypes: [ NATIVE, BANNER ],
12
+ params: null,
13
+
14
+ /**
15
+ * Determines whether or not the given bid request is valid.
16
+ *
17
+ * @param poBid The bid params to validate.
18
+ * @return boolean True if this is a valid bid, and false otherwise.
19
+ */
20
+ isBidRequestValid: (poBid) => {
21
+ utils.logInfo('isBidRequestValid : ', poBid);
22
+ if (poBid.params === undefined) {
23
+ utils.logError('VALIDATION FAILED : the parameters must be defined');
24
+ return false;
25
+ }
26
+ if (poBid.params.tag_id === undefined) {
27
+ utils.logError('VALIDATION FAILED : the parameter "tag_id" must be defined');
28
+ return false;
29
+ }
30
+ if (poBid.params.bidder_url === undefined) {
31
+ utils.logError('VALIDATION FAILED : the parameter "bidder_url" must be defined');
32
+ return false;
33
+ }
34
+ this.params = poBid.params;
35
+ return !!(poBid.nativeParams || poBid.sizes);
36
+ }, // isBidRequestValid
37
+
38
+ /**
39
+ * Make a server request from the list of BidRequests.
40
+ *
41
+ * @param paValidBidRequests An array of bids
42
+ * @param poBidderRequest
43
+ * @return ServerRequest Info describing the request to the server.
44
+ */
45
+ buildRequests: (paValidBidRequests, poBidderRequest) => {
46
+ utils.logInfo('buildRequests : ', paValidBidRequests, poBidderRequest);
47
+ const laBids = paValidBidRequests.map((poBid, piId) => {
48
+ const loOne = { id: piId, ad_unit: poBid.adUnitCode, bid_id: poBid.bidId, type: '', size: [] };
49
+ if (poBid.nativeParams) {
50
+ loOne.type = 'native';
51
+ } else {
52
+ loOne.type = 'banner';
53
+ loOne.size = poBid.sizes;
54
+ }
55
+ return loOne;
56
+ });
57
+ const loServerRequest = {
58
+ cur: CURRENCY,
59
+ timeout: poBidderRequest.timeout,
60
+ auction_id: paValidBidRequests[0].auctionId,
61
+ transaction_id: paValidBidRequests[0].transactionId,
62
+ bids: laBids,
63
+ gdpr: { applies: false, consent: false },
64
+ };
65
+ if (poBidderRequest && poBidderRequest.gdprConsent) {
66
+ const loGdprConsent = poBidderRequest.gdprConsent;
67
+ if ((typeof loGdprConsent.gdprApplies === 'boolean') && loGdprConsent.gdprApplies) {
68
+ loServerRequest.gdpr.applies = true;
69
+ }
70
+ if ((typeof loGdprConsent.consentString === 'string') && loGdprConsent.consentString) {
71
+ loServerRequest.gdpr.consent = poBidderRequest.gdprConsent.consentString;
72
+ }
73
+ }
74
+ const lsUrl = this.params.bidder_url + '/' + this.params.tag_id;
75
+ return {
76
+ method: 'POST',
77
+ url: lsUrl,
78
+ data: JSON.stringify(loServerRequest),
79
+ };
80
+ }, // buildRequests
81
+
82
+ /**
83
+ * Unpack the response from the server into a list of bids.
84
+ *
85
+ * @param poServerResponse A successful response from the server.
86
+ * @param poPidRequest Request original server request
87
+ * @return An array of bids which were nested inside the server.
88
+ */
89
+ interpretResponse: (poServerResponse, poPidRequest) => {
90
+ utils.logInfo('interpretResponse : ', poServerResponse);
91
+ if (!poServerResponse.body) {
92
+ return [];
93
+ }
94
+ let laResponse = [];
95
+ if (poServerResponse.body.status !== 'ok') {
96
+ utils.logInfo('Error : ', poServerResponse.body.error);
97
+ return laResponse;
98
+ }
99
+ poServerResponse.body.bids.forEach((poResponse) => {
100
+ laResponse[laResponse.length] = {
101
+ requestId: poResponse.requestId,
102
+ cpm: poResponse.cpm,
103
+ currency: poResponse.currency,
104
+ width: poResponse.width,
105
+ height: poResponse.height,
106
+ ad: poResponse.ad,
107
+ ttl: poResponse.ttl,
108
+ creativeId: poResponse.creativeId,
109
+ netRevenue: poResponse.netRevenue,
110
+ pbid: poServerResponse.body.pbid,
111
+ };
112
+ });
113
+ return laResponse;
114
+ }, // interpretResponse
115
+
116
+ /**
117
+ * Register bidder specific code, which will execute if a bid from this bidder won the auction.
118
+ *
119
+ * @param poBid The bid that won the auction
120
+ */
121
+ onBidWon: (poBid) => {
122
+ utils.logInfo('onBidWon : ', poBid);
123
+ if (poBid.pbid) {
124
+ ajax(this.params.bidder_url + 'won/' + poBid.pbid);
125
+ }
126
+ }, // onBidWon
127
+ };
128
+
129
+ registerBidder(spec);
@@ -0,0 +1,60 @@
1
+ # Overview
2
+
3
+ ```
4
+ Module Name: TalkAds Adapter
5
+ Module Type: Bidder Adapter
6
+ Maintainer: technical_team@natexo.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ Module that connects to TalkAds bidder to fetch bids.
12
+ Both native and banner formats are supported but not at the same time.
13
+ The only currently supported currency is EUR.
14
+
15
+ This adapter requires setup and approval from the Natexo programmatic team.
16
+
17
+ # Configuration
18
+
19
+
20
+
21
+
22
+ # Test parameters
23
+
24
+ ## Test banner Parameters
25
+
26
+ ```
27
+ var adUnits = [
28
+ code: 'prebid_banner_test',
29
+ mediaTypes: {
30
+ banner: {
31
+ sizes: [[300, 250], [300, 600]],
32
+ }
33
+ },
34
+ bids: [{
35
+ bidder: 'talkads',
36
+ params: {
37
+ tag_id: 0,
38
+ bidder_url: 'https://d.natexo-programmatic.com/tad/tag/testbid',
39
+ },
40
+ }]
41
+ ];
42
+ ```
43
+
44
+ ## Test native parameters
45
+
46
+ ```
47
+ var adUnits = [
48
+ code: 'prebid_native_test',
49
+ mediaTypes: {
50
+ native: {}
51
+ },
52
+ bids: [{
53
+ bidder: 'talkads',
54
+ params: {
55
+ tag_id: 0,
56
+ bidder_url: 'https://d.natexo-programmatic.com/tad/tag/testbid',
57
+ },
58
+ }]
59
+ ];
60
+ ```
@@ -190,6 +190,8 @@ function buildRequestObject(bid) {
190
190
  const reqObj = {};
191
191
  let placementId = getValue(bid.params, 'placementId');
192
192
  let pageId = getValue(bid.params, 'pageId');
193
+ const impressionData = deepAccess(bid, 'ortb2Imp.ext.data');
194
+ const gpid = deepAccess(impressionData, 'pbadslot') || deepAccess(impressionData, 'adserver.adslot');
193
195
 
194
196
  reqObj.sizes = getSizes(bid);
195
197
  reqObj.bidId = getBidIdParameter('bidId', bid);
@@ -199,6 +201,7 @@ function buildRequestObject(bid) {
199
201
  reqObj.adUnitCode = getBidIdParameter('adUnitCode', bid);
200
202
  reqObj.auctionId = getBidIdParameter('auctionId', bid);
201
203
  reqObj.transactionId = getBidIdParameter('transactionId', bid);
204
+ if (gpid) { reqObj.gpid = gpid; }
202
205
  return reqObj;
203
206
  }
204
207
 
@@ -1,4 +1,4 @@
1
- import { tryAppendQueryString, logMessage, isEmpty } from '../src/utils.js';
1
+ import { tryAppendQueryString, logMessage, isEmpty, isStr, isPlainObject, isArray, logWarn } from '../src/utils.js';
2
2
  import { BANNER, VIDEO } from '../src/mediaTypes.js';
3
3
  import { registerBidder } from '../src/adapters/bidderFactory.js';
4
4
  import { config } from '../src/config.js';
@@ -262,19 +262,36 @@ function getPubCommonEids(bidRequest) {
262
262
  function getEids(bidRequest, type, source, rtiPartner) {
263
263
  return bidRequest
264
264
  .map(getUserId(type)) // bids -> userIds of a certain type
265
- .filter((x) => !!x) // filter out null userIds
265
+ .filter(filterEids(type)) // filter out unqualified userIds
266
266
  .map(formatEid(source, rtiPartner)); // userIds -> eid objects
267
267
  }
268
268
 
269
+ const filterEids = type => (userId, i, arr) => {
270
+ let isValidUserId =
271
+ !!userId && // is not null nor empty
272
+ (isStr(userId)
273
+ ? !!userId
274
+ : isPlainObject(userId) && // or, is object
275
+ !isArray(userId) && // not an array
276
+ !isEmpty(userId) && // is not empty
277
+ userId.id && // contains nested id field
278
+ isStr(userId.id) && // nested id field is a string
279
+ !!userId.id); // that is not empty
280
+ if (!isValidUserId && arr[0] !== undefined) {
281
+ logWarn(`Triplelift: invalid ${type} userId format`);
282
+ }
283
+ return isValidUserId;
284
+ };
285
+
269
286
  function getUserId(type) {
270
- return (bid) => (bid && bid.userId && bid.userId[type]);
287
+ return bid => bid && bid.userId && bid.userId[type];
271
288
  }
272
289
 
273
290
  function formatEid(source, rtiPartner) {
274
- return (id) => ({
291
+ return (userId) => ({
275
292
  source,
276
293
  uids: [{
277
- id,
294
+ id: userId.id ? userId.id : userId,
278
295
  ext: { rtiPartner }
279
296
  }]
280
297
  });