prebid.js 6.8.0 → 6.9.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 (37) hide show
  1. package/.eslintrc.js +8 -1
  2. package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
  3. package/integrationExamples/gpt/x-domain/creative.html +13 -6
  4. package/modules/appnexusBidAdapter.js +3 -2
  5. package/modules/asealBidAdapter.js +58 -0
  6. package/modules/asealBidAdapter.md +52 -0
  7. package/modules/conversantBidAdapter.js +7 -0
  8. package/modules/improvedigitalBidAdapter.js +5 -0
  9. package/modules/lunamediahbBidAdapter.js +32 -4
  10. package/modules/oguryBidAdapter.js +6 -13
  11. package/modules/priceFloors.js +2 -1
  12. package/modules/richaudienceBidAdapter.js +7 -2
  13. package/modules/riseBidAdapter.js +17 -6
  14. package/modules/rubiconAnalyticsAdapter.js +5 -0
  15. package/modules/sortableAnalyticsAdapter.js +5 -4
  16. package/modules/weboramaRtdProvider.js +264 -34
  17. package/modules/weboramaRtdProvider.md +110 -40
  18. package/package.json +2 -1
  19. package/src/adloader.js +2 -1
  20. package/src/auction.js +59 -64
  21. package/src/bidderSettings.js +69 -0
  22. package/src/secureCreatives.js +26 -12
  23. package/src/targeting.js +3 -2
  24. package/src/utils.js +0 -7
  25. package/test/spec/auctionmanager_spec.js +33 -1
  26. package/test/spec/modules/asealBidAdapter_spec.js +144 -0
  27. package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
  28. package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
  29. package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
  30. package/test/spec/modules/oguryBidAdapter_spec.js +62 -4
  31. package/test/spec/modules/riseBidAdapter_spec.js +30 -4
  32. package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +31 -1
  33. package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
  34. package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
  35. package/test/spec/unit/core/bidderSettings_spec.js +123 -0
  36. package/test/spec/unit/pbjs_api_spec.js +1 -6
  37. package/test/spec/unit/secureCreatives_spec.js +66 -32
package/.eslintrc.js CHANGED
@@ -23,10 +23,13 @@ module.exports = {
23
23
  'BROWSERSTACK_USERNAME': false,
24
24
  'BROWSERSTACK_KEY': false
25
25
  },
26
+ // use babel as parser for fancy syntax
27
+ parser: '@babel/eslint-parser',
26
28
  parserOptions: {
27
29
  sourceType: 'module',
28
30
  ecmaVersion: 2018,
29
31
  },
32
+
30
33
  rules: {
31
34
  'comma-dangle': 'off',
32
35
  semi: 'off',
@@ -49,5 +52,9 @@ module.exports = {
49
52
  rules: {
50
53
  'prebid/validate-imports': ['error', allowedModules[key]]
51
54
  }
52
- }))
55
+ })).concat([{
56
+ // code in other packages (such as plugins/eslint) is not "seen" by babel and its parser will complain.
57
+ files: 'plugins/*/**/*.js',
58
+ parser: 'esprima'
59
+ }])
53
60
  };
@@ -1,135 +1,174 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3
  <html xmlns="http://www.w3.org/1999/xhtml">
4
+
3
5
  <head>
4
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
7
  </head>
8
+
6
9
  <body>
7
10
 
8
- <script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
9
- <script src="../../build/dev/prebid.js" async></script>
11
+ <script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
12
+ <script src="../../build/dev/prebid.js" async></script>
10
13
 
11
- <script>
12
- var pbjs = pbjs || {};
13
- pbjs.que = pbjs.que || [];
14
+ <script>
15
+ var pbjs = pbjs || {};
16
+ pbjs.que = pbjs.que || [];
14
17
 
15
- pbjs.que.push(function() {
16
- pbjs.setConfig({
17
- debug: true,
18
- realTimeData: {
19
- auctionDelay: 1000,
20
- dataProviders: [{
18
+ pbjs.que.push(function () {
19
+ pbjs.setConfig({
20
+ debug: true,
21
+ realTimeData: {
22
+ auctionDelay: 1000,
23
+ dataProviders: [{
21
24
  name: "weborama",
22
25
  waitForIt: true,
23
26
  params: {
24
- weboCtxConf: {
25
- token: "to-be-defined", // mandatory
26
- targetURL: "https://prebid.org", // default is document.URL
27
- setPrebidTargeting: true, // default
28
- sendToBidders: true, // default
29
- defaultProfile: { // optional
30
- webo_ctx: ['moon'],
31
- webo_ds: ['bar']
32
- }
33
- },
34
- weboUserDataConf: {
35
- setPrebidTargeting: true, // default
36
- sendToBidders: true, // default
37
- defaultProfile: { // optional
38
- webo_cs: ['Red'],
39
- webo_audiences: ['bam']
40
- },
41
- localStorageProfileKey: 'webo_wam2gam_entry' // default
42
- }
43
- }
27
+ setPrebidTargeting: true, // optional
28
+ sendToBidders: true, // optional
29
+ onData: function (data, site) { // optional
30
+ var kind = (site) ? 'site' : 'user';
31
+ console.log('onData', kind, data);
32
+ },
33
+ weboCtxConf: {
34
+ token: "to-be-defined", // mandatory
35
+ targetURL: "https://prebid.org", // default is document.URL
36
+ setPrebidTargeting: true, // override param.setPrebidTargeting or default true
37
+ sendToBidders: true, // override param.sendToBidders or default true
38
+ defaultProfile: { // optional
39
+ webo_ctx: ['moon'],
40
+ webo_ds: ['bar']
41
+ },
42
+ //, onData: function (data, ...) { ...}
43
+ },
44
+ weboUserDataConf: {
45
+ accountId: 12345, // optional
46
+ setPrebidTargeting: true, // override param.setPrebidTargeting or default true
47
+ sendToBidders: true, // override param.sendToBidders or default true
48
+ defaultProfile: { // optional
49
+ webo_cs: ['Red'],
50
+ webo_audiences: ['bam']
51
+ },
52
+ localStorageProfileKey: 'webo_wam2gam_entry', // default
53
+ //, onData: function (data,...) { ...}
54
+ }
55
+ }
56
+ }]
57
+ }
58
+ });
59
+ });
60
+ </script>
61
+ <script>
62
+ var div_1_sizes = [
63
+ [300, 300]
64
+ ];
65
+
66
+ var PREBID_TIMEOUT = 3000;
67
+ var FAILSAFE_TIMEOUT = 5000;
68
+
69
+ var adUnits = [
70
+ {
71
+ code: '/1056029/webo-ctx-prebid',
72
+ mediaTypes: {
73
+ banner: {
74
+ sizes: div_1_sizes
75
+ }
76
+ },
77
+ bids: [{
78
+ bidder: 'smartadserver',
79
+ params: {
80
+ siteId: 1234,
81
+ pageId: 1234,
82
+ formatId: 1234,
83
+ }
84
+ }, {
85
+ bidder: 'pubmatic',
86
+ params: {
87
+ publisherId: '32572',
88
+ }
89
+ }, {
90
+ bidder: 'appnexus',
91
+ params: {
92
+ placementId: 234234,
93
+ }
94
+ }, {
95
+ bidder: 'rubicon',
96
+ params: {
97
+ accountId: '14062',
98
+ siteId: '70608',
99
+ zoneId: '335918',
100
+ userId: '12346',
101
+ }
102
+ }, {
103
+ bidder: 'criteo',
104
+ params: {
105
+ zoneId: 234234,
106
+ networkId: 456456,
107
+ },
44
108
  }]
45
109
  }
46
- });
47
- });
48
- </script>
49
- <script>
50
- var div_1_sizes = [
51
- [300, 300]
52
- ];
53
-
54
- var PREBID_TIMEOUT = 3000;
55
- var FAILSAFE_TIMEOUT = 5000;
56
-
57
- var adUnits = [
58
- {
59
- code: '/1056029/webo-ctx-prebid',
60
- mediaTypes: {
61
- banner: {
62
- sizes: div_1_sizes
63
- }
64
- },
65
- bids: [{
66
- bidder: 'smartadserver',
67
- params: {
68
- placementId: 1
69
- }
70
- }]
71
- }
72
110
  ];
73
111
 
74
- // ======== DO NOT EDIT BELOW THIS LINE =========== //
75
- var googletag = googletag || {};
76
- googletag.cmd = googletag.cmd || [];
77
- googletag.cmd.push(function() {
78
- googletag.pubads().disableInitialLoad();
79
- });
80
-
81
- var pbjs = pbjs || {};
82
- pbjs.que = pbjs.que || [];
83
-
84
- pbjs.que.push(function() {
85
- pbjs.addAdUnits(adUnits);
86
- pbjs.requestBids({
87
- bidsBackHandler: initAdserver,
88
- timeout: PREBID_TIMEOUT
112
+ // ======== DO NOT EDIT BELOW THIS LINE =========== //
113
+ var googletag = googletag || {};
114
+ googletag.cmd = googletag.cmd || [];
115
+ googletag.cmd.push(function () {
116
+ googletag.pubads().disableInitialLoad();
89
117
  });
90
- });
91
-
92
- function initAdserver() {
93
- if (pbjs.initAdserverSet) return;
94
- pbjs.initAdserverSet = true;
95
- googletag.cmd.push(function() {
96
- pbjs.que.push(function() {
97
- pbjs.setTargetingForGPTAsync();
98
- googletag.pubads().refresh();
118
+
119
+ var pbjs = pbjs || {};
120
+ pbjs.que = pbjs.que || [];
121
+
122
+ pbjs.que.push(function () {
123
+ pbjs.addAdUnits(adUnits);
124
+ pbjs.requestBids({
125
+ bidsBackHandler: initAdserver,
126
+ timeout: PREBID_TIMEOUT
99
127
  });
100
128
  });
101
- }
102
-
103
-
104
- // in case PBJS doesn't load
105
- setTimeout(function() {
106
- initAdserver();
107
- }, FAILSAFE_TIMEOUT);
108
-
109
- googletag.cmd.push(function() {
110
- googletag.defineSlot('/1056029/webo-ctx-prebid', div_1_sizes, 'div-gpt-ad-1620653642627-0').addService(googletag.pubads());
111
- googletag.pubads().disableInitialLoad();
112
- googletag.enableServices();
113
- });
114
-
115
- </script>
116
-
117
- <article>
118
- <p>
119
- test webo ctx using prebid.js
120
- </p>
121
- </article>
122
- <h2>Basic Prebid.js Example</h2>
123
- <h5>Div-1</h5>
124
- <div id='div-gpt-ad-1620653642627-0' style='width: 300px; height: 300px;'>
125
- <script type='text/javascript'>
126
- googletag.cmd.push(function() {
127
- googletag.display('div-gpt-ad-1620653642627-0');
129
+
130
+ function initAdserver() {
131
+ if (pbjs.initAdserverSet) return;
132
+ pbjs.initAdserverSet = true;
133
+ googletag.cmd.push(function () {
134
+ pbjs.que.push(function () {
135
+ pbjs.setTargetingForGPTAsync();
136
+ googletag.pubads().refresh();
128
137
  });
129
- </script>
130
- </div>
131
- <button onclick="googletag.cmd.push(function() { googletag.pubads().refresh(); });">
132
- Show/Refresh Ad
133
- </button>
138
+ });
139
+ }
140
+
141
+
142
+ // in case PBJS doesn't load
143
+ setTimeout(function () {
144
+ initAdserver();
145
+ }, FAILSAFE_TIMEOUT);
146
+
147
+ googletag.cmd.push(function () {
148
+ googletag.defineSlot('/1056029/webo-ctx-prebid', div_1_sizes, 'div-gpt-ad-1620653642627-0').addService(googletag.pubads());
149
+ googletag.pubads().disableInitialLoad();
150
+ googletag.enableServices();
151
+ });
152
+
153
+ </script>
154
+
155
+ <article>
156
+ <p>
157
+ test webo ctx using prebid.js
158
+ </p>
159
+ </article>
160
+ <h2>Basic Prebid.js Example</h2>
161
+ <h5>Div-1</h5>
162
+ <div id='div-gpt-ad-1620653642627-0' style='width: 300px; height: 300px;'>
163
+ <script type='text/javascript'>
164
+ googletag.cmd.push(function () {
165
+ googletag.display('div-gpt-ad-1620653642627-0');
166
+ });
167
+ </script>
168
+ </div>
169
+ <button onclick="googletag.cmd.push(function() { googletag.pubads().refresh(); });">
170
+ Show/Refresh Ad
171
+ </button>
134
172
  </body>
135
- </html>
173
+
174
+ </html>
@@ -8,6 +8,13 @@ urlParser.href = '%%PATTERN:url%%';
8
8
  const publisherDomain = urlParser.protocol + '//' + urlParser.hostname;
9
9
  const adId = '%%PATTERN:hb_adid%%';
10
10
 
11
+ function receiveMessage(ev) {
12
+ const origin = ev.origin || ev.originalEvent.origin;
13
+ if (origin === publisherDomain) {
14
+ renderAd(ev);
15
+ }
16
+ }
17
+
11
18
  function renderAd(ev) {
12
19
  const key = ev.message ? 'message' : 'data';
13
20
  let adObject = {};
@@ -17,9 +24,7 @@ function renderAd(ev) {
17
24
  return;
18
25
  }
19
26
 
20
- const origin = ev.origin || ev.originalEvent.origin;
21
27
  if (adObject.message && adObject.message === 'Prebid Response' &&
22
- publisherDomain === origin &&
23
28
  adObject.adId === adId) {
24
29
  try {
25
30
  const body = window.document.body;
@@ -75,22 +80,24 @@ function renderAd(ev) {
75
80
  if (!success) {
76
81
  payload.info = {reason, message};
77
82
  }
78
- ev.source.postMessage(JSON.stringify(payload), publisherDomain);
83
+ window.parent.postMessage(JSON.stringify(payload), publisherDomain);
79
84
  }
80
85
 
81
86
  }
82
87
 
83
88
 
84
89
  function requestAdFromPrebid() {
85
- var message = JSON.stringify({
90
+ const message = JSON.stringify({
86
91
  message: 'Prebid Request',
87
92
  adId
88
93
  });
89
- window.parent.postMessage(message, publisherDomain);
94
+ const channel = new MessageChannel();
95
+ channel.port1.onmessage = renderAd;
96
+ window.parent.postMessage(message, publisherDomain, [channel.port2]);
90
97
  }
91
98
 
92
99
  function listenAdFromPrebid() {
93
- window.addEventListener('message', renderAd, false);
100
+ window.addEventListener('message', receiveMessage, false);
94
101
  }
95
102
 
96
103
  listenAdFromPrebid();
@@ -1,4 +1,4 @@
1
- import { convertCamelToUnderscore, isArray, isNumber, isPlainObject, logError, logInfo, deepAccess, logMessage, convertTypes, isStr, getParameterByName, deepClone, chunk, logWarn, getBidRequest, createTrackPixelHtml, isEmpty, transformBidderParamKeywords, getMaxValueFromArray, fill, getMinValueFromArray, isArrayOfNums, isFn, isAllowZeroCpmBidsEnabled } from '../src/utils.js';
1
+ import { convertCamelToUnderscore, isArray, isNumber, isPlainObject, logError, logInfo, deepAccess, logMessage, convertTypes, isStr, getParameterByName, deepClone, chunk, logWarn, getBidRequest, createTrackPixelHtml, isEmpty, transformBidderParamKeywords, getMaxValueFromArray, fill, getMinValueFromArray, isArrayOfNums, isFn } from '../src/utils.js';
2
2
  import { Renderer } from '../src/Renderer.js';
3
3
  import { config } from '../src/config.js';
4
4
  import { registerBidder, getIabSubCategory } from '../src/adapters/bidderFactory.js';
@@ -8,6 +8,7 @@ import find from 'core-js-pure/features/array/find.js';
8
8
  import includes from 'core-js-pure/features/array/includes.js';
9
9
  import { OUTSTREAM, INSTREAM } from '../src/video.js';
10
10
  import { getStorageManager } from '../src/storageManager.js';
11
+ import { bidderSettings } from '../src/bidderSettings.js';
11
12
 
12
13
  const BIDDER_CODE = 'appnexus';
13
14
  const URL = 'https://ib.adnxs.com/ut/v3/prebid';
@@ -303,7 +304,7 @@ export const spec = {
303
304
  serverResponse.tags.forEach(serverBid => {
304
305
  const rtbBid = getRtbBid(serverBid);
305
306
  if (rtbBid) {
306
- const cpmCheck = (isAllowZeroCpmBidsEnabled(bidderRequest.bidderCode)) ? rtbBid.cpm >= 0 : rtbBid.cpm > 0;
307
+ const cpmCheck = (bidderSettings.get(bidderRequest.bidderCode, 'allowZeroCpmBids') === true) ? rtbBid.cpm >= 0 : rtbBid.cpm > 0;
307
308
  if (cpmCheck && includes(this.supportedMediaTypes, rtbBid.ad_type)) {
308
309
  const bid = newBid(serverBid, rtbBid, bidderRequest);
309
310
  bid.mediaType = parseMediaType(rtbBid);
@@ -0,0 +1,58 @@
1
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
2
+ import { BANNER } from '../src/mediaTypes.js';
3
+ import { config } from '../src/config.js';
4
+
5
+ export const BIDDER_CODE = 'aseal';
6
+ const SUPPORTED_AD_TYPES = [BANNER];
7
+ export const API_ENDPOINT = 'https://tkprebid.aotter.net/prebid/adapter';
8
+ export const HEADER_AOTTER_VERSION = 'prebid_0.0.1';
9
+
10
+ export const spec = {
11
+ code: BIDDER_CODE,
12
+ aliases: ['aotter', 'trek'],
13
+ supportedMediaTypes: SUPPORTED_AD_TYPES,
14
+
15
+ isBidRequestValid: (bid) => !!bid.params.placeUid && typeof bid.params.placeUid === 'string',
16
+
17
+ buildRequests: (validBidRequests, bidderRequest) => {
18
+ if (validBidRequests.length === 0) {
19
+ return [];
20
+ }
21
+
22
+ const clientId =
23
+ config.getConfig('aseal.clientId') || '';
24
+
25
+ const data = {
26
+ bids: validBidRequests,
27
+ refererInfo: bidderRequest.refererInfo,
28
+ };
29
+
30
+ const options = {
31
+ contentType: 'application/json',
32
+ withCredentials: true,
33
+ customHeaders: {
34
+ 'x-aotter-clientid': clientId,
35
+ 'x-aotter-version': HEADER_AOTTER_VERSION,
36
+ },
37
+ };
38
+
39
+ return [{
40
+ method: 'POST',
41
+ url: API_ENDPOINT,
42
+ data,
43
+ options,
44
+ }];
45
+ },
46
+
47
+ interpretResponse: (serverResponse, bidRequest) => {
48
+ if (!Array.isArray(serverResponse.body)) {
49
+ return [];
50
+ }
51
+
52
+ const bidResponses = serverResponse.body;
53
+
54
+ return bidResponses;
55
+ },
56
+ };
57
+
58
+ registerBidder(spec);
@@ -0,0 +1,52 @@
1
+ # Overview
2
+
3
+ ```
4
+ Module Name: Aseal Bid Adapter
5
+ Module Type: Bidder Adapter
6
+ Maintainer: tech-service@aotter.net
7
+ ```
8
+
9
+ # Description
10
+
11
+ Module that connects to Aseal server for bids.
12
+ Supported Ad Formats:
13
+
14
+ - Banner
15
+
16
+ # Configuration
17
+
18
+ Following configuration is required:
19
+
20
+ ```js
21
+ pbjs.setConfig({
22
+ aseal: {
23
+ clientId: "YOUR_CLIENT_ID"
24
+ }
25
+ });
26
+ ```
27
+
28
+ # Ad Unit Example
29
+
30
+ ```js
31
+ var adUnits = [
32
+ {
33
+ code: "banner-div",
34
+ mediaTypes: {
35
+ banner: {
36
+ sizes: [
37
+ [300, 250],
38
+ [300, 600]
39
+ ]
40
+ }
41
+ },
42
+ bids: [
43
+ {
44
+ bidder: "aseal",
45
+ params: {
46
+ placeUid: "f4a74f73-9a74-4a87-91c9-545c6316c23d"
47
+ }
48
+ }
49
+ ]
50
+ }
51
+ ];
52
+ ```
@@ -2,6 +2,7 @@ import { logWarn, isStr, deepAccess, isArray, getBidIdParameter, deepSetValue, i
2
2
  import {registerBidder} from '../src/adapters/bidderFactory.js';
3
3
  import {BANNER, VIDEO} from '../src/mediaTypes.js';
4
4
  import {getStorageManager} from '../src/storageManager.js';
5
+ import { config } from '../src/config.js';
5
6
 
6
7
  const GVLID = 24;
7
8
  export const storage = getStorageManager(GVLID);
@@ -76,6 +77,9 @@ export const spec = {
76
77
  displaymanager: 'Prebid.js',
77
78
  displaymanagerver: '$prebid.version$'
78
79
  };
80
+ if (bid.ortb2Imp) {
81
+ mergeDeep(imp, bid.ortb2Imp);
82
+ }
79
83
 
80
84
  copyOptProperty(bid.params.tag_id, imp, 'tagid');
81
85
 
@@ -167,6 +171,9 @@ export const spec = {
167
171
  payload.user = {ext: userExt};
168
172
  }
169
173
 
174
+ const firstPartyData = config.getConfig('ortb2') || {};
175
+ mergeDeep(payload, firstPartyData);
176
+
170
177
  return {
171
178
  method: 'POST',
172
179
  url: bidurl,
@@ -90,6 +90,7 @@ export const spec = {
90
90
  // End of adding first party data
91
91
 
92
92
  requestParameters.schain = bidRequests[0].schain;
93
+ requestParameters.coppa = config.getConfig('coppa') === true;
93
94
 
94
95
  if (bidRequests[0].userId) {
95
96
  const eids = createEidsArray(bidRequests[0].userId);
@@ -652,6 +653,10 @@ export function ImproveDigitalAdServerJSClient(endPoint) {
652
653
  }
653
654
  }
654
655
 
656
+ if (requestParameters.coppa) {
657
+ impressionBidRequestObject.coppa = 1;
658
+ }
659
+
655
660
  return impressionBidRequestObject;
656
661
  };
657
662
 
@@ -1,9 +1,11 @@
1
1
  import { logMessage } from '../src/utils.js';
2
2
  import { registerBidder } from '../src/adapters/bidderFactory.js';
3
3
  import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
4
+ import { config } from '../src/config.js';
4
5
 
5
6
  const BIDDER_CODE = 'lunamediahb';
6
7
  const AD_URL = 'https://balancer.lmgssp.com/?c=o&m=multi';
8
+ const SYNC_URL = 'https://cookie.lmgssp.com';
7
9
 
8
10
  function isBidResponseValid(bid) {
9
11
  if (!bid.requestId || !bid.cpm || !bid.creativeId ||
@@ -14,7 +16,7 @@ function isBidResponseValid(bid) {
14
16
  case BANNER:
15
17
  return Boolean(bid.width && bid.height && bid.ad);
16
18
  case VIDEO:
17
- return Boolean(bid.vastUrl);
19
+ return Boolean(bid.vastUrl) || Boolean(bid.vastXml);
18
20
  case NATIVE:
19
21
  return Boolean(bid.native && bid.native.impressionTrackers);
20
22
  default:
@@ -74,10 +76,13 @@ export const spec = {
74
76
  if (mediaType && mediaType[BANNER] && mediaType[BANNER].sizes) {
75
77
  placement.sizes = mediaType[BANNER].sizes;
76
78
  placement.traffic = BANNER;
77
- } else if (mediaType && mediaType[VIDEO] && mediaType[VIDEO].playerSize) {
78
- placement.wPlayer = mediaType[VIDEO].playerSize[0];
79
- placement.hPlayer = mediaType[VIDEO].playerSize[1];
79
+ } else if (mediaType && mediaType[VIDEO]) {
80
+ if (mediaType[VIDEO].playerSize) {
81
+ placement.wPlayer = mediaType[VIDEO].playerSize[0];
82
+ placement.hPlayer = mediaType[VIDEO].playerSize[1];
83
+ }
80
84
  placement.traffic = VIDEO;
85
+ placement.videoContext = mediaType[VIDEO].context || 'instream'
81
86
  } else if (mediaType && mediaType[NATIVE]) {
82
87
  placement.native = mediaType[NATIVE];
83
88
  placement.traffic = NATIVE;
@@ -102,6 +107,29 @@ export const spec = {
102
107
  }
103
108
  return response;
104
109
  },
110
+
111
+ getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
112
+ let syncType = syncOptions.iframeEnabled ? 'iframe' : 'image';
113
+ let syncUrl = SYNC_URL + `/${syncType}?pbjs=1`;
114
+ if (gdprConsent && gdprConsent.consentString) {
115
+ if (typeof gdprConsent.gdprApplies === 'boolean') {
116
+ syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
117
+ } else {
118
+ syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
119
+ }
120
+ }
121
+ if (uspConsent && uspConsent.consentString) {
122
+ syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
123
+ }
124
+
125
+ const coppa = config.getConfig('coppa') ? 1 : 0;
126
+ syncUrl += `&coppa=${coppa}`;
127
+
128
+ return [{
129
+ type: syncType,
130
+ url: syncUrl
131
+ }];
132
+ }
105
133
  };
106
134
 
107
135
  registerBidder(spec);
@@ -10,7 +10,7 @@ const DEFAULT_TIMEOUT = 1000;
10
10
  const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
11
11
  const TIMEOUT_MONITORING_HOST = 'https://ms-ads-monitoring-events.presage.io';
12
12
  const MS_COOKIE_SYNC_DOMAIN = 'https://ms-cookie-sync.presage.io';
13
- const ADAPTER_VERSION = '1.2.7';
13
+ const ADAPTER_VERSION = '1.2.9';
14
14
 
15
15
  function isBidRequestValid(bid) {
16
16
  const adUnitSizes = getAdUnitSizes(bid);
@@ -44,7 +44,7 @@ function buildRequests(validBidRequests, bidderRequest) {
44
44
  at: 2,
45
45
  regs: {
46
46
  ext: {
47
- gdpr: 1
47
+ gdpr: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? 1 : 0
48
48
  },
49
49
  },
50
50
  site: {
@@ -63,14 +63,7 @@ function buildRequests(validBidRequests, bidderRequest) {
63
63
  }
64
64
  };
65
65
 
66
- if (bidderRequest.hasOwnProperty('gdprConsent') &&
67
- bidderRequest.gdprConsent.hasOwnProperty('gdprApplies')) {
68
- openRtbBidRequestBanner.regs.ext.gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0
69
- }
70
-
71
- if (bidderRequest.hasOwnProperty('gdprConsent') &&
72
- bidderRequest.gdprConsent.hasOwnProperty('consentString') &&
73
- bidderRequest.gdprConsent.consentString.length > 0) {
66
+ if (bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) {
74
67
  openRtbBidRequestBanner.user.ext.consent = bidderRequest.gdprConsent.consentString
75
68
  }
76
69
 
@@ -78,7 +71,7 @@ function buildRequests(validBidRequests, bidderRequest) {
78
71
  const sizes = getAdUnitSizes(bidRequest)
79
72
  .map(size => ({ w: size[0], h: size[1] }));
80
73
 
81
- if (bidRequest.hasOwnProperty('mediaTypes') &&
74
+ if (bidRequest.mediaTypes &&
82
75
  bidRequest.mediaTypes.hasOwnProperty('banner')) {
83
76
  openRtbBidRequestBanner.site.id = bidRequest.params.assetKey;
84
77
 
@@ -166,11 +159,11 @@ function onBidWon(bid) {
166
159
  w.OG_PREBID_BID_OBJECT = {
167
160
  ...(bid && { ...bid }),
168
161
  }
169
- if (bid && bid.hasOwnProperty('nurl') && bid.nurl.length > 0) ajax(bid['nurl'], null);
162
+ if (bid && bid.nurl) ajax(bid.nurl, null);
170
163
  }
171
164
 
172
165
  function onTimeout(timeoutData) {
173
- ajax(`${TIMEOUT_MONITORING_HOST}/bid_timeout`, null, JSON.stringify(timeoutData[0]), {
166
+ ajax(`${TIMEOUT_MONITORING_HOST}/bid_timeout`, null, JSON.stringify({...timeoutData[0], location: window.location.href}), {
174
167
  method: 'POST',
175
168
  contentType: 'application/json'
176
169
  });