prebid.js 5.20.0 → 6.3.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/.babelrc.js +1 -10
  2. package/README.md +4 -2
  3. package/browsers.json +13 -37
  4. package/gulpfile.js +1 -8
  5. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  6. package/karma.conf.maker.js +1 -1
  7. package/modules/33acrossBidAdapter.js +189 -102
  8. package/modules/adagioBidAdapter.js +1 -1
  9. package/modules/addefendBidAdapter.js +1 -0
  10. package/modules/adheseBidAdapter.js +7 -2
  11. package/modules/adkernelBidAdapter.js +1 -0
  12. package/modules/adlivetechBidAdapter.md +61 -0
  13. package/modules/admanBidAdapter.js +1 -0
  14. package/modules/admixerBidAdapter.js +3 -2
  15. package/modules/adnuntiusBidAdapter.js +5 -2
  16. package/modules/adomikAnalyticsAdapter.js +10 -4
  17. package/modules/adplusBidAdapter.js +203 -0
  18. package/modules/adplusBidAdapter.md +39 -0
  19. package/modules/adxcgBidAdapter.js +311 -359
  20. package/modules/adxcgBidAdapter.md +22 -21
  21. package/modules/adyoulikeBidAdapter.js +7 -2
  22. package/modules/appnexusBidAdapter.js +23 -3
  23. package/modules/beachfrontBidAdapter.js +14 -17
  24. package/modules/beopBidAdapter.js +5 -3
  25. package/modules/codefuelBidAdapter.js +1 -3
  26. package/modules/codefuelBidAdapter.md +3 -3
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/craftBidAdapter.js +5 -3
  29. package/modules/criteoBidAdapter.js +1 -1
  30. package/modules/cwireBidAdapter.js +3 -0
  31. package/modules/datablocksBidAdapter.js +3 -3
  32. package/modules/dchain.js +149 -0
  33. package/modules/dchain.md +45 -0
  34. package/modules/deepintentBidAdapter.js +1 -1
  35. package/modules/dspxBidAdapter.js +1 -1
  36. package/modules/emx_digitalBidAdapter.js +9 -1
  37. package/modules/engageyaBidAdapter.js +68 -54
  38. package/modules/freewheel-sspBidAdapter.js +6 -0
  39. package/modules/futureads.md +48 -0
  40. package/modules/glimpseBidAdapter.js +44 -16
  41. package/modules/goldbachBidAdapter.js +1176 -0
  42. package/modules/goldbachBidAdapter.md +151 -0
  43. package/modules/gptPreAuction.js +11 -5
  44. package/modules/gridBidAdapter.js +1 -1
  45. package/modules/gumgumBidAdapter.js +7 -3
  46. package/modules/id5IdSystem.md +6 -6
  47. package/modules/imRtdProvider.js +31 -0
  48. package/modules/intersectionRtdProvider.js +114 -0
  49. package/modules/invibesBidAdapter.js +15 -9
  50. package/modules/ipromBidAdapter.js +79 -0
  51. package/modules/ixBidAdapter.js +166 -21
  52. package/modules/kinessoIdSystem.js +1 -1
  53. package/modules/limelightDigitalBidAdapter.js +2 -1
  54. package/modules/lotamePanoramaIdSystem.js +80 -8
  55. package/modules/luponmediaBidAdapter.js +570 -0
  56. package/modules/mediasquareBidAdapter.js +1 -9
  57. package/modules/merkleIdSystem.js +5 -0
  58. package/modules/missenaBidAdapter.js +89 -0
  59. package/modules/nativoBidAdapter.js +27 -1
  60. package/modules/nextMillenniumBidAdapter.js +29 -1
  61. package/modules/oguryBidAdapter.js +2 -1
  62. package/modules/openxBidAdapter.js +6 -1
  63. package/modules/prebidServerBidAdapter/index.js +19 -15
  64. package/modules/pubmaticBidAdapter.js +5 -3
  65. package/modules/relaidoBidAdapter.js +86 -65
  66. package/modules/richaudienceBidAdapter.js +2 -3
  67. package/modules/rtdModule/index.js +48 -18
  68. package/modules/rubiconBidAdapter.js +10 -8
  69. package/modules/saambaaBidAdapter.js +420 -0
  70. package/modules/saambaaBidAdapter.md +65 -68
  71. package/modules/seedtagBidAdapter.js +6 -0
  72. package/modules/sharedIdSystem.js +27 -1
  73. package/modules/smaatoBidAdapter.js +9 -1
  74. package/modules/smartxBidAdapter.js +17 -1
  75. package/modules/sspBCBidAdapter.js +34 -3
  76. package/modules/tappxBidAdapter.js +3 -1
  77. package/modules/targetVideoBidAdapter.js +187 -0
  78. package/modules/targetVideoBidAdapter.md +34 -0
  79. package/modules/trustxBidAdapter.js +10 -1
  80. package/modules/undertoneBidAdapter.js +8 -1
  81. package/modules/userId/index.js +27 -2
  82. package/modules/ventes.md +71 -0
  83. package/modules/ventesBidAdapter.js +104 -64
  84. package/modules/ventesBidAdapter.md +0 -1
  85. package/modules/vidoomyBidAdapter.js +65 -108
  86. package/modules/visxBidAdapter.js +20 -3
  87. package/modules/visxBidAdapter.md +4 -6
  88. package/modules/weboramaRtdProvider.js +288 -73
  89. package/modules/weboramaRtdProvider.md +27 -10
  90. package/modules/yahoosspBidAdapter.js +5 -1
  91. package/modules/yahoosspBidAdapter.md +1 -1
  92. package/modules/yieldlabBidAdapter.js +41 -10
  93. package/modules/yieldlabBidAdapter.md +91 -48
  94. package/modules/yieldoneBidAdapter.js +115 -11
  95. package/modules/zetaSspBidAdapter.md +33 -1
  96. package/modules/zeta_global_sspBidAdapter.js +22 -1
  97. package/package.json +6 -1
  98. package/plugins/pbjsGlobals.js +28 -1
  99. package/src/adapterManager.js +14 -8
  100. package/src/auction.js +3 -2
  101. package/src/prebid.js +1 -2
  102. package/src/targeting.js +24 -3
  103. package/src/utils.js +41 -7
  104. package/test/spec/integration/faker/googletag.js +6 -0
  105. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  106. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  107. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  108. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  109. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  110. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  111. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  112. package/test/spec/modules/appnexusBidAdapter_spec.js +63 -1
  113. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  114. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  115. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  116. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  117. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  118. package/test/spec/modules/dchain_spec.js +329 -0
  119. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  120. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  121. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  122. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  123. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  124. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  125. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  126. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  127. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  128. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  129. package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
  130. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  131. package/test/spec/modules/ixBidAdapter_spec.js +285 -2
  132. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  133. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  134. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  135. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  136. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  137. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  138. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  139. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  140. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +18 -0
  141. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  142. package/test/spec/modules/openxBidAdapter_spec.js +5 -0
  143. package/test/spec/modules/prebidServerBidAdapter_spec.js +62 -2
  144. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  145. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  146. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  147. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  148. package/test/spec/modules/rubiconBidAdapter_spec.js +17 -0
  149. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  150. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  151. package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
  152. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  153. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  154. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  155. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  156. package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
  157. package/test/spec/modules/userId_spec.js +51 -0
  158. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  159. package/test/spec/modules/visxBidAdapter_spec.js +121 -5
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  162. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  163. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/adapterManager_spec.js +24 -6
  166. package/test/spec/unit/core/targeting_spec.js +116 -0
  167. package/test/spec/utils_spec.js +38 -0
  168. package/wdio.conf.js +1 -1
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { registerBidder } from '../src/adapters/bidderFactory.js';
4
4
  import { BANNER, VIDEO } from '../src/mediaTypes.js';
5
+ import { config } from '../src/config.js';
5
6
 
6
7
  const BIDDER_CODE = 'adhese';
7
8
  const GVLID = 553;
@@ -20,11 +21,15 @@ export const spec = {
20
21
  if (validBidRequests.length === 0) {
21
22
  return null;
22
23
  }
24
+
23
25
  const { gdprConsent, refererInfo } = bidderRequest;
24
26
 
27
+ const adheseConfig = config.getConfig('adhese');
25
28
  const gdprParams = (gdprConsent && gdprConsent.consentString) ? { xt: [gdprConsent.consentString] } : {};
26
29
  const refererParams = (refererInfo && refererInfo.referer) ? { xf: [base64urlEncode(refererInfo.referer)] } : {};
27
- const commonParams = { ...gdprParams, ...refererParams };
30
+ const globalCustomParams = (adheseConfig && adheseConfig.globalTargets) ? cleanTargets(adheseConfig.globalTargets) : {};
31
+ const commonParams = { ...globalCustomParams, ...gdprParams, ...refererParams };
32
+ const vastContentAsUrl = !(adheseConfig && adheseConfig.vastContentAsUrl == false);
28
33
 
29
34
  const slots = validBidRequests.map(bid => ({
30
35
  slotname: bidToSlotName(bid),
@@ -34,7 +39,7 @@ export const spec = {
34
39
  const payload = {
35
40
  slots: slots,
36
41
  parameters: commonParams,
37
- vastContentAsUrl: true,
42
+ vastContentAsUrl: vastContentAsUrl,
38
43
  user: {
39
44
  ext: {
40
45
  eids: getEids(validBidRequests),
@@ -75,6 +75,7 @@ export const spec = {
75
75
  {code: 'denakop'},
76
76
  {code: 'rtbanalytica'},
77
77
  {code: 'unibots'},
78
+ {code: 'catapultx'},
78
79
  {code: 'ergadx'},
79
80
  {code: 'turktelekom'}
80
81
  ],
@@ -0,0 +1,61 @@
1
+ # Overview
2
+
3
+ Module Name: Adlivetech 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: "adlivetech",
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: "adlivetech",
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: "adlivetech",
54
+ params: {
55
+ uid: 11
56
+ }
57
+ }
58
+ ]
59
+ }
60
+ ];
61
+ ```
@@ -108,6 +108,7 @@ export const spec = {
108
108
  }
109
109
  if (bid.userId) {
110
110
  getUserId(placement.eids, bid.userId.uid2 && bid.userId.uid2.id, 'uidapi.com');
111
+ getUserId(placement.eids, bid.userId.lotamePanoramaId, 'lotame.com');
111
112
  }
112
113
  if (traff === VIDEO) {
113
114
  placement.playerSize = bid.mediaTypes[VIDEO].playerSize;
@@ -1,14 +1,15 @@
1
1
  import { logError } from '../src/utils.js';
2
2
  import {registerBidder} from '../src/adapters/bidderFactory.js';
3
3
  import {config} from '../src/config.js';
4
+ import {BANNER, VIDEO, NATIVE} from '../src/mediaTypes.js';
4
5
 
5
6
  const BIDDER_CODE = 'admixer';
6
- const ALIASES = ['go2net', 'adblender', 'adsyield'];
7
+ const ALIASES = ['go2net', 'adblender', 'adsyield', 'futureads'];
7
8
  const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.2.aspx';
8
9
  export const spec = {
9
10
  code: BIDDER_CODE,
10
11
  aliases: ALIASES,
11
- supportedMediaTypes: ['banner', 'video'],
12
+ supportedMediaTypes: [BANNER, VIDEO, NATIVE],
12
13
  /**
13
14
  * Determines whether or not the given bid request is valid.
14
15
  */
@@ -37,7 +37,8 @@ const handleMeta = function () {
37
37
  }
38
38
 
39
39
  const getUsi = function (meta, ortb2, bidderRequest) {
40
- const usi = (meta !== null) ? meta.usi : false;
40
+ let usi = (meta !== null && meta.usi) ? meta.usi : false;
41
+ if (ortb2 && ortb2.user && ortb2.user.id) { usi = ortb2.user.id }
41
42
  return usi
42
43
  }
43
44
 
@@ -55,6 +56,8 @@ export const spec = {
55
56
  const requests = [];
56
57
  const request = [];
57
58
  const ortb2 = config.getConfig('ortb2');
59
+ const bidderConfig = config.getConfig();
60
+
58
61
  const adnMeta = handleMeta()
59
62
  const usi = getUsi(adnMeta, ortb2, bidderRequest)
60
63
  const segments = getSegmentsFromOrtb(ortb2);
@@ -67,7 +70,7 @@ export const spec = {
67
70
  if (gdprApplies !== undefined) request.push('consentString=' + consentString);
68
71
  if (segments.length > 0) request.push('segments=' + segments.join(','));
69
72
  if (usi) request.push('userId=' + usi);
70
-
73
+ if (bidderConfig.useCookie === false) request.push('noCookies=true')
71
74
  for (var i = 0; i < validBidRequests.length; i++) {
72
75
  const bid = validBidRequests[i]
73
76
  const network = bid.params.network || 'network';
@@ -12,6 +12,7 @@ const bidRequested = CONSTANTS.EVENTS.BID_REQUESTED;
12
12
  const bidResponse = CONSTANTS.EVENTS.BID_RESPONSE;
13
13
  const bidWon = CONSTANTS.EVENTS.BID_WON;
14
14
  const bidTimeout = CONSTANTS.EVENTS.BID_TIMEOUT;
15
+ const ua = navigator.userAgent;
15
16
 
16
17
  let adomikAdapter = Object.assign(adapter({}),
17
18
  {
@@ -47,7 +48,7 @@ let adomikAdapter = Object.assign(adapter({}),
47
48
  type: 'request',
48
49
  event: {
49
50
  bidder: bid.bidder.toUpperCase(),
50
- placementCode: bid.placementCode
51
+ placementCode: bid.adUnitCode
51
52
  }
52
53
  });
53
54
  });
@@ -67,6 +68,10 @@ adomikAdapter.initializeBucketEvents = function() {
67
68
  adomikAdapter.bucketEvents = [];
68
69
  }
69
70
 
71
+ adomikAdapter.maxPartLength = function () {
72
+ return (ua.includes(' MSIE ')) ? 1600 : 60000;
73
+ };
74
+
70
75
  adomikAdapter.sendTypedEvent = function() {
71
76
  const groupedTypedEvents = adomikAdapter.buildTypedEvents();
72
77
 
@@ -108,9 +113,10 @@ adomikAdapter.sendTypedEvent = function() {
108
113
  // Encode object in base64
109
114
  const encodedBuf = window.btoa(stringBulkEvents);
110
115
 
111
- // Create final url and split it in 1600 characters max (+endpoint length)
116
+ // Create final url and split it (+endpoint length)
112
117
  const encodedUri = encodeURIComponent(encodedBuf);
113
- const splittedUrl = encodedUri.match(/.{1,1600}/g);
118
+ const maxLength = adomikAdapter.maxPartLength();
119
+ const splittedUrl = encodedUri.match(new RegExp(`.{1,${maxLength}}`, 'g'));
114
120
 
115
121
  splittedUrl.forEach((split, i) => {
116
122
  const partUrl = `${split}&id=${adomikAdapter.currentContext.id}&part=${i}&on=${splittedUrl.length - 1}`;
@@ -121,7 +127,7 @@ adomikAdapter.sendTypedEvent = function() {
121
127
 
122
128
  adomikAdapter.sendWonEvent = function (wonEvent) {
123
129
  const stringWonEvent = JSON.stringify(wonEvent)
124
- logInfo('Won event sent to adomik prebid analytic ' + wonEvent);
130
+ logInfo('Won event sent to adomik prebid analytic ' + stringWonEvent);
125
131
 
126
132
  // Encode object in base64
127
133
  const encodedBuf = window.btoa(stringWonEvent);
@@ -0,0 +1,203 @@
1
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
2
+ import * as utils from '../src/utils.js';
3
+ import { BANNER } from '../src/mediaTypes.js';
4
+ import { getStorageManager } from '../src/storageManager.js';
5
+
6
+ // #region Constants
7
+ export const BIDDER_CODE = 'adplus';
8
+ export const ADPLUS_ENDPOINT = 'https://ssp.ad-plus.com.tr/server/headerBidding';
9
+ export const DGID_CODE = 'adplus_dg_id';
10
+ export const SESSION_CODE = 'adplus_s_id';
11
+ export const storage = getStorageManager(undefined, BIDDER_CODE);
12
+ const COOKIE_EXP = 1000 * 60 * 60 * 24; // 1 day
13
+ // #endregion
14
+
15
+ // #region Helpers
16
+ export function isValidUuid (uuid) {
17
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
18
+ uuid
19
+ );
20
+ }
21
+
22
+ function getSessionId() {
23
+ let sid = storage.cookiesAreEnabled() && storage.getCookie(SESSION_CODE);
24
+
25
+ if (
26
+ !sid || !isValidUuid(sid)
27
+ ) {
28
+ sid = utils.generateUUID();
29
+ setSessionId(sid);
30
+ }
31
+
32
+ return sid;
33
+ }
34
+
35
+ function setSessionId(sid) {
36
+ if (storage.cookiesAreEnabled()) {
37
+ const expires = new Date(Date.now() + COOKIE_EXP).toISOString();
38
+
39
+ storage.setCookie(SESSION_CODE, sid, expires);
40
+ }
41
+ }
42
+ // #endregion
43
+
44
+ // #region Bid request validation
45
+ function isBidRequestValid(bid) {
46
+ if (!bid) {
47
+ utils.logError(BIDDER_CODE, 'bid, can not be empty', bid);
48
+ return false;
49
+ }
50
+
51
+ if (!bid.params) {
52
+ utils.logError(BIDDER_CODE, 'bid.params is required.');
53
+ return false;
54
+ }
55
+
56
+ if (!bid.params.adUnitId || typeof bid.params.adUnitId !== 'string') {
57
+ utils.logError(
58
+ BIDDER_CODE,
59
+ 'bid.params.adUnitId is missing or has wrong type.'
60
+ );
61
+ return false;
62
+ }
63
+
64
+ if (!bid.params.inventoryId || typeof bid.params.inventoryId !== 'string') {
65
+ utils.logError(
66
+ BIDDER_CODE,
67
+ 'bid.params.inventoryId is missing or has wrong type.'
68
+ );
69
+ return false;
70
+ }
71
+
72
+ if (
73
+ !bid.mediaTypes ||
74
+ !bid.mediaTypes[BANNER] ||
75
+ !utils.isArray(bid.mediaTypes[BANNER].sizes) ||
76
+ bid.mediaTypes[BANNER].sizes.length <= 0 ||
77
+ !utils.isArrayOfNums(bid.mediaTypes[BANNER].sizes[0])
78
+ ) {
79
+ utils.logError(BIDDER_CODE, 'Wrong or missing size parameters.');
80
+ return false;
81
+ }
82
+
83
+ return true;
84
+ }
85
+ // #endregion
86
+
87
+ // #region Building the bid requests
88
+ /**
89
+ *
90
+ * @param {object} bid
91
+ * @returns
92
+ */
93
+ function createBidRequest(bid) {
94
+ // Developer Params
95
+ const {
96
+ inventoryId,
97
+ adUnitId,
98
+ extraData,
99
+ yearOfBirth,
100
+ gender,
101
+ categories,
102
+ latitude,
103
+ longitude,
104
+ sdkVersion,
105
+ } = bid.params;
106
+
107
+ return {
108
+ method: 'GET',
109
+ url: ADPLUS_ENDPOINT,
110
+ data: utils.cleanObj({
111
+ bidId: bid.bidId,
112
+ inventoryId,
113
+ adUnitId,
114
+ adUnitWidth: bid.mediaTypes[BANNER].sizes[0][0],
115
+ adUnitHeight: bid.mediaTypes[BANNER].sizes[0][1],
116
+ extraData,
117
+ yearOfBirth,
118
+ gender,
119
+ categories,
120
+ latitude,
121
+ longitude,
122
+ sdkVersion: sdkVersion || '1',
123
+ session: getSessionId(),
124
+ interstitial: 0,
125
+ token: typeof window.top === 'object' && window.top[DGID_CODE] ? window.top[DGID_CODE] : undefined,
126
+ secure: window.location.protocol === 'https:' ? 1 : 0,
127
+ screenWidth: screen.width,
128
+ screenHeight: screen.height,
129
+ language: window.navigator.language || 'en-US',
130
+ pageUrl: window.location.href,
131
+ domain: window.location.hostname,
132
+ referrer: window.location.referrer,
133
+ }),
134
+ };
135
+ }
136
+
137
+ function buildRequests(validBidRequests, bidderRequest) {
138
+ return validBidRequests.map((req) => createBidRequest(req));
139
+ }
140
+ // #endregion
141
+
142
+ // #region Interpreting Responses
143
+ /**
144
+ *
145
+ * @param {HeaderBiddingResponse} responseData
146
+ * @param { object } bidParams
147
+ * @returns
148
+ */
149
+ function createAdResponse(responseData, bidParams) {
150
+ return {
151
+ requestId: responseData.requestID,
152
+ cpm: responseData.cpm,
153
+ currency: responseData.currency,
154
+ width: responseData.width,
155
+ height: responseData.height,
156
+ creativeId: responseData.creativeID,
157
+ dealId: responseData.dealID,
158
+ netRevenue: responseData.netRevenue,
159
+ ttl: responseData.ttl,
160
+ ad: responseData.ad,
161
+ mediaType: responseData.mediaType,
162
+ meta: {
163
+ advertiserDomains: responseData.advertiserDomains,
164
+ primaryCatId: utils.isArray(responseData.categoryIDs) && responseData.categoryIDs.length > 0
165
+ ? responseData.categoryIDs[0] : undefined,
166
+ secondaryCatIds: responseData.categoryIDs,
167
+ },
168
+ };
169
+ }
170
+
171
+ function interpretResponse(response, request) {
172
+ // In case of empty response
173
+ if (
174
+ response.body == null ||
175
+ !utils.isArray(response.body) ||
176
+ response.body.length === 0
177
+ ) {
178
+ return [];
179
+ }
180
+ const bids = response.body.map((bid) => createAdResponse(bid));
181
+ return bids;
182
+ }
183
+ // #endregion
184
+
185
+ // #region Bidder
186
+ export const spec = {
187
+ code: BIDDER_CODE,
188
+ supportedMediaTypes: [BANNER],
189
+ isBidRequestValid,
190
+ buildRequests,
191
+ interpretResponse,
192
+ onTimeout(timeoutData) {
193
+ utils.logError('Adplus adapter timed out for the auction.', timeoutData);
194
+ },
195
+ onBidWon(bid) {
196
+ utils.logInfo(
197
+ `Adplus adapter won the auction. Bid id: ${bid.bidId}, Ad Unit Id: ${bid.adUnitId}, Inventory Id: ${bid.inventoryId}`
198
+ );
199
+ },
200
+ };
201
+
202
+ registerBidder(spec);
203
+ // #endregion
@@ -0,0 +1,39 @@
1
+ # Overview
2
+
3
+ Module Name: AdPlus Bidder Adapter
4
+
5
+ Module Type: Bidder Adapter
6
+
7
+ Maintainer: adplus.destek@yaani.com.tr
8
+
9
+ # Description
10
+
11
+ AdPlus Prebid.js Bidder Adapter. Only banner formats are supported.
12
+
13
+ About us : https://ssp.ad-plus.com.tr/
14
+
15
+ # Test Parameters
16
+
17
+ ```javascript
18
+ var adUnits = [
19
+ {
20
+ code: "div-adplus",
21
+ mediaTypes: {
22
+ banner: {
23
+ sizes: [
24
+ [300, 250],
25
+ ],
26
+ },
27
+ },
28
+ bids: [
29
+ {
30
+ bidder: "adplus",
31
+ params: {
32
+ inventoryId: "-1",
33
+ adUnitId: "-3",
34
+ },
35
+ },
36
+ ],
37
+ },
38
+ ];
39
+ ```