prebid.js 7.25.0 → 7.26.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 (168) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/adagioBidAdapter.js +1 -1
  3. package/dist/adbookpspBidAdapter.js +1 -1
  4. package/dist/adgenerationBidAdapter.js +1 -1
  5. package/dist/admaticBidAdapter.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/ajaBidAdapter.js +1 -1
  10. package/dist/amxBidAdapter.js +1 -1
  11. package/dist/amxIdSystem.js +1 -1
  12. package/dist/appierAnalyticsAdapter.js +1 -1
  13. package/dist/appnexusBidAdapter.js +1 -1
  14. package/dist/asoBidAdapter.js +1 -1
  15. package/dist/axonixBidAdapter.js +1 -1
  16. package/dist/beopBidAdapter.js +1 -1
  17. package/dist/bidglassBidAdapter.js +1 -1
  18. package/dist/big-richmediaBidAdapter.js +1 -1
  19. package/dist/bridgewellBidAdapter.js +1 -1
  20. package/dist/brightMountainMediaBidAdapter.js +1 -1
  21. package/dist/captifyRtdProvider.js +1 -0
  22. package/dist/carodaBidAdapter.js +1 -1
  23. package/dist/chtnwBidAdapter.js +1 -1
  24. package/dist/concertBidAdapter.js +1 -1
  25. package/dist/connectadBidAdapter.js +1 -1
  26. package/dist/consumableBidAdapter.js +1 -1
  27. package/dist/conversantBidAdapter.js +1 -1
  28. package/dist/craftBidAdapter.js +1 -1
  29. package/dist/criteoBidAdapter.js +1 -1
  30. package/dist/discoveryBidAdapter.js +1 -1
  31. package/dist/dspxBidAdapter.js +1 -1
  32. package/dist/eplanningBidAdapter.js +1 -1
  33. package/dist/finativeBidAdapter.js +1 -1
  34. package/dist/glimpseBidAdapter.js +1 -1
  35. package/dist/gmosspBidAdapter.js +1 -1
  36. package/dist/goldbachBidAdapter.js +1 -1
  37. package/dist/gridBidAdapter.js +1 -1
  38. package/dist/gridNMBidAdapter.js +1 -1
  39. package/dist/gumgumBidAdapter.js +1 -1
  40. package/dist/h12mediaBidAdapter.js +1 -1
  41. package/dist/id5IdSystem.js +1 -1
  42. package/dist/improvedigitalBidAdapter.js +1 -1
  43. package/dist/inmarBidAdapter.js +1 -1
  44. package/dist/insticatorBidAdapter.js +1 -1
  45. package/dist/ixBidAdapter.js +1 -1
  46. package/dist/justpremiumBidAdapter.js +1 -1
  47. package/dist/konduitAnalyticsAdapter.js +1 -1
  48. package/dist/kueezBidAdapter.js +1 -1
  49. package/dist/kueezRtbBidAdapter.js +1 -1
  50. package/dist/lassoBidAdapter.js +1 -1
  51. package/dist/lifestreetBidAdapter.js +1 -1
  52. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  53. package/dist/logicadBidAdapter.js +1 -1
  54. package/dist/loglyliftBidAdapter.js +1 -1
  55. package/dist/magniteAnalyticsAdapter.js +1 -1
  56. package/dist/malltvAnalyticsAdapter.js +1 -1
  57. package/dist/marsmediaBidAdapter.js +1 -1
  58. package/dist/mediafuseBidAdapter.js +1 -1
  59. package/dist/mediasquareBidAdapter.js +1 -1
  60. package/dist/mgidBidAdapter.js +1 -1
  61. package/dist/minutemediaBidAdapter.js +1 -1
  62. package/dist/nextMillenniumBidAdapter.js +1 -1
  63. package/dist/not-for-prod/prebid.js +152 -118
  64. package/dist/oguryBidAdapter.js +1 -1
  65. package/dist/onetagBidAdapter.js +1 -1
  66. package/dist/ooloAnalyticsAdapter.js +1 -1
  67. package/dist/outbrainBidAdapter.js +1 -1
  68. package/dist/parrableIdSystem.js +1 -1
  69. package/dist/pixfutureBidAdapter.js +1 -1
  70. package/dist/prebid-core.js +1 -1
  71. package/dist/publinkIdSystem.js +1 -1
  72. package/dist/pubmaticBidAdapter.js +1 -1
  73. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  74. package/dist/pxyzBidAdapter.js +1 -1
  75. package/dist/quantcastBidAdapter.js +1 -1
  76. package/dist/readpeakBidAdapter.js +1 -1
  77. package/dist/relaidoBidAdapter.js +1 -1
  78. package/dist/rhythmoneBidAdapter.js +1 -1
  79. package/dist/riseBidAdapter.js +1 -1
  80. package/dist/rubiconAnalyticsAdapter.js +1 -1
  81. package/dist/rubiconBidAdapter.js +1 -1
  82. package/dist/seedingAllianceBidAdapter.js +1 -1
  83. package/dist/seedtagBidAdapter.js +1 -1
  84. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  85. package/dist/sharethroughBidAdapter.js +1 -1
  86. package/dist/shinezBidAdapter.js +1 -1
  87. package/dist/smaatoBidAdapter.js +1 -1
  88. package/dist/smartadserverBidAdapter.js +1 -1
  89. package/dist/smartxBidAdapter.js +1 -1
  90. package/dist/smartytechBidAdapter.js +1 -0
  91. package/dist/smilewantedBidAdapter.js +1 -1
  92. package/dist/sonobiBidAdapter.js +1 -1
  93. package/dist/sovrnAnalyticsAdapter.js +1 -1
  94. package/dist/sovrnBidAdapter.js +1 -1
  95. package/dist/sspBCBidAdapter.js +1 -1
  96. package/dist/sublimeBidAdapter.js +1 -1
  97. package/dist/synacormediaBidAdapter.js +1 -1
  98. package/dist/taboolaBidAdapter.js +1 -1
  99. package/dist/tappxBidAdapter.js +1 -1
  100. package/dist/targetVideoBidAdapter.js +1 -1
  101. package/dist/teadsBidAdapter.js +1 -1
  102. package/dist/trionBidAdapter.js +1 -1
  103. package/dist/tripleliftBidAdapter.js +1 -1
  104. package/dist/ttdBidAdapter.js +1 -1
  105. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  106. package/dist/underdogmediaBidAdapter.js +1 -1
  107. package/dist/undertoneBidAdapter.js +1 -1
  108. package/dist/userId.js +1 -1
  109. package/dist/vidazooBidAdapter.js +1 -1
  110. package/dist/videobyteBidAdapter.js +1 -1
  111. package/dist/viqeoBidAdapter.js +1 -0
  112. package/dist/visxBidAdapter.js +1 -1
  113. package/dist/vuukleBidAdapter.js +1 -1
  114. package/dist/widespaceBidAdapter.js +1 -1
  115. package/dist/winrBidAdapter.js +1 -1
  116. package/dist/yahoosspBidAdapter.js +1 -1
  117. package/dist/yieldlabBidAdapter.js +1 -1
  118. package/dist/yieldmoBidAdapter.js +1 -1
  119. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  120. package/dist/zeta_global_sspBidAdapter.js +1 -1
  121. package/dist/zeusPrimeRtdProvider.js +31 -0
  122. package/integrationExamples/gpt/captifyRtdProvider_example.html +167 -0
  123. package/modules/.submodules.json +3 -1
  124. package/modules/admaticBidAdapter.js +108 -59
  125. package/modules/admaticBidAdapter.md +2 -2
  126. package/modules/beopBidAdapter.js +17 -2
  127. package/modules/captifyRtdProvider.js +146 -0
  128. package/modules/captifyRtdProvider.md +68 -0
  129. package/modules/discoveryBidAdapter.js +38 -17
  130. package/modules/discoveryBidAdapter.md +7 -6
  131. package/modules/gridBidAdapter.js +440 -22
  132. package/modules/nextMillenniumBidAdapter.js +19 -23
  133. package/modules/smartadserverBidAdapter.js +6 -2
  134. package/modules/smartxBidAdapter.js +10 -7
  135. package/modules/smartytechBidAdapter.js +78 -0
  136. package/modules/smartytechBidAdapter.md +44 -0
  137. package/modules/taboolaBidAdapter.js +3 -3
  138. package/modules/taboolaBidAdapter.md +0 -2
  139. package/modules/tappxBidAdapter.js +21 -6
  140. package/modules/ttdBidAdapter.js +4 -3
  141. package/modules/userId/index.js +1 -1
  142. package/modules/vidazooBidAdapter.js +15 -2
  143. package/modules/viqeoBidAdapter.js +180 -0
  144. package/modules/viqeoBidAdapter.md +56 -0
  145. package/modules/yieldlabBidAdapter.js +19 -8
  146. package/modules/yieldoneBidAdapter.js +60 -8
  147. package/modules/yieldoneBidAdapter.md +109 -9
  148. package/modules/zeta_global_sspBidAdapter.js +4 -0
  149. package/modules/zeusPrimeRtdProvider.js +357 -0
  150. package/modules/zeusPrimeRtdProvider.md +60 -0
  151. package/package.json +1 -1
  152. package/src/adloader.js +0 -1
  153. package/test/spec/modules/admaticBidAdapter_spec.js +262 -3
  154. package/test/spec/modules/beopBidAdapter_spec.js +52 -0
  155. package/test/spec/modules/captifyRtdProvider_spec.js +253 -0
  156. package/test/spec/modules/discoveryBidAdapter_spec.js +9 -8
  157. package/test/spec/modules/gridBidAdapter_spec.js +289 -1
  158. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +4 -3
  159. package/test/spec/modules/smartadserverBidAdapter_spec.js +80 -0
  160. package/test/spec/modules/smartxBidAdapter_spec.js +32 -0
  161. package/test/spec/modules/smartytechBidAdapter_spec.js +162 -0
  162. package/test/spec/modules/taboolaBidAdapter_spec.js +0 -77
  163. package/test/spec/modules/ttdBidAdapter_spec.js +13 -0
  164. package/test/spec/modules/viqeoBidAdapter_spec.js +124 -0
  165. package/test/spec/modules/yieldlabBidAdapter_spec.js +125 -0
  166. package/test/spec/modules/yieldoneBidAdapter_spec.js +30 -6
  167. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +16 -1
  168. package/test/spec/modules/zeusPrimeRtdProvider_spec.js +410 -0
@@ -1,94 +1,93 @@
1
1
  import { getValue, logError, deepAccess, getBidIdParameter, isArray } from '../src/utils.js';
2
- import { loadExternalScript } from '../src/adloader.js';
3
- import {registerBidder} from '../src/adapters/bidderFactory.js';
4
-
5
- const ENDPOINT_URL = 'https://layer.serve.admatic.com.tr/pb';
6
- const SYNC_URL = 'https://cdn.serve.admatic.com.tr/showad/sync.js';
2
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
3
+ import { BANNER, VIDEO } from '../src/mediaTypes.js';
4
+ const SYNC_URL = 'https://cdn.serve.admatic.com.tr/showad/sync.html';
7
5
  const BIDDER_CODE = 'admatic';
8
-
9
6
  export const spec = {
10
- code: 'admatic',
11
- supportedMediaTypes: ['video', 'banner'],
12
- /**
13
- * Determines whether or not the given bid request is valid.
14
- *
15
- * @param {BidRequest} bid The bid params to validate.
16
- * @return boolean True if this is a valid bid, and false otherwise.
7
+ code: BIDDER_CODE,
8
+ aliases: [
9
+ {code: 'pixad'}
10
+ ],
11
+ supportedMediaTypes: [BANNER, VIDEO],
12
+ /** f
13
+ * @param {object} bid
14
+ * @return {boolean}
17
15
  */
18
- isBidRequestValid: function(bid) {
16
+ isBidRequestValid: (bid) => {
19
17
  let isValid = false;
20
- if (typeof bid.params !== 'undefined') {
21
- let isValidNetworkId = _validateId(getValue(bid.params, 'networkId'));
22
- isValid = isValidNetworkId;// && isValidTypeId;
18
+ if (bid?.params) {
19
+ const isValidNetworkId = _validateId(getValue(bid.params, 'networkId'));
20
+ const isValidHost = _validateString(getValue(bid.params, 'host'));
21
+ isValid = isValidNetworkId && isValidHost;
23
22
  }
24
23
 
25
24
  if (!isValid) {
26
- logError('AdMatic networkId parameters are required. Bid aborted.');
25
+ logError(`${bid.bidder} networkId and host parameters are required. Bid aborted.`);
27
26
  }
28
27
  return isValid;
29
28
  },
29
+
30
30
  /**
31
- * Make a server request from the list of BidRequests.
32
- *
33
- * @param {validBidRequests[]} an array of bids
34
- * @return ServerRequest Info describing the request to the server.
31
+ * @param {BidRequest[]} validBidRequests
32
+ * @return {ServerRequest}
35
33
  */
36
- buildRequests: function(validBidRequests, bidderRequest) {
34
+ buildRequests: (validBidRequests, bidderRequest) => {
37
35
  const bids = validBidRequests.map(buildRequestObject);
38
36
  const networkId = getValue(validBidRequests[0].params, 'networkId');
37
+ const host = getValue(validBidRequests[0].params, 'host');
39
38
  const currency = getValue(validBidRequests[0].params, 'currency') || 'TRY';
40
-
41
- setTimeout(() => {
42
- loadExternalScript(SYNC_URL, BIDDER_CODE);
43
- }, bidderRequest.timeout);
39
+ const bidderName = validBidRequests[0].bidder;
44
40
 
45
41
  const payload = {
46
- 'user': {
47
- 'ua': navigator.userAgent
42
+ user: {
43
+ ua: navigator.userAgent
48
44
  },
49
- 'blacklist': [],
50
- 'site': {
51
- 'page': location.href,
52
- 'ref': location.origin,
53
- 'publisher': {
54
- 'name': location.hostname,
55
- 'publisherId': networkId
45
+ blacklist: [],
46
+ site: {
47
+ page: location.href,
48
+ ref: location.origin,
49
+ publisher: {
50
+ name: location.hostname,
51
+ publisherId: networkId
56
52
  }
57
53
  },
58
54
  imp: bids,
59
55
  ext: {
60
- 'cur': currency,
61
- 'type': 'admatic'
56
+ cur: currency,
57
+ bidder: bidderName
62
58
  }
63
59
  };
64
60
 
65
- const payloadString = JSON.stringify(payload);
66
- return {
67
- method: 'POST',
68
- url: ENDPOINT_URL,
69
- data: payloadString,
70
- options: {
71
- contentType: 'application/json'
72
- }
73
- };
61
+ if (payload) {
62
+ return { method: 'POST', url: `https://${host}/pb?bidder=${bidderName}`, data: payload, options: { contentType: 'application/json' } };
63
+ }
64
+ },
65
+
66
+ getUserSyncs: function (syncOptions, responses) {
67
+ if (syncOptions.iframeEnabled) {
68
+ return [{
69
+ type: 'iframe',
70
+ url: SYNC_URL
71
+ }];
72
+ }
74
73
  },
74
+
75
75
  /**
76
- * Unpack the response from the server into a list of bids.
77
- *
78
- * @param {*} serverResponse A successful response from the server.
79
- * @return {Bid[]} An array of bids which were nested inside the server.
76
+ * @param {*} response
77
+ * @param {ServerRequest} request
78
+ * @return {Bid[]}
80
79
  */
81
80
  interpretResponse: (response, request) => {
82
81
  const body = response.body || response;
83
82
  const bidResponses = [];
84
- if (body.data.length > 0) {
85
- body.data.forEach(function (bid) {
83
+ if (body && body?.data && isArray(body.data)) {
84
+ body.data.forEach(bid => {
86
85
  const resbid = {
87
86
  requestId: bid.id,
88
87
  cpm: bid.price,
89
88
  width: bid.width,
90
89
  height: bid.height,
91
- currency: body.cur,
90
+ currency: body.cur || 'TRY',
92
91
  netRevenue: true,
93
92
  ad: bid.party_tag,
94
93
  creativeId: bid.creative_id,
@@ -96,22 +95,68 @@ export const spec = {
96
95
  advertiserDomains: bid && bid.adomain ? bid.adomain : []
97
96
  },
98
97
  ttl: 360,
99
- bidder: 'admatic',
100
- timeToRespond: 1,
101
- requestTimestamp: 1
98
+ bidder: bid.bidder
102
99
  };
100
+
103
101
  bidResponses.push(resbid);
104
102
  });
105
- };
103
+ }
106
104
  return bidResponses;
107
105
  }
108
106
  };
109
107
 
108
+ function enrichSlotWithFloors(slot, bidRequest) {
109
+ try {
110
+ const slotFloors = {};
111
+
112
+ if (bidRequest.getFloor) {
113
+ if (bidRequest.mediaTypes?.banner) {
114
+ slotFloors.banner = {};
115
+ const bannerSizes = parseSizes(deepAccess(bidRequest, 'mediaTypes.banner.sizes'))
116
+ bannerSizes.forEach(bannerSize => slotFloors.banner[parseSize(bannerSize).toString()] = bidRequest.getFloor({ size: bannerSize, mediaType: BANNER }));
117
+ }
118
+
119
+ if (bidRequest.mediaTypes?.video) {
120
+ slotFloors.video = {};
121
+ const videoSizes = parseSizes(deepAccess(bidRequest, 'mediaTypes.video.playerSize'))
122
+ videoSizes.forEach(videoSize => slotFloors.video[parseSize(videoSize).toString()] = bidRequest.getFloor({ size: videoSize, mediaType: VIDEO }));
123
+ }
124
+
125
+ if (Object.keys(slotFloors).length > 0) {
126
+ if (!slot) {
127
+ slot = {}
128
+ }
129
+ Object.assign(slot, {
130
+ floors: slotFloors
131
+ });
132
+ }
133
+ }
134
+ } catch (e) {
135
+ logError('Could not parse floors from Prebid: ' + e);
136
+ }
137
+ }
138
+
139
+ function parseSizes(sizes, parser = s => s) {
140
+ if (sizes == undefined) {
141
+ return [];
142
+ }
143
+ if (Array.isArray(sizes[0])) { // is there several sizes ? (ie. [[728,90],[200,300]])
144
+ return sizes.map(size => parser(size));
145
+ }
146
+ return [parser(sizes)]; // or a single one ? (ie. [728,90])
147
+ }
148
+
149
+ function parseSize(size) {
150
+ return size[0] + 'x' + size[1];
151
+ }
152
+
110
153
  function buildRequestObject(bid) {
111
154
  const reqObj = {};
112
155
  reqObj.size = getSizes(bid);
113
156
  reqObj.id = getBidIdParameter('bidId', bid);
114
- reqObj.floor = getValue(bid.params, 'floor') || 0.01;
157
+
158
+ enrichSlotWithFloors(reqObj, bid);
159
+
115
160
  return reqObj;
116
161
  }
117
162
 
@@ -144,4 +189,8 @@ function _validateId(id) {
144
189
  return (parseInt(id) > 0);
145
190
  }
146
191
 
192
+ function _validateString(str) {
193
+ return (typeof str == 'string');
194
+ }
195
+
147
196
  registerBidder(spec);
@@ -19,7 +19,7 @@ Use `admatic` as bidder.
19
19
  bidder: 'admatic',
20
20
  params: {
21
21
  networkId: 12345,
22
- floor: 0.5
22
+ host: 'layer.serve.admatic.com.tr'
23
23
  }
24
24
  }]
25
25
  },{
@@ -29,7 +29,7 @@ Use `admatic` as bidder.
29
29
  bidder: 'admatic',
30
30
  params: {
31
31
  networkId: 12345,
32
- floor: 0.5
32
+ host: 'layer.serve.admatic.com.tr'
33
33
  }
34
34
  }]
35
35
  }];
@@ -1,4 +1,4 @@
1
- import { deepAccess, isArray, logWarn, triggerPixel, buildUrl, logInfo, getValue, getBidIdParameter } from '../src/utils.js';
1
+ import { deepAccess, isArray, isStr, logWarn, triggerPixel, buildUrl, logInfo, getValue, getBidIdParameter } from '../src/utils.js';
2
2
  import { getRefererInfo } from '../src/refererDetection.js';
3
3
  import { registerBidder } from '../src/adapters/bidderFactory.js';
4
4
  import { config } from '../src/config.js';
@@ -40,6 +40,19 @@ export const spec = {
40
40
  const pageUrl = getPageUrl(bidderRequest.refererInfo, window);
41
41
  const gdpr = bidderRequest.gdprConsent;
42
42
  const firstSlot = slots[0];
43
+ const kwdsFromRequest = firstSlot.kwds;
44
+ let keywords = [];
45
+ if (kwdsFromRequest) {
46
+ if (isArray(kwdsFromRequest)) {
47
+ keywords = kwdsFromRequest;
48
+ } else if (isStr(kwdsFromRequest)) {
49
+ if (kwdsFromRequest.indexOf(',') != -1) {
50
+ keywords = kwdsFromRequest.split(',').map((e) => { return e.trim() });
51
+ } else {
52
+ keywords.push(kwdsFromRequest);
53
+ }
54
+ }
55
+ }
43
56
  const payloadObject = {
44
57
  at: new Date().toString(),
45
58
  nid: firstSlot.nid,
@@ -47,12 +60,13 @@ export const spec = {
47
60
  pid: firstSlot.pid,
48
61
  url: pageUrl,
49
62
  lang: (window.navigator.language || window.navigator.languages[0]),
50
- kwds: bidderRequest.ortb2?.site?.keywords || [],
63
+ kwds: keywords,
51
64
  dbg: false,
52
65
  slts: slots,
53
66
  is_amp: deepAccess(bidderRequest, 'referrerInfo.isAmp'),
54
67
  tc_string: (gdpr && gdpr.gdprApplies) ? gdpr.consentString : null,
55
68
  };
69
+
56
70
  const payloadString = JSON.stringify(payloadObject);
57
71
  return {
58
72
  method: 'POST',
@@ -129,6 +143,7 @@ function beOpRequestSlotsMaker(bid) {
129
143
  sizes: isArray(bannerSizes) ? bannerSizes : bid.sizes,
130
144
  flr: floor,
131
145
  pid: getValue(bid.params, 'accountId'),
146
+ kwds: getValue(bid.params, 'keywords'),
132
147
  nid: getValue(bid.params, 'networkId'),
133
148
  nptnid: getValue(bid.params, 'networkPartnerId'),
134
149
  bid: getBidIdParameter('bidId', bid),
@@ -0,0 +1,146 @@
1
+ /**
2
+ * This module adds Captify real time data provider module
3
+ * The {@link module:modules/realTimeData} module is required
4
+ * The module will fetch segments (page-centric) from Captify live-classification server
5
+ * @module modules/captifyRtdProvider
6
+ * @requires module:modules/realTimeData
7
+ */
8
+ import { submodule } from '../src/hook.js';
9
+ import { getRefererInfo } from '../src/refererDetection.js';
10
+ import { ajax } from '../src/ajax.js';
11
+ import { config } from '../src/config.js';
12
+ import {deepAccess, isArray, isEmptyStr, isNumber, logError} from '../src/utils.js';
13
+ import {getGlobal} from '../src/prebidGlobal.js';
14
+
15
+ const MODULE_NAME = 'realTimeData';
16
+ const SUBMODULE_NAME = 'CaptifyRTDModule';
17
+ const DEFAULT_LC_URL = 'https://live-classification.cpx.to/prebid-segments';
18
+
19
+ const STATUS = {
20
+ SUCCESS: 200,
21
+ ACCEPTED: 202,
22
+ };
23
+
24
+ /**
25
+ * Set `appnexusAuctionKeywords` that appnexus bidder will read and send in request to Xandr
26
+ * @param {Array<number>} segments captify segments for Appnexus(Xandr) system, in form of [id1, id2, id3]
27
+ * where id1, id2, id3 - actual Xandr segment ids with keywords enabled
28
+ */
29
+ export function setAppnexusSegments(segments) {
30
+ config.setConfig({
31
+ appnexusAuctionKeywords: {
32
+ 'captify_segments': segments,
33
+ },
34
+ })
35
+ }
36
+
37
+ /**
38
+ * Function returns only bidders that contained both, in moduleConfig and at least one adUnit.
39
+ * @param {Array<string>} bidders Contains list of bidders, to set targeting for
40
+ * @param {Object} data Response of live-classification service
41
+ */
42
+ export function addSegmentData(bidders, data) {
43
+ for (const bidder of bidders) {
44
+ if (bidder === 'appnexus') { setAppnexusSegments(data['xandr']) }
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Function returns only bidders that contained in both, moduleConfig and at least one adUnit.
50
+ * @param {Object} moduleConfig Config object passed to the module
51
+ * @param {Object} reqBidsConfigObj Config object for the bidders; each adapter has its own entry
52
+ */
53
+ export function getMatchingBidders(moduleConfig, reqBidsConfigObj) {
54
+ const biddersFromConf = deepAccess(moduleConfig, 'params.bidders');
55
+
56
+ const adUnitBidders = reqBidsConfigObj.adUnits
57
+ .flatMap(({bids}) => bids.map(({bidder}) => bidder))
58
+ .filter((e, i, a) => a.indexOf(e) === i);
59
+
60
+ if (!isArray(adUnitBidders) || !adUnitBidders.length) {
61
+ logError(SUBMODULE_NAME, 'Missing parameter bidders in bidRequestConfig');
62
+ return [];
63
+ }
64
+
65
+ return biddersFromConf.filter(bidder => adUnitBidders.includes(bidder));
66
+ }
67
+
68
+ /**
69
+ * Main function that sets Captify targeting for various bidders
70
+ * @param {Object} moduleConfig Config object passed to the module
71
+ * @param {Function} onDone callback function that executed when everything is done
72
+ * @param {Object} reqBidsConfigObj Config object for the bidders; each adapter has its own entry
73
+ * @param {Object} gcv contains data related to user consent, if applies
74
+ */
75
+ export function setCaptifyTargeting(reqBidsConfigObj, onDone, moduleConfig, gcv) {
76
+ const pbjsVer = getGlobal();
77
+ const ref = getRefererInfo().referer;
78
+ const url = document.URL;
79
+ const pubId = moduleConfig.params.pubId;
80
+ const bidders = getMatchingBidders(moduleConfig, reqBidsConfigObj)
81
+ const requestBody = {
82
+ pubId,
83
+ ref,
84
+ url,
85
+ pbjsVer,
86
+ gcv
87
+ };
88
+ let requestUrl = moduleConfig.params.url;
89
+ if (!requestUrl || isEmptyStr(requestUrl)) {
90
+ requestUrl = DEFAULT_LC_URL;
91
+ }
92
+
93
+ if (!bidders.length) {
94
+ logError(SUBMODULE_NAME, 'There are no matched bidders to work with');
95
+ return;
96
+ }
97
+
98
+ ajax(requestUrl, {
99
+ success: function (response, req) {
100
+ if (req.status === STATUS.SUCCESS) {
101
+ try {
102
+ const data = JSON.parse(response);
103
+ if (data) {
104
+ addSegmentData(bidders, data);
105
+ }
106
+ } catch (e) {
107
+ logError(SUBMODULE_NAME, 'Unable to parse live-classification data' + e);
108
+ }
109
+ }
110
+ onDone();
111
+ },
112
+ error: function () {
113
+ onDone();
114
+ logError(SUBMODULE_NAME, 'Unable to get live-classification data');
115
+ }
116
+ },
117
+ JSON.stringify(requestBody),
118
+ {
119
+ contentType: 'application/json',
120
+ method: 'POST',
121
+ });
122
+ }
123
+
124
+ export function init(moduleConfig, userConsent) {
125
+ // Validate bidders
126
+ const biddersFromConf = deepAccess(moduleConfig, 'params.bidders');
127
+ if (!isArray(biddersFromConf) || !biddersFromConf.length) {
128
+ logError(SUBMODULE_NAME, 'Missing parameter bidders in moduleConfig');
129
+ return false
130
+ }
131
+ const publisherId = deepAccess(moduleConfig, 'params.pubId');
132
+ // Publisher Id
133
+ if (!isNumber(publisherId)) {
134
+ logError(SUBMODULE_NAME, 'Missing parameter pubId in moduleConfig');
135
+ return false
136
+ }
137
+ return true
138
+ }
139
+
140
+ export const captifySubmodule = {
141
+ name: SUBMODULE_NAME,
142
+ init: init,
143
+ setCaptifyTargeting
144
+ };
145
+
146
+ submodule(MODULE_NAME, captifySubmodule);
@@ -0,0 +1,68 @@
1
+ # Captify Real-Time Data Submodule
2
+
3
+ # Overview
4
+
5
+ Module Name: Captify Rtd Provider
6
+ Module Type: Rtd Provider
7
+ Layout: integrationExamples/gpt/captifyRtdProvider_example.html
8
+ Maintainer: prebid@captify.tech
9
+
10
+ # Description
11
+
12
+ Captify uses publisher first-party on-site search data to power machine learning algorithms to create a suite of
13
+ contextual based targeting solutions that activate in a cookieless environment.
14
+
15
+ The RTD submodule allows bid requests to be classified by our live-classification service on the first ad call,
16
+ maximising value for publishers by increasing scale for advertisers.
17
+
18
+ Segments will be attached to bid request objects sent to different SSPs in order to optimize targeting.
19
+
20
+ Contact prebid@captify.tech for information.
21
+
22
+ ### Publisher Usage
23
+
24
+ Compile the Captify RTD module into your Prebid build:
25
+
26
+ `npm ci && gulp build --modules=rtdModule,appnexusBidAdapter,captifyRtdProvider`
27
+
28
+ Add the Captify RTD provider to your Prebid config.
29
+
30
+ ```javascript
31
+ pbjs.setConfig({
32
+ realTimeData: {
33
+ auctionDelay: 1000,
34
+ dataProviders: [
35
+ {
36
+ name: "CaptifyRTDModule",
37
+ waitForIt: true,
38
+ params: {
39
+ pubId: 123456,
40
+ bidders: ['appnexus'],
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ });
46
+ ```
47
+
48
+ ### Parameter Description
49
+ This module is configured as part of the `realTimeData.dataProviders` object.
50
+
51
+ | Name |Type | Description |Mandatory | Notes |
52
+ | :------------- | :------------ | :------------------------------------------------------------------ |:---------|:------------ |
53
+ | name | String | Real time data module name | yes | Always 'CaptifyRTDModule' |
54
+ | waitForIt | Boolean | Should be `true` if there's an `auctionDelay` defined (recommended) | no | Default `false` |
55
+ | params | Object | | | |
56
+ | params.pubId | Integer | Partner ID, required to get results and provided by Captify | yes | Use 123456 for tests and speak to your Captify account manager to receive your pubId |
57
+ | params.bidders | Array<String> | List of bidders for which you would like data to be set | yes | Currently only 'appnexus' supported |
58
+ | params.url | String | Captify live-classification service url | no | Defaults to `https://live-classification.cpx.to/prebid-segments`
59
+
60
+ ### Testing
61
+
62
+ To view an example of available segments returned by Captify:
63
+
64
+ `gulp serve --modules=rtdModule,captifyRtdProvider,appnexusBidAdapter`
65
+
66
+ and then point your browser at:
67
+
68
+ `http://localhost:9999/integrationExamples/gpt/captifyRtdProvider_example.html?pbjs_debug=true`
@@ -12,7 +12,8 @@ let itemMaps = {};
12
12
  const MEDIATYPE = [BANNER, NATIVE];
13
13
 
14
14
  /* ----- _ss_pp_id:start ------ */
15
- const COOKIE_KEY_MGUID = '_ss_pp_id';
15
+ const COOKIE_KEY_SSPPID = '_ss_pp_id';
16
+ const COOKIE_KEY_MGUID = '__mguid_';
16
17
 
17
18
  const NATIVERET = {
18
19
  id: 'id',
@@ -58,14 +59,20 @@ const NATIVERET = {
58
59
  * @return {string}
59
60
  */
60
61
  const getUserID = () => {
61
- const i = storage.getCookie(COOKIE_KEY_MGUID);
62
+ let idd = storage.getCookie(COOKIE_KEY_SSPPID);
63
+ let idm = storage.getCookie(COOKIE_KEY_MGUID);
62
64
 
63
- if (i === null) {
65
+ if (idd && !idm) {
66
+ idm = idd
67
+ } else if (idm && !idd) {
68
+ idd = idm
69
+ } else if (!idd && !idm) {
64
70
  const uuid = utils.generateUUID();
65
71
  storage.setCookie(COOKIE_KEY_MGUID, uuid);
72
+ storage.setCookie(COOKIE_KEY_SSPPID, uuid);
66
73
  return uuid;
67
74
  }
68
- return i;
75
+ return idd;
69
76
  };
70
77
 
71
78
  /* ----- _ss_pp_id:end ------ */
@@ -80,7 +87,6 @@ function getKv(obj, ...keys) {
80
87
  let o = obj;
81
88
 
82
89
  for (let key of keys) {
83
- // console.log(key, o);
84
90
  if (o && o[key]) {
85
91
  o = o[key];
86
92
  } else {
@@ -222,7 +228,7 @@ function getItems(validBidRequests, bidderRequest) {
222
228
  let id = '' + (i + 1);
223
229
 
224
230
  if (mediaTypes.native) {
225
- ret = {...NATIVERET, ...{id, bidFloor}}
231
+ ret = { ...NATIVERET, ...{ id, bidFloor } }
226
232
  }
227
233
  // banner
228
234
  if (mediaTypes.banner) {
@@ -249,6 +255,7 @@ function getItems(validBidRequests, bidderRequest) {
249
255
  pos: 1,
250
256
  },
251
257
  ext: {},
258
+ tagid: globals['tagid'],
252
259
  };
253
260
  }
254
261
  itemMaps[id] = {
@@ -273,14 +280,19 @@ function getParam(validBidRequests, bidderRequest) {
273
280
  let auctionId = getKv(bidderRequest, 'auctionId');
274
281
  let items = getItems(validBidRequests, bidderRequest);
275
282
 
276
- const location = utils.deepAccess(bidderRequest, 'refererInfo.referer');
277
-
278
283
  const timeout = bidderRequest.timeout || 2000;
279
284
 
285
+ const domain = utils.deepAccess(bidderRequest, 'refererInfo.domain') || document.domain;
286
+ const location = utils.deepAccess(bidderRequest, 'refererInfo.referer');
287
+ const page = utils.deepAccess(bidderRequest, 'refererInfo.page');
288
+ const referer = utils.deepAccess(bidderRequest, 'refererInfo.ref');
289
+
280
290
  if (items && items.length) {
281
291
  let c = {
282
292
  id: 'pp_hbjs_' + auctionId,
283
293
  at: 1,
294
+ bcat: globals['bcat'],
295
+ badv: globals['adv'],
284
296
  cur: ['USD'],
285
297
  device: {
286
298
  connectiontype: 0,
@@ -295,16 +307,16 @@ function getParam(validBidRequests, bidderRequest) {
295
307
  },
296
308
  tmax: timeout,
297
309
  site: {
298
- name: globals['media'],
299
- domain: globals['media'],
300
- page: location,
301
- ref: location,
310
+ name: domain,
311
+ domain: domain,
312
+ page: page || location,
313
+ ref: referer,
302
314
  mobile: isMobile,
303
315
  cat: [], // todo
304
316
  publisher: {
317
+ id: globals['publisher']
305
318
  // todo
306
- id: globals['media'],
307
- name: globals['media'],
319
+ // name: xxx
308
320
  },
309
321
  },
310
322
  imp: items,
@@ -329,10 +341,19 @@ export const spec = {
329
341
  if (bid.params.token) {
330
342
  globals['token'] = bid.params.token;
331
343
  }
332
- if (bid.params.media) {
333
- globals['media'] = bid.params.media;
344
+ if (bid.params.publisher) {
345
+ globals['publisher'] = bid.params.publisher;
346
+ }
347
+ if (bid.params.tagid) {
348
+ globals['tagid'] = bid.params.tagid;
349
+ }
350
+ if (bid.params.bcat) {
351
+ globals['bcat'] = Array.isArray(bid.params.bcat) ? bid.params.bcat : [];
352
+ }
353
+ if (bid.params.badv) {
354
+ globals['badv'] = Array.isArray(bid.params.badv) ? bid.params.badv : [];
334
355
  }
335
- return !!(bid.params.token && bid.params.media);
356
+ return !!(bid.params.token && bid.params.publisher && bid.params.tagid);
336
357
  },
337
358
 
338
359
  /**
@@ -1,15 +1,15 @@
1
1
  # Overview
2
2
 
3
3
  ```
4
- Module Name: DiscoveryDSP Bid Adapter
4
+ Module Name: discovery Bid Adapter
5
5
  Module Type: Bidder Adapter
6
6
  ```
7
7
 
8
8
  # Description
9
9
 
10
- Module that connects to popIn's demand sources
10
+ Module that connects to popIn's demand sources.
11
11
 
12
- The DiscoveryDSP Bidding adapter requires setup before beginning. Please contact us at <media-support@popin.cc>
12
+ The discovery Bidding adapter requires setup before beginning. Please contact us at <media-support@popin.cc>
13
13
 
14
14
  # Test Parameters
15
15
  ```
@@ -32,7 +32,8 @@ The DiscoveryDSP Bidding adapter requires setup before beginning. Please contact
32
32
  bidder: "discovery",
33
33
  params: {
34
34
  token: "a1b067897e4ae093d1f94261e0ddc6c9",
35
- media: 'test_media' // your media host
35
+ tagid: 'test_tagid',
36
+ publisher: 'test_publisher'
36
37
  },
37
38
  },
38
39
  ],
@@ -45,13 +46,13 @@ The DiscoveryDSP Bidding adapter requires setup before beginning. Please contact
45
46
  sizes: [[300, 250]],
46
47
  },
47
48
  },
48
- // Replace this object to test a new adapter!
49
49
  bids: [
50
50
  {
51
51
  bidder: "discovery",
52
52
  params: {
53
53
  token: "d0f4902b616cc5c38cbe0a08676d0ed9",
54
- media: 'test_media' // your media host
54
+ tagid: 'test_tagid',
55
+ publisher: 'test_publisher'
55
56
  },
56
57
  },
57
58
  ],