prebid.js 6.4.0 → 6.8.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 (147) hide show
  1. package/integrationExamples/gpt/amp/creative.html +11 -33
  2. package/integrationExamples/gpt/x-domain/creative.html +53 -26
  3. package/modules/.submodules.json +2 -1
  4. package/modules/adagioBidAdapter.js +0 -8
  5. package/modules/adagioBidAdapter.md +1 -1
  6. package/modules/adbookpspBidAdapter.js +27 -10
  7. package/modules/adhashBidAdapter.js +3 -3
  8. package/modules/adkernelBidAdapter.js +2 -1
  9. package/modules/admanBidAdapter.js +10 -4
  10. package/modules/adomikAnalyticsAdapter.js +23 -11
  11. package/modules/adqueryIdSystem.js +103 -0
  12. package/modules/adqueryIdSystem.md +35 -0
  13. package/modules/adyoulikeBidAdapter.js +13 -9
  14. package/modules/appnexusBidAdapter.js +11 -0
  15. package/modules/bliinkBidAdapter.js +3 -2
  16. package/modules/brandmetricsRtdProvider.js +168 -0
  17. package/modules/brandmetricsRtdProvider.md +40 -0
  18. package/modules/colossussspBidAdapter.js +12 -8
  19. package/modules/colossussspBidAdapter.md +15 -1
  20. package/modules/compassBidAdapter.js +10 -3
  21. package/modules/consentManagement.js +7 -1
  22. package/modules/consumableBidAdapter.md +1 -1
  23. package/modules/criteoBidAdapter.js +10 -1
  24. package/modules/criteoIdSystem.js +29 -7
  25. package/modules/currency.js +26 -1
  26. package/modules/displayioBidAdapter.js +157 -0
  27. package/modules/displayioBidAdapter.md +148 -0
  28. package/modules/docereeBidAdapter.js +10 -1
  29. package/modules/docereeBidAdapter.md +2 -0
  30. package/modules/e_volutionBidAdapter.js +158 -0
  31. package/modules/glimpseBidAdapter.js +66 -44
  32. package/modules/gnetBidAdapter.js +3 -3
  33. package/modules/gnetBidAdapter.md +4 -4
  34. package/modules/gptPreAuction.js +55 -7
  35. package/modules/gumgumBidAdapter.js +56 -42
  36. package/modules/idImportLibrary.js +45 -8
  37. package/modules/idImportLibrary.md +4 -0
  38. package/modules/improvedigitalBidAdapter.js +24 -2
  39. package/modules/interactiveOffersBidAdapter.js +9 -6
  40. package/modules/ixBidAdapter.js +29 -12
  41. package/modules/jwplayerRtdProvider.js +71 -6
  42. package/modules/jwplayerRtdProvider.md +27 -11
  43. package/modules/kargoBidAdapter.js +2 -2
  44. package/modules/limelightDigitalBidAdapter.js +2 -1
  45. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  46. package/modules/loglyliftBidAdapter.js +79 -0
  47. package/modules/loglyliftBidAdapter.md +55 -0
  48. package/modules/nextMillenniumBidAdapter.js +3 -1
  49. package/modules/oguryBidAdapter.js +9 -2
  50. package/modules/onetagBidAdapter.js +4 -2
  51. package/modules/optimeraRtdProvider.js +8 -1
  52. package/modules/ozoneBidAdapter.js +21 -64
  53. package/modules/pilotxBidAdapter.js +147 -0
  54. package/modules/pilotxBidAdapter.md +50 -0
  55. package/modules/proxistoreBidAdapter.js +0 -2
  56. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  57. package/modules/richaudienceBidAdapter.js +3 -2
  58. package/modules/riseBidAdapter.js +1 -1
  59. package/modules/rtbhouseBidAdapter.js +14 -4
  60. package/modules/rtdModule/index.js +14 -15
  61. package/modules/rubiconAnalyticsAdapter.js +3 -2
  62. package/modules/seedingAllianceBidAdapter.js +3 -3
  63. package/modules/sharethroughBidAdapter.js +12 -17
  64. package/modules/showheroes-bsBidAdapter.js +13 -2
  65. package/modules/sovrnBidAdapter.js +93 -18
  66. package/modules/sovrnBidAdapter.md +80 -2
  67. package/modules/synacormediaBidAdapter.js +31 -10
  68. package/modules/tappxBidAdapter.js +8 -5
  69. package/modules/teadsBidAdapter.js +1 -2
  70. package/modules/undertoneBidAdapter.js +17 -1
  71. package/modules/userId/eids.js +7 -1
  72. package/modules/userId/userId.md +8 -0
  73. package/modules/viewability.js +177 -0
  74. package/modules/viewability.md +87 -0
  75. package/modules/welectBidAdapter.js +106 -0
  76. package/modules/yahoosspBidAdapter.js +2 -0
  77. package/modules/yieldmoBidAdapter.js +23 -5
  78. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  79. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  80. package/package.json +1 -1
  81. package/src/adRendering.js +38 -0
  82. package/src/auction.js +44 -9
  83. package/src/config.js +27 -3
  84. package/src/hook.js +5 -1
  85. package/src/prebid.js +21 -21
  86. package/src/secureCreatives.js +114 -44
  87. package/src/utils.js +25 -4
  88. package/test/helpers/syncPromise.js +71 -0
  89. package/test/spec/auctionmanager_spec.js +148 -16
  90. package/test/spec/config_spec.js +279 -0
  91. package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
  92. package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
  93. package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
  94. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  95. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  96. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  97. package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
  98. package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
  99. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  100. package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
  101. package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
  102. package/test/spec/modules/compassBidAdapter_spec.js +1 -0
  103. package/test/spec/modules/consentManagement_spec.js +20 -0
  104. package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
  105. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  106. package/test/spec/modules/currency_spec.js +21 -6
  107. package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
  108. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  109. package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
  110. package/test/spec/modules/eids_spec.js +15 -0
  111. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  112. package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
  113. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  114. package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
  115. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  116. package/test/spec/modules/improvedigitalBidAdapter_spec.js +42 -0
  117. package/test/spec/modules/ixBidAdapter_spec.js +104 -62
  118. package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
  119. package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
  120. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
  121. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  122. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  123. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
  124. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  125. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  126. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  127. package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
  128. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  129. package/test/spec/modules/realTimeDataModule_spec.js +67 -5
  130. package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
  131. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  132. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  133. package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +30 -0
  134. package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
  135. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  136. package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
  137. package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
  138. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  139. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  140. package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
  141. package/test/spec/modules/userId_spec.js +68 -19
  142. package/test/spec/modules/viewability_spec.js +280 -0
  143. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  144. package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
  145. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  146. package/test/spec/unit/pbjs_api_spec.js +20 -2
  147. package/test/spec/unit/secureCreatives_spec.js +85 -0
@@ -1,38 +1,16 @@
1
1
  <!-- This script tag should be returned by your ad server -->
2
2
 
3
+ <script src="https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
3
4
  <script>
4
- // This is the `renderAd` function from Prebid.js moved within the creative iframe
5
- var renderAd = function (ev) {
6
- var key = ev.message ? "message" : "data";
7
- var data = {};
8
- try {
9
- data = JSON.parse(ev[key]);
10
- } catch (e) {
11
- // Do nothing. No ad found.
12
- }
13
- if (data.ad || data.adUrl) {
14
- if (data.ad) {
15
- document.write(data.ad);
16
- document.close();
17
- } else if (data.adUrl) {
18
- document.write('<IFRAME SRC="' + data.adUrl + '" WIDTH="'+ data.width +'" HEIGHT="'+ data.height +'" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true"></IFRAME>');
19
- document.close();
20
- }
21
- }
22
- };
5
+ var ucTagData = {};
6
+ ucTagData.adServerDomain = "";
7
+ ucTagData.pubUrl = "%%PATTERN:url%%";
8
+ ucTagData.targetingMap = "%%PATTERN:TARGETINGMAP%%";
9
+ ucTagData.hbPb = "%%PATTERN:hb_pb%%";
23
10
 
24
- var requestAdFromPrebid = function () {
25
- var message = JSON.stringify({
26
- message: 'Prebid creative requested: %%PATTERN:hb_adid%%',
27
- adId: '%%PATTERN:hb_adid%%'
28
- });
29
- window.parent.postMessage(message, '*');
30
- };
31
-
32
- var listenAdFromPrebid = function () {
33
- window.addEventListener("message", renderAd, false);
34
- };
35
-
36
- listenAdFromPrebid();
37
- requestAdFromPrebid();
11
+ try {
12
+ ucTag.renderAd(document, ucTagData);
13
+ } catch (e) {
14
+ console.log(e);
15
+ }
38
16
  </script>
@@ -2,37 +2,40 @@
2
2
  // this script can be returned by an ad server delivering a cross domain iframe, into which the
3
3
  // creative will be rendered, e.g. DFP delivering a SafeFrame
4
4
 
5
- let windowLocation = window.location;
6
- var urlParser = document.createElement('a');
5
+ const windowLocation = window.location;
6
+ const urlParser = document.createElement('a');
7
7
  urlParser.href = '%%PATTERN:url%%';
8
- var publisherDomain = urlParser.protocol + '//' + urlParser.hostname;
8
+ const publisherDomain = urlParser.protocol + '//' + urlParser.hostname;
9
+ const adId = '%%PATTERN:hb_adid%%';
9
10
 
10
11
  function renderAd(ev) {
11
- var key = ev.message ? 'message' : 'data';
12
- var adObject = {};
13
- try {
14
- adObject = JSON.parse(ev[key]);
15
- } catch (e) {
16
- return;
17
- }
12
+ const key = ev.message ? 'message' : 'data';
13
+ let adObject = {};
14
+ try {
15
+ adObject = JSON.parse(ev[key]);
16
+ } catch (e) {
17
+ return;
18
+ }
18
19
 
19
- var origin = ev.origin || ev.originalEvent.origin;
20
- if (adObject.message && adObject.message === 'Prebid Response' &&
21
- publisherDomain === origin &&
22
- adObject.adId === '%%PATTERN:hb_adid%%' &&
23
- (adObject.ad || adObject.adUrl)) {
24
- var body = window.document.body;
25
- var ad = adObject.ad;
26
- var url = adObject.adUrl;
27
- var width = adObject.width;
28
- var height = adObject.height;
20
+ const origin = ev.origin || ev.originalEvent.origin;
21
+ if (adObject.message && adObject.message === 'Prebid Response' &&
22
+ publisherDomain === origin &&
23
+ adObject.adId === adId) {
24
+ try {
25
+ const body = window.document.body;
26
+ const ad = adObject.ad;
27
+ const url = adObject.adUrl;
28
+ const width = adObject.width;
29
+ const height = adObject.height;
29
30
 
30
31
  if (adObject.mediaType === 'video') {
32
+ signalRenderResult(false, {
33
+ reason: 'preventWritingOnMainDocument',
34
+ message: `Cannot render video ad ${adId}`
35
+ });
31
36
  console.log('Error trying to write ad.');
32
- } else
33
-
34
- if (ad) {
35
- var frame = document.createElement('iframe');
37
+ } else if (ad) {
38
+ const frame = document.createElement('iframe');
36
39
  frame.setAttribute('FRAMEBORDER', 0);
37
40
  frame.setAttribute('SCROLLING', 'no');
38
41
  frame.setAttribute('MARGINHEIGHT', 0);
@@ -46,18 +49,42 @@ function renderAd(ev) {
46
49
  frame.contentDocument.open();
47
50
  frame.contentDocument.write(ad);
48
51
  frame.contentDocument.close();
52
+ signalRenderResult(true);
49
53
  } else if (url) {
50
54
  body.insertAdjacentHTML('beforeend', '<IFRAME SRC="' + url + '" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="' + width + '" HEIGHT="' + height + '"></IFRAME>');
55
+ signalRenderResult(true);
51
56
  } else {
52
- console.log('Error trying to write ad. No ad for bid response id: ' + id);
57
+ signalRenderResult(false, {
58
+ reason: 'noAd',
59
+ message: `No ad for ${adId}`
60
+ });
61
+ console.log(`Error trying to write ad. No ad markup or adUrl for ${adId}`);
53
62
  }
63
+ } catch (e) {
64
+ signalRenderResult(false, {reason: 'exception', message: e.message});
65
+ console.log(`Error in rendering ad`, e);
54
66
  }
55
67
  }
56
68
 
69
+ function signalRenderResult(success, {reason, message} = {}) {
70
+ const payload = {
71
+ message: 'Prebid Event',
72
+ adId,
73
+ event: success ? 'adRenderSucceeded' : 'adRenderFailed',
74
+ }
75
+ if (!success) {
76
+ payload.info = {reason, message};
77
+ }
78
+ ev.source.postMessage(JSON.stringify(payload), publisherDomain);
79
+ }
80
+
81
+ }
82
+
83
+
57
84
  function requestAdFromPrebid() {
58
85
  var message = JSON.stringify({
59
86
  message: 'Prebid Request',
60
- adId: '%%PATTERN:hb_adid%%'
87
+ adId
61
88
  });
62
89
  window.parent.postMessage(message, publisherDomain);
63
90
  }
@@ -35,7 +35,8 @@
35
35
  "uid2IdSystem",
36
36
  "unifiedIdSystem",
37
37
  "verizonMediaIdSystem",
38
- "zeotapIdPlusIdSystem"
38
+ "zeotapIdPlusIdSystem",
39
+ "adqueryIdSystem"
39
40
  ],
40
41
  "adpod": [
41
42
  "freeWheelAdserverVideo",
@@ -268,8 +268,6 @@ function getSite(bidderRequest) {
268
268
  } else if (refererInfo.stack && refererInfo.stack.length && refererInfo.stack[0]) {
269
269
  // important note check if refererInfo.stack[0] is 'thruly' because a `null` value
270
270
  // will be considered as "localhost" by the parseUrl function.
271
- // As the isBidRequestValid returns false when it does not reach the referer
272
- // this should never called.
273
271
  const url = parseUrl(refererInfo.stack[0]);
274
272
  domain = url.hostname;
275
273
  }
@@ -873,12 +871,6 @@ export const spec = {
873
871
 
874
872
  autoFillParams(bid);
875
873
 
876
- if (!internal.getRefererInfo().reachedTop) {
877
- logWarn(`${LOG_PREFIX} the main page url is unreachabled.`);
878
- // internal.enqueue(debugData());
879
- return false;
880
- }
881
-
882
874
  if (!(bid.params.organizationId && bid.params.site && bid.params.placement)) {
883
875
  logWarn(`${LOG_PREFIX} at least one required param is missing.`);
884
876
  // internal.enqueue(debugData());
@@ -18,7 +18,7 @@ Below, the list of Adagio params and where they can be set.
18
18
  | ---------- | ------------- | ------------- |
19
19
  | siteId | x |
20
20
  | organizationId (obsolete) | | x
21
- | site (obsolete) | | x
21
+ | site (obsolete) | | x
22
22
  | pagetype | x | x
23
23
  | environment | x | x
24
24
  | category | x | x
@@ -363,7 +363,7 @@ function impBidsToPrebidBids(
363
363
  }
364
364
 
365
365
  const impToPrebidBid =
366
- (bidderRequestBody, bidResponseCurrency, referrer, targetingMap) => (bid) => {
366
+ (bidderRequestBody, bidResponseCurrency, referrer, targetingMap) => (bid, bidIndex) => {
367
367
  try {
368
368
  const bidRequest = findBidRequest(bidderRequestBody, bid);
369
369
 
@@ -377,7 +377,7 @@ const impToPrebidBid =
377
377
  let prebidBid = {
378
378
  ad: bid.adm,
379
379
  adId: bid.adid,
380
- adserverTargeting: targetingMap[bid.impid],
380
+ adserverTargeting: targetingMap[bidIndex],
381
381
  adUnitCode: bidRequest.tagid,
382
382
  bidderRequestId: bidderRequestBody.id,
383
383
  bidId: bid.id,
@@ -408,6 +408,9 @@ const impToPrebidBid =
408
408
  };
409
409
  }
410
410
 
411
+ if (deepAccess(bid, 'ext.pa_win') === true) {
412
+ prebidBid.auctionWinner = true;
413
+ }
411
414
  return prebidBid;
412
415
  } catch (error) {
413
416
  logError(`${BIDDER_CODE}: Error while building bid`, error);
@@ -429,29 +432,43 @@ function buildTargetingMap(bids) {
429
432
  const values = impIds.reduce((result, id) => {
430
433
  result[id] = {
431
434
  lineItemIds: [],
435
+ orderIds: [],
432
436
  dealIds: [],
433
437
  adIds: [],
438
+ adAndOrderIndexes: []
434
439
  };
435
440
 
436
441
  return result;
437
442
  }, {});
438
443
 
439
- bids.forEach((bid) => {
440
- values[bid.impid].lineItemIds.push(bid.ext.liid);
441
- values[bid.impid].dealIds.push(bid.dealid);
442
- values[bid.impid].adIds.push(bid.adid);
444
+ bids.forEach((bid, bidIndex) => {
445
+ let impId = bid.impid;
446
+ values[impId].lineItemIds.push(bid.ext.liid);
447
+ values[impId].dealIds.push(bid.dealid);
448
+ values[impId].adIds.push(bid.adid);
449
+
450
+ if (deepAccess(bid, 'ext.ordid')) {
451
+ values[impId].orderIds.push(bid.ext.ordid);
452
+ bid.ext.ordid.split(TARGETING_VALUE_SEPARATOR).forEach((ordid, ordIndex) => {
453
+ let adIdIndex = values[impId].adIds.indexOf(bid.adid);
454
+ values[impId].adAndOrderIndexes.push(adIdIndex + '_' + ordIndex)
455
+ })
456
+ }
443
457
  });
444
458
 
445
459
  const targetingMap = {};
446
460
 
447
- for (const id of impIds) {
448
- targetingMap[id] = {
461
+ bids.forEach((bid, bidIndex) => {
462
+ let id = bid.impid;
463
+
464
+ targetingMap[bidIndex] = {
449
465
  hb_liid_adbookpsp: values[id].lineItemIds.join(TARGETING_VALUE_SEPARATOR),
450
466
  hb_deal_adbookpsp: values[id].dealIds.join(TARGETING_VALUE_SEPARATOR),
467
+ hb_ad_ord_adbookpsp: values[id].adAndOrderIndexes.join(TARGETING_VALUE_SEPARATOR),
451
468
  hb_adid_c_adbookpsp: values[id].adIds.join(TARGETING_VALUE_SEPARATOR),
469
+ hb_ordid_adbookpsp: values[id].orderIds.join(TARGETING_VALUE_SEPARATOR),
452
470
  };
453
- }
454
-
471
+ })
455
472
  return targetingMap;
456
473
  }
457
474
 
@@ -6,7 +6,7 @@ const VERSION = '1.0';
6
6
 
7
7
  export const spec = {
8
8
  code: 'adhash',
9
- url: 'https://bidder.adhash.org/rtb?version=' + VERSION + '&prebid=true',
9
+ url: 'https://bidder.adhash.com/rtb?version=' + VERSION + '&prebid=true',
10
10
  supportedMediaTypes: [ BANNER ],
11
11
 
12
12
  isBidRequestValid: (bid) => {
@@ -37,7 +37,7 @@ export const spec = {
37
37
  var size = validBidRequests[i].sizes[index].join('x');
38
38
  bidRequests.push({
39
39
  method: 'POST',
40
- url: url,
40
+ url: url + '&publisher=' + validBidRequests[i].params.publisherId,
41
41
  bidRequest: validBidRequests[i],
42
42
  data: {
43
43
  timezone: new Date().getTimezoneOffset() / 60,
@@ -87,7 +87,7 @@ export const spec = {
87
87
  cpm: responseBody.creatives[0].costEUR,
88
88
  ad:
89
89
  `<div id="${oneTimeId}"></div>
90
- <script src="https://bidder.adhash.org/static/scripts/creative.min.js"></script>
90
+ <script src="https://bidder.adhash.com/static/scripts/creative.min.js"></script>
91
91
  <script>callAdvertiser(${bidderResponse},['${oneTimeId}'],${requestData},${publisherURL})</script>`,
92
92
  width: request.bidRequest.sizes[0][0],
93
93
  height: request.bidRequest.sizes[0][1],
@@ -77,7 +77,8 @@ export const spec = {
77
77
  {code: 'unibots'},
78
78
  {code: 'catapultx'},
79
79
  {code: 'ergadx'},
80
- {code: 'turktelekom'}
80
+ {code: 'turktelekom'},
81
+ {code: 'felixads'}
81
82
  ],
82
83
  supportedMediaTypes: [BANNER, VIDEO, NATIVE],
83
84
 
@@ -1,10 +1,11 @@
1
1
  import {registerBidder} from '../src/adapters/bidderFactory.js';
2
2
  import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
3
3
  import { isFn, deepAccess, logMessage } from '../src/utils.js';
4
+ import {config} from '../src/config.js';
4
5
 
5
6
  const BIDDER_CODE = 'adman';
6
7
  const AD_URL = 'https://pub.admanmedia.com/?c=o&m=multi';
7
- const URL_SYNC = 'https://pub.admanmedia.com/?c=o&m=sync';
8
+ const URL_SYNC = 'https://pub.admanmedia.com';
8
9
 
9
10
  function isBidResponseValid(bid) {
10
11
  if (!bid.requestId || !bid.cpm || !bid.creativeId ||
@@ -152,19 +153,24 @@ export const spec = {
152
153
  },
153
154
 
154
155
  getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
155
- let syncUrl = URL_SYNC
156
+ let syncType = syncOptions.iframeEnabled ? 'iframe' : 'image';
157
+ let syncUrl = URL_SYNC + `/${syncType}?pbjs=1`;
156
158
  if (gdprConsent && gdprConsent.consentString) {
157
159
  if (typeof gdprConsent.gdprApplies === 'boolean') {
158
160
  syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
159
161
  } else {
160
- syncUrl += `&gdpr==0&gdpr_consent=${gdprConsent.consentString}`;
162
+ syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
161
163
  }
162
164
  }
163
165
  if (uspConsent && uspConsent.consentString) {
164
166
  syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
165
167
  }
168
+
169
+ const coppa = config.getConfig('coppa') ? 1 : 0;
170
+ syncUrl += `&coppa=${coppa}`;
171
+
166
172
  return [{
167
- type: 'image',
173
+ type: syncType,
168
174
  url: syncUrl
169
175
  }];
170
176
  }
@@ -14,6 +14,8 @@ const bidWon = CONSTANTS.EVENTS.BID_WON;
14
14
  const bidTimeout = CONSTANTS.EVENTS.BID_TIMEOUT;
15
15
  const ua = navigator.userAgent;
16
16
 
17
+ var _sampled = true;
18
+
17
19
  let adomikAdapter = Object.assign(adapter({}),
18
20
  {
19
21
  // Track every event needed
@@ -81,6 +83,7 @@ adomikAdapter.sendTypedEvent = function() {
81
83
  uid: adomikAdapter.currentContext.uid,
82
84
  ahbaid: adomikAdapter.currentContext.id,
83
85
  hostname: window.location.hostname,
86
+ sampling: adomikAdapter.currentContext.sampling,
84
87
  eventsByPlacementCode: groupedTypedEvents.map(function(typedEventsByType) {
85
88
  let sizes = [];
86
89
  const eventKeys = ['request', 'response', 'winner'];
@@ -203,19 +206,28 @@ adomikAdapter.adapterEnableAnalytics = adomikAdapter.enableAnalytics;
203
206
 
204
207
  adomikAdapter.enableAnalytics = function (config) {
205
208
  adomikAdapter.currentContext = {};
206
-
207
209
  const initOptions = config.options;
208
- if (initOptions) {
209
- adomikAdapter.currentContext = {
210
- uid: initOptions.id,
211
- url: initOptions.url,
212
- testId: initOptions.testId,
213
- testValue: initOptions.testValue,
214
- id: '',
215
- timeouted: false,
210
+
211
+ _sampled = typeof config === 'undefined' ||
212
+ typeof config.sampling === 'undefined' ||
213
+ Math.random() < parseFloat(config.sampling);
214
+
215
+ if (_sampled) {
216
+ if (initOptions) {
217
+ adomikAdapter.currentContext = {
218
+ uid: initOptions.id,
219
+ url: initOptions.url,
220
+ testId: initOptions.testId,
221
+ testValue: initOptions.testValue,
222
+ id: '',
223
+ timeouted: false,
224
+ sampling: config.sampling
225
+ }
226
+ logInfo('Adomik Analytics enabled with config', initOptions);
227
+ adomikAdapter.adapterEnableAnalytics(config);
216
228
  }
217
- logInfo('Adomik Analytics enabled with config', initOptions);
218
- adomikAdapter.adapterEnableAnalytics(config);
229
+ } else {
230
+ logInfo('Adomik Analytics ignored for sampling', config.sampling);
219
231
  }
220
232
  };
221
233
 
@@ -0,0 +1,103 @@
1
+ /**
2
+ * This module adds Adquery QID to the User ID module
3
+ * The {@link module:modules/userId} module is required
4
+ * @module modules/adqueryIdSystem
5
+ * @requires module:modules/userId
6
+ */
7
+
8
+ import {ajax} from '../src/ajax.js';
9
+ import {getStorageManager} from '../src/storageManager.js';
10
+ import {submodule} from '../src/hook.js';
11
+ import * as utils from '../src/utils.js';
12
+
13
+ const MODULE_NAME = 'qid';
14
+ const AU_GVLID = 902;
15
+
16
+ export const storage = getStorageManager(AU_GVLID, 'qid');
17
+
18
+ /**
19
+ * Param or default.
20
+ * @param {String} param
21
+ * @param {String} defaultVal
22
+ */
23
+ function paramOrDefault(param, defaultVal, arg) {
24
+ if (utils.isFn(param)) {
25
+ return param(arg);
26
+ } else if (utils.isStr(param)) {
27
+ return param;
28
+ }
29
+ return defaultVal;
30
+ }
31
+
32
+ /** @type {Submodule} */
33
+ export const adqueryIdSubmodule = {
34
+ /**
35
+ * used to link submodule with config
36
+ * @type {string}
37
+ */
38
+ name: MODULE_NAME,
39
+
40
+ /**
41
+ * IAB TCF Vendor ID
42
+ * @type {string}
43
+ */
44
+ gvlid: AU_GVLID,
45
+
46
+ /**
47
+ * decode the stored id value for passing to bid requests
48
+ * @function
49
+ * @param {{value:string}} value
50
+ * @returns {{qid:Object}}
51
+ */
52
+ decode(value) {
53
+ let qid = storage.getDataFromLocalStorage('qid');
54
+ if (utils.isStr(qid)) {
55
+ return {qid: qid};
56
+ }
57
+ return (value && typeof value['qid'] === 'string') ? { 'qid': value['qid'] } : undefined;
58
+ },
59
+ /**
60
+ * performs action to obtain id and return a value in the callback's response argument
61
+ * @function
62
+ * @param {SubmoduleConfig} [config]
63
+ * @returns {IdResponse|undefined}
64
+ */
65
+ getId(config) {
66
+ if (!utils.isPlainObject(config.params)) {
67
+ config.params = {};
68
+ }
69
+ const url = paramOrDefault(config.params.url,
70
+ `https://bidder.adquery.io/prebid/qid`,
71
+ config.params.urlArg);
72
+
73
+ const resp = function (callback) {
74
+ let qid = storage.getDataFromLocalStorage('qid');
75
+ if (utils.isStr(qid)) {
76
+ const responseObj = {qid: qid};
77
+ callback(responseObj);
78
+ } else {
79
+ const callbacks = {
80
+ success: response => {
81
+ let responseObj;
82
+ if (response) {
83
+ try {
84
+ responseObj = JSON.parse(response);
85
+ } catch (error) {
86
+ utils.logError(error);
87
+ }
88
+ }
89
+ callback(responseObj);
90
+ },
91
+ error: error => {
92
+ utils.logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
93
+ callback();
94
+ }
95
+ };
96
+ ajax(url, callbacks, undefined, {method: 'GET'});
97
+ }
98
+ };
99
+ return {callback: resp};
100
+ }
101
+ };
102
+
103
+ submodule('userId', adqueryIdSubmodule);
@@ -0,0 +1,35 @@
1
+ # Adquery QID
2
+
3
+ Adquery QID Module. For assistance setting up your module please contact us at [prebid@adquery.io](prebid@adquery.io).
4
+
5
+ ### Prebid Params
6
+
7
+ Individual params may be set for the Adquery ID Submodule. At least one identifier must be set in the params.
8
+
9
+ ```
10
+ pbjs.setConfig({
11
+ usersync: {
12
+ userIds: [{
13
+ name: 'qid',
14
+ storage: {
15
+ name: 'qid',
16
+ type: 'html5'
17
+ }
18
+ }]
19
+ }
20
+ });
21
+ ```
22
+ ## Parameter Descriptions for the `usersync` Configuration Section
23
+ The below parameters apply only to the Adquery User ID Module integration.
24
+
25
+ | Param under usersync.userIds[] | Scope | Type | Description | Example |
26
+ | --- | --- | --- | --- | --- |
27
+ | name | Required | String | ID value for the Adquery ID module - `"qid"` | `"qid"` |
28
+ | storage | Required | Object | The publisher must specify the local storage in which to store the results of the call to get the user ID. | |
29
+ | storage.type | Required | String | This is where the results of the user ID will be stored. The recommended method is `localStorage` by specifying `html5`. | `"html5"` |
30
+ | storage.name | Required | String | The name of the html5 local storage where the user ID will be stored. | `"qid"` |
31
+ | storage.expires | Optional | Integer | How long (in days) the user ID information will be stored. | `365` |
32
+ | value | Optional | Object | Used only if the page has a separate mechanism for storing the Adquery ID. The value is an object containing the values to be sent to the adapters. In this scenario, no URL is called and nothing is added to local storage | `{"qid": "2abf9f001fcd81241b67"}` |
33
+ | params | Optional | Object | Used to store params for the id system |
34
+ | params.url | Optional | String | Set an alternate GET url for qid with this parameter |
35
+ | params.urlArg | Optional | Object | Optional url parameter for params.url |
@@ -180,11 +180,13 @@ function getCanonicalUrl() {
180
180
 
181
181
  /* Get mediatype from bidRequest */
182
182
  function getMediatype(bidRequest) {
183
+ if (deepAccess(bidRequest, 'mediaTypes.banner')) {
184
+ return BANNER;
185
+ }
183
186
  if (deepAccess(bidRequest, 'mediaTypes.video')) {
184
187
  return VIDEO;
185
- } else if (deepAccess(bidRequest, 'mediaTypes.banner')) {
186
- return BANNER;
187
- } else if (deepAccess(bidRequest, 'mediaTypes.native')) {
188
+ }
189
+ if (deepAccess(bidRequest, 'mediaTypes.native')) {
188
190
  return NATIVE;
189
191
  }
190
192
  }
@@ -345,7 +347,7 @@ function getTrackers(eventsArray, jsTrackers) {
345
347
 
346
348
  function getVideoAd(response) {
347
349
  var adJson = {};
348
- if (typeof response.Ad === 'string') {
350
+ if (typeof response.Ad === 'string' && response.Ad.indexOf('\/\*PREBID\*\/') > 0) {
349
351
  adJson = JSON.parse(response.Ad.match(/\/\*PREBID\*\/(.*)\/\*PREBID\*\//)[1]);
350
352
  return deepAccess(adJson, 'Content.MainVideo.Vast');
351
353
  }
@@ -478,13 +480,15 @@ function createBid(response, bidRequests) {
478
480
  meta: response.Meta || { advertiserDomains: [] }
479
481
  };
480
482
 
481
- if (request && request.Native) {
483
+ // retreive video response if present
484
+ const vast64 = response.Vast || getVideoAd(response);
485
+ if (vast64) {
486
+ bid.vastXml = window.atob(vast64);
487
+ bid.mediaType = 'video';
488
+ } else if (request.Native) {
489
+ // format Native response if Native was requested
482
490
  bid.native = getNativeAssets(response, request.Native);
483
491
  bid.mediaType = 'native';
484
- } else if (request && request.Video) {
485
- const vast64 = response.Vast || getVideoAd(response);
486
- bid.vastXml = vast64 ? window.atob(vast64) : '';
487
- bid.mediaType = 'video';
488
492
  } else {
489
493
  bid.width = response.Width;
490
494
  bid.height = response.Height;
@@ -201,6 +201,17 @@ export const spec = {
201
201
  payload.app = appIdObj;
202
202
  }
203
203
 
204
+ let auctionKeywords = config.getConfig('appnexusAuctionKeywords');
205
+ if (isPlainObject(auctionKeywords)) {
206
+ let aucKeywords = transformBidderParamKeywords(auctionKeywords);
207
+
208
+ if (aucKeywords.length > 0) {
209
+ aucKeywords.forEach(deleteValues);
210
+ }
211
+
212
+ payload.keywords = aucKeywords;
213
+ }
214
+
204
215
  if (config.getConfig('adpod.brandCategoryExclusion')) {
205
216
  payload.brand_category_uniqueness = true;
206
217
  }
@@ -1,7 +1,6 @@
1
1
  // eslint-disable-next-line prebid/validate-imports
2
2
  // eslint-disable-next-line prebid/validate-imports
3
- import {registerBidder} from 'src/adapters/bidderFactory.js'
4
-
3
+ import {registerBidder} from '../src/adapters/bidderFactory.js'
5
4
  export const BIDDER_CODE = 'bliink'
6
5
  export const BLIINK_ENDPOINT_ENGINE = 'https://engine.bliink.io/delivery'
7
6
  export const BLIINK_ENDPOINT_ENGINE_VAST = 'https://engine.bliink.io/vast'
@@ -174,6 +173,8 @@ export const buildRequests = (_, bidderRequest) => {
174
173
  pageUrl: bidderRequest.refererInfo.referer,
175
174
  pageDescription: getMetaValue(META_DESCRIPTION),
176
175
  keywords: getKeywords().join(','),
176
+ gdpr: false,
177
+ gdpr_consent: '',
177
178
  pageTitle: document.title,
178
179
  }
179
180