prebid.js 7.5.0 → 7.6.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.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adnuntiusBidAdapter.js +1 -1
- package/dist/adotBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adrinoBidAdapter.js +1 -1
- package/dist/adtelligentBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/atsAnalyticsAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/byDataAnalyticsAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imRtdProvider.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/newspassidBidAdapter.js +1 -0
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +115 -113
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/priceFloors.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/rasBidAdapter.js +1 -0
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/modules/adgenerationBidAdapter.js +24 -1
- package/modules/adnuntiusBidAdapter.js +26 -8
- package/modules/adotBidAdapter.js +10 -1
- package/modules/adrinoBidAdapter.js +10 -2
- package/modules/adrinoBidAdapter.md +6 -0
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/atsAnalyticsAdapter.js +4 -5
- package/modules/byDataAnalyticsAdapter.js +172 -74
- package/modules/byDataAnalyticsAdapter.md +5 -6
- package/modules/consumableBidAdapter.js +12 -1
- package/modules/eplanningBidAdapter.js +82 -97
- package/modules/gridNMBidAdapter.js +45 -4
- package/modules/imRtdProvider.js +0 -8
- package/modules/ixBidAdapter.js +5 -1
- package/modules/minutemediaBidAdapter.js +1 -0
- package/modules/newspassidBidAdapter.js +649 -0
- package/modules/nextMillenniumBidAdapter.js +17 -1
- package/modules/oguryBidAdapter.js +2 -0
- package/modules/priceFloors.js +1 -1
- package/modules/pubxaiAnalyticsAdapter.js +6 -1
- package/modules/rasBidAdapter.js +149 -0
- package/modules/rasBidAdapter.md +50 -0
- package/modules/seedtagBidAdapter.js +4 -0
- package/package.json +1 -1
- package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -4
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +126 -14
- package/test/spec/modules/adotBidAdapter_spec.js +12 -9
- package/test/spec/modules/adrinoBidAdapter_spec.js +22 -0
- package/test/spec/modules/byDataAnalyticsAdapter_spec.js +74 -24
- package/test/spec/modules/consumableBidAdapter_spec.js +75 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +58 -18
- package/test/spec/modules/gridNMBidAdapter_spec.js +32 -0
- package/test/spec/modules/imRtdProvider_spec.js +0 -1
- package/test/spec/modules/ixBidAdapter_spec.js +41 -0
- package/test/spec/modules/minutemediaBidAdapter_spec.js +3 -0
- package/test/spec/modules/newspassidBidAdapter_spec.js +1793 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +20 -0
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +5 -0
- package/test/spec/modules/rasBidAdapter_spec.js +190 -0
- package/test/spec/modules/seedtagBidAdapter_spec.js +25 -0
|
@@ -5,38 +5,80 @@ import enc from 'crypto-js/enc-utf8';
|
|
|
5
5
|
import adapter from '../src/AnalyticsAdapter.js';
|
|
6
6
|
import CONSTANTS from '../src/constants.json';
|
|
7
7
|
import adapterManager from '../src/adapterManager.js';
|
|
8
|
+
import { getStorageManager } from '../src/storageManager.js';
|
|
9
|
+
import { auctionManager } from '../src/auctionManager.js';
|
|
8
10
|
import { ajax } from '../src/ajax.js';
|
|
9
11
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const versionCode = '4.4.1'
|
|
13
|
+
const secretKey = 'bydata@123456'
|
|
14
|
+
const { EVENTS: { NO_BID, BID_TIMEOUT, AUCTION_END, AUCTION_INIT, BID_WON } } = CONSTANTS
|
|
15
|
+
const DEFAULT_EVENT_URL = 'https://pbjs-stream.bydata.com/topics/prebid'
|
|
16
|
+
const analyticsType = 'endpoint'
|
|
17
|
+
const isBydata = isKeyInUrl('bydata_debug')
|
|
18
|
+
const adunitsMap = {}
|
|
19
|
+
const storage = getStorageManager();
|
|
20
|
+
let initOptions = {}
|
|
21
|
+
var payload = {}
|
|
22
|
+
var winPayload = {}
|
|
23
|
+
var isDataSend = window.asc_data || false
|
|
24
|
+
var bdNbTo = { 'to': [], 'nb': [] }
|
|
17
25
|
|
|
26
|
+
/* method used for testing parameters */
|
|
27
|
+
function isKeyInUrl(name) {
|
|
28
|
+
const queryString = window.location.search;
|
|
29
|
+
const urlParams = new URLSearchParams(queryString);
|
|
30
|
+
const param = urlParams.get(name)
|
|
31
|
+
return param
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* return ad unit full path wrt custom ad unit code */
|
|
35
|
+
function getAdunitName(code) {
|
|
36
|
+
var name = code;
|
|
37
|
+
for (const [key, value] of Object.entries(adunitsMap)) {
|
|
38
|
+
if (key === code) { name = value; }
|
|
39
|
+
}
|
|
40
|
+
return name;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* EVENT: auction init */
|
|
44
|
+
function onAuctionStart(t) {
|
|
45
|
+
/* map of ad unit code - ad unit full path */
|
|
46
|
+
t.adUnits && t.adUnits.length && t.adUnits.forEach((adu) => {
|
|
47
|
+
const { code, adunit } = adu
|
|
48
|
+
adunitsMap[code] = adunit
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* EVENT: bid timeout */
|
|
18
53
|
function onBidTimeout(t) {
|
|
19
54
|
if (payload['visitor_data'] && t && t.length > 0) {
|
|
20
|
-
bdNbTo['to'] = t
|
|
55
|
+
bdNbTo['to'] = t
|
|
21
56
|
}
|
|
22
57
|
}
|
|
23
58
|
|
|
59
|
+
/* EVENT: no bid */
|
|
24
60
|
function onNoBidData(t) {
|
|
25
61
|
if (payload['visitor_data'] && t) {
|
|
26
|
-
bdNbTo['nb'].push(t)
|
|
62
|
+
bdNbTo['nb'].push(t)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* EVENT: bid won */
|
|
67
|
+
function onBidWon(t) {
|
|
68
|
+
const { isCorrectOption } = initOptions
|
|
69
|
+
if (isCorrectOption && (isDataSend || isBydata)) {
|
|
70
|
+
ascAdapter.getBidWonData(t)
|
|
71
|
+
ascAdapter.sendPayload(winPayload)
|
|
27
72
|
}
|
|
28
73
|
}
|
|
29
74
|
|
|
75
|
+
/* EVENT: auction end */
|
|
30
76
|
function onAuctionEnd(t) {
|
|
31
|
-
|
|
32
|
-
const {isCorrectOption, logFrequency} = initOptions;
|
|
33
|
-
var value = Math.floor(Math.random() * 10000 + 1);
|
|
34
|
-
_logInfo(' value - frequency ', (value + '-' + logFrequency));
|
|
77
|
+
const { isCorrectOption } = initOptions;
|
|
35
78
|
setTimeout(() => {
|
|
36
|
-
if (isCorrectOption &&
|
|
79
|
+
if (isCorrectOption && (isDataSend || isBydata)) {
|
|
37
80
|
ascAdapter.dataProcess(t);
|
|
38
|
-
|
|
39
|
-
ascAdapter.sendPayload();
|
|
81
|
+
ascAdapter.sendPayload(payload);
|
|
40
82
|
}
|
|
41
83
|
}, 500);
|
|
42
84
|
}
|
|
@@ -44,6 +86,9 @@ function onAuctionEnd(t) {
|
|
|
44
86
|
const ascAdapter = Object.assign(adapter({ url: DEFAULT_EVENT_URL, analyticsType: analyticsType }), {
|
|
45
87
|
track({ eventType, args }) {
|
|
46
88
|
switch (eventType) {
|
|
89
|
+
case AUCTION_INIT:
|
|
90
|
+
onAuctionStart(args);
|
|
91
|
+
break;
|
|
47
92
|
case NO_BID:
|
|
48
93
|
onNoBidData(args);
|
|
49
94
|
break;
|
|
@@ -53,6 +98,9 @@ const ascAdapter = Object.assign(adapter({ url: DEFAULT_EVENT_URL, analyticsType
|
|
|
53
98
|
case AUCTION_END:
|
|
54
99
|
onAuctionEnd(args);
|
|
55
100
|
break;
|
|
101
|
+
case BID_WON:
|
|
102
|
+
onBidWon(args);
|
|
103
|
+
break;
|
|
56
104
|
default:
|
|
57
105
|
break;
|
|
58
106
|
}
|
|
@@ -62,9 +110,8 @@ const ascAdapter = Object.assign(adapter({ url: DEFAULT_EVENT_URL, analyticsType
|
|
|
62
110
|
// save the base class function
|
|
63
111
|
ascAdapter.originEnableAnalytics = ascAdapter.enableAnalytics;
|
|
64
112
|
// override enableAnalytics so we can get access to the config passed in from the page
|
|
65
|
-
ascAdapter.enableAnalytics = function(config) {
|
|
113
|
+
ascAdapter.enableAnalytics = function (config) {
|
|
66
114
|
if (this.initConfig(config)) {
|
|
67
|
-
_logInfo('initiated:', initOptions);
|
|
68
115
|
initOptions.isCorrectOption && ascAdapter.getVisitorData();
|
|
69
116
|
ascAdapter.originEnableAnalytics(config);
|
|
70
117
|
}
|
|
@@ -73,7 +120,7 @@ ascAdapter.enableAnalytics = function(config) {
|
|
|
73
120
|
ascAdapter.initConfig = function (config) {
|
|
74
121
|
let isCorrectOption = true;
|
|
75
122
|
initOptions = {};
|
|
76
|
-
|
|
123
|
+
var rndNum = Math.floor(Math.random() * 10000 + 1);
|
|
77
124
|
initOptions.options = deepClone(config.options);
|
|
78
125
|
initOptions.clientId = initOptions.options.clientId || null;
|
|
79
126
|
initOptions.logFrequency = initOptions.options.logFrequency;
|
|
@@ -81,13 +128,41 @@ ascAdapter.initConfig = function (config) {
|
|
|
81
128
|
_logError('"options.clientId" should not empty!!');
|
|
82
129
|
isCorrectOption = false;
|
|
83
130
|
}
|
|
131
|
+
if (rndNum <= initOptions.logFrequency) { window.asc_data = isDataSend = true; }
|
|
84
132
|
initOptions.isCorrectOption = isCorrectOption;
|
|
85
133
|
this.initOptions = initOptions;
|
|
86
134
|
return isCorrectOption;
|
|
87
135
|
};
|
|
88
136
|
|
|
89
|
-
ascAdapter.
|
|
90
|
-
|
|
137
|
+
ascAdapter.getBidWonData = function(t) {
|
|
138
|
+
const { auctionId, adUnitCode, size, requestId, bidder, timeToRespond, currency, mediaType, cpm } = t
|
|
139
|
+
const aun = getAdunitName(adUnitCode)
|
|
140
|
+
winPayload['aid'] = auctionId
|
|
141
|
+
winPayload['as'] = '';
|
|
142
|
+
winPayload['auctionData'] = [];
|
|
143
|
+
var data = {}
|
|
144
|
+
data['au'] = aun
|
|
145
|
+
data['auc'] = adUnitCode
|
|
146
|
+
data['aus'] = size
|
|
147
|
+
data['bid'] = requestId
|
|
148
|
+
data['bidadv'] = bidder
|
|
149
|
+
data['br_pb_mg'] = cpm
|
|
150
|
+
data['br_tr'] = timeToRespond
|
|
151
|
+
data['bradv'] = bidder
|
|
152
|
+
data['brid'] = requestId
|
|
153
|
+
data['brs'] = size
|
|
154
|
+
data['cur'] = currency
|
|
155
|
+
data['inb'] = 0
|
|
156
|
+
data['ito'] = 0
|
|
157
|
+
data['ipwb'] = 1
|
|
158
|
+
data['iwb'] = 1
|
|
159
|
+
data['mt'] = mediaType
|
|
160
|
+
winPayload['auctionData'].push(data)
|
|
161
|
+
return winPayload
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
ascAdapter.getVisitorData = function (data = {}) {
|
|
165
|
+
var ua = data.uid ? data : {};
|
|
91
166
|
var module = {
|
|
92
167
|
options: [],
|
|
93
168
|
header: [window.navigator.platform, window.navigator.userAgent, window.navigator.appVersion, window.navigator.vendor, window.opera],
|
|
@@ -152,7 +227,7 @@ ascAdapter.getVisitorData = function(data = {}) {
|
|
|
152
227
|
crypto.getRandomValues(buffer);
|
|
153
228
|
buffer[6] = (buffer[6] & ~176) | 64;
|
|
154
229
|
buffer[8] = (buffer[8] & ~64) | 128;
|
|
155
|
-
var hex = Array.prototype.map.call(new Uint8Array(buffer), function(x) {
|
|
230
|
+
var hex = Array.prototype.map.call(new Uint8Array(buffer), function (x) {
|
|
156
231
|
return ('00' + x.toString(16)).slice(-2);
|
|
157
232
|
}).join('');
|
|
158
233
|
return hex.slice(0, 5) + '-' + hex.slice(5, 9) + '-' + hex.slice(9, 13) + '-' + hex.slice(13, 18);
|
|
@@ -182,34 +257,46 @@ ascAdapter.getVisitorData = function(data = {}) {
|
|
|
182
257
|
var signedToken = token + '.' + signature;
|
|
183
258
|
return signedToken;
|
|
184
259
|
}
|
|
185
|
-
|
|
186
|
-
|
|
260
|
+
function detectWidth() {
|
|
261
|
+
return window.screen.width || (window.innerWidth && document.documentElement.clientWidth) ? Math.min(window.innerWidth, document.documentElement.clientWidth) : window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
|
|
262
|
+
}
|
|
263
|
+
function giveDeviceTypeOnScreenSize() {
|
|
264
|
+
var _dWidth = detectWidth();
|
|
265
|
+
return _dWidth > 1024 ? 'Desktop' : (_dWidth <= 1024 && _dWidth >= 768) ? 'Tablet' : 'Mobile';
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const { clientId } = initOptions;
|
|
269
|
+
var userId = storage.getDataFromLocalStorage('userId')
|
|
187
270
|
if (!userId) {
|
|
188
271
|
userId = generateUid();
|
|
189
|
-
|
|
272
|
+
storage.setDataInLocalStorage('userId', userId);
|
|
190
273
|
}
|
|
191
|
-
var screenSize = {width: window.screen.width, height: window.screen.height};
|
|
192
|
-
var deviceType =
|
|
274
|
+
var screenSize = { width: window.screen.width, height: window.screen.height };
|
|
275
|
+
var deviceType = giveDeviceTypeOnScreenSize();
|
|
193
276
|
var e = module.init();
|
|
194
|
-
if (!ua['
|
|
195
|
-
ua['
|
|
196
|
-
ua['
|
|
197
|
-
ua['
|
|
198
|
-
ua['
|
|
199
|
-
ua['
|
|
200
|
-
ua['
|
|
201
|
-
ua['
|
|
202
|
-
ua['
|
|
203
|
-
ua['
|
|
277
|
+
if (!ua['uid']) {
|
|
278
|
+
ua['uid'] = userId;
|
|
279
|
+
ua['cid'] = clientId;
|
|
280
|
+
ua['pid'] = window.location.hostname;
|
|
281
|
+
ua['os'] = e.os.name;
|
|
282
|
+
ua['osv'] = e.os.version;
|
|
283
|
+
ua['br'] = e.browser.name;
|
|
284
|
+
ua['brv'] = e.browser.version;
|
|
285
|
+
ua['ss'] = screenSize;
|
|
286
|
+
ua['de'] = deviceType;
|
|
287
|
+
ua['tz'] = window.Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
204
288
|
}
|
|
205
289
|
var signedToken = getJWToken(ua);
|
|
206
290
|
payload['visitor_data'] = signedToken;
|
|
291
|
+
winPayload['visitor_data'] = signedToken;
|
|
207
292
|
return signedToken;
|
|
208
293
|
}
|
|
209
294
|
|
|
210
|
-
ascAdapter.dataProcess = function(t) {
|
|
211
|
-
payload['
|
|
212
|
-
|
|
295
|
+
ascAdapter.dataProcess = function (t) {
|
|
296
|
+
if (isBydata) { payload['bydata_debug'] = 'true'; }
|
|
297
|
+
_logInfo('fulldata - ', t);
|
|
298
|
+
payload['aid'] = t.auctionId;
|
|
299
|
+
payload['as'] = t.timestamp;
|
|
213
300
|
payload['auctionData'] = [];
|
|
214
301
|
var bidderRequestsData = []; var bidsReceivedData = [];
|
|
215
302
|
t.bidderRequests && t.bidderRequests.forEach(bidReq => {
|
|
@@ -228,69 +315,80 @@ ascAdapter.dataProcess = function(t) {
|
|
|
228
315
|
bidderRequestsData.push(pObj);
|
|
229
316
|
});
|
|
230
317
|
t.bidsReceived && t.bidsReceived.forEach(bid => {
|
|
231
|
-
const {requestId, bidder, width, height, cpm, currency, timeToRespond, adUnitCode} = bid;
|
|
232
|
-
bidsReceivedData.push({requestId, bidder, width, height, cpm, currency, timeToRespond, adUnitCode});
|
|
318
|
+
const { requestId, bidder, width, height, cpm, currency, timeToRespond, adUnitCode } = bid;
|
|
319
|
+
bidsReceivedData.push({ requestId, bidder, width, height, cpm, currency, timeToRespond, adUnitCode });
|
|
233
320
|
});
|
|
234
321
|
bidderRequestsData.length > 0 && bidderRequestsData.forEach(bdObj => {
|
|
235
322
|
var bdsArray = bdObj['bids'];
|
|
236
323
|
bdsArray.forEach(bid => {
|
|
237
|
-
const {adUnitCode, sizes, bidder, bidId, mediaTypes} = bid;
|
|
324
|
+
const { adUnitCode, sizes, bidder, bidId, mediaTypes } = bid;
|
|
238
325
|
sizes.forEach(size => {
|
|
239
326
|
var sstr = size[0] + 'x' + size[1]
|
|
240
|
-
payload['auctionData'].push({
|
|
327
|
+
payload['auctionData'].push({ au: getAdunitName(adUnitCode), auc: adUnitCode, aus: sstr, mt: mediaTypes[0], bidadv: bidder, bid: bidId, inb: 0, ito: 0, ipwb: 0, iwb: 0 });
|
|
241
328
|
});
|
|
242
329
|
});
|
|
243
330
|
});
|
|
331
|
+
|
|
244
332
|
bidsReceivedData.length > 0 && bidsReceivedData.forEach(bdRecived => {
|
|
245
|
-
const {requestId, bidder, width, height, cpm, currency, timeToRespond} = bdRecived;
|
|
333
|
+
const { requestId, bidder, width, height, cpm, currency, timeToRespond } = bdRecived;
|
|
246
334
|
payload['auctionData'].forEach(rwData => {
|
|
247
|
-
if (rwData['
|
|
248
|
-
rwData['
|
|
249
|
-
rwData['
|
|
335
|
+
if (rwData['bid'] === requestId && rwData['aus'] === width + 'x' + height) {
|
|
336
|
+
rwData['brid'] = requestId; rwData['bradv'] = bidder; rwData['br_pb_mg'] = cpm;
|
|
337
|
+
rwData['cur'] = currency; rwData['br_tr'] = timeToRespond; rwData['brs'] = width + 'x' + height;
|
|
250
338
|
}
|
|
251
339
|
})
|
|
252
340
|
});
|
|
341
|
+
|
|
342
|
+
var prebidWinningBids = auctionManager.getBidsReceived().filter(bid => bid.status === CONSTANTS.BID_STATUS.BID_TARGETING_SET);
|
|
343
|
+
prebidWinningBids && prebidWinningBids.length > 0 && prebidWinningBids.forEach(pbbid => {
|
|
344
|
+
payload['auctionData'] && payload['auctionData'].forEach(rwData => {
|
|
345
|
+
if (rwData['bid'] === pbbid.requestId && rwData['brs'] === pbbid.size) {
|
|
346
|
+
rwData['ipwb'] = 1;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
var winningBids = auctionManager.getAllWinningBids();
|
|
352
|
+
winningBids && winningBids.length > 0 && winningBids.forEach(wBid => {
|
|
353
|
+
payload['auctionData'] && payload['auctionData'].forEach(rwData => {
|
|
354
|
+
if (rwData['bid'] === wBid.requestId && rwData['brs'] === wBid.size) {
|
|
355
|
+
rwData['iwb'] = 1;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
})
|
|
359
|
+
|
|
253
360
|
payload['auctionData'] && payload['auctionData'].length > 0 && payload['auctionData'].forEach(u => {
|
|
254
361
|
bdNbTo['to'].forEach(i => {
|
|
255
|
-
if (u.
|
|
362
|
+
if (u.bid === i.bidId) u.ito = 1;
|
|
256
363
|
});
|
|
257
364
|
bdNbTo['nb'].forEach(i => {
|
|
258
|
-
if (u.
|
|
365
|
+
if (u.bidadv === i.bidder && u.bid === i.bidId) { u.inb = 1; }
|
|
259
366
|
})
|
|
260
367
|
});
|
|
261
368
|
return payload;
|
|
262
369
|
}
|
|
263
370
|
|
|
264
|
-
ascAdapter.sendPayload = function () {
|
|
265
|
-
var obj = { 'records': [
|
|
371
|
+
ascAdapter.sendPayload = function (data) {
|
|
372
|
+
var obj = { 'records': [{ 'value': data }] };
|
|
266
373
|
let strJSON = JSON.stringify(obj);
|
|
267
|
-
|
|
268
|
-
|
|
374
|
+
sendDataOnKf(strJSON);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function sendDataOnKf(dataObj) {
|
|
378
|
+
ajax(DEFAULT_EVENT_URL, {
|
|
379
|
+
success: function () {
|
|
380
|
+
_logInfo('send data success');
|
|
381
|
+
},
|
|
382
|
+
error: function (e) {
|
|
383
|
+
_logInfo('send data error', e);
|
|
384
|
+
}
|
|
385
|
+
}, dataObj, {
|
|
269
386
|
contentType: 'application/vnd.kafka.json.v2+json',
|
|
270
387
|
method: 'POST',
|
|
271
388
|
withCredentials: true
|
|
272
389
|
});
|
|
273
390
|
}
|
|
274
391
|
|
|
275
|
-
function addKeyForPrebidWinningAndWinningsBids() {
|
|
276
|
-
var prebidWinningBids = $$PREBID_GLOBAL$$.getAllPrebidWinningBids();
|
|
277
|
-
var winningBids = $$PREBID_GLOBAL$$.getAllWinningBids();
|
|
278
|
-
prebidWinningBids && prebidWinningBids.length > 0 && prebidWinningBids.forEach(pbbid => {
|
|
279
|
-
payload['auctionData'] && payload['auctionData'].forEach(rwData => {
|
|
280
|
-
if (rwData['bids_bid_id'] === pbbid.requestId && rwData['br_size'] === pbbid.size) {
|
|
281
|
-
rwData['is_prebid_winning_bid'] = 1;
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
})
|
|
285
|
-
winningBids && winningBids.length > 0 && winningBids.forEach(wBid => {
|
|
286
|
-
payload['auctionData'] && payload['auctionData'].forEach(rwData => {
|
|
287
|
-
if (rwData['bids_bid_id'] === wBid.requestId && rwData['br_size'] === wBid.size) {
|
|
288
|
-
rwData['is_winning_bid'] = 1;
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
})
|
|
292
|
-
}
|
|
293
|
-
|
|
294
392
|
adapterManager.registerAnalyticsAdapter({
|
|
295
393
|
adapter: ascAdapter,
|
|
296
394
|
code: 'bydata'
|
|
@@ -305,7 +403,7 @@ function _logError(message) {
|
|
|
305
403
|
}
|
|
306
404
|
|
|
307
405
|
function buildLogMessage(message) {
|
|
308
|
-
return 'Bydata Prebid Analytics
|
|
406
|
+
return 'Bydata Prebid Analytics ' + versionCode + ':' + message;
|
|
309
407
|
}
|
|
310
408
|
|
|
311
409
|
export default ascAdapter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
3
|
layout: Analytics Adapter
|
|
4
|
-
title:
|
|
4
|
+
title: byData. (https://bydata.com/)
|
|
5
5
|
description: Bydata Analytics Adapter
|
|
6
6
|
modulecode: byDataAnalyticsAdapter
|
|
7
7
|
gdpr_supported: false (EU GDPR support)
|
|
@@ -13,11 +13,12 @@ enable_download: false (in case you don't want users of the website to dow
|
|
|
13
13
|
|
|
14
14
|
Module Name: Bydata Analytics Adapter
|
|
15
15
|
Module Type: Analytics Adapter
|
|
16
|
-
Maintainer:
|
|
16
|
+
Maintainer: byData
|
|
17
17
|
|
|
18
18
|
# Description
|
|
19
19
|
|
|
20
|
-
Analytics adapter for https://
|
|
20
|
+
Analytics adapter for https://bydata.com/. Contact admin@byData.com for information.
|
|
21
|
+
|
|
21
22
|
|
|
22
23
|
# Test Parameters
|
|
23
24
|
|
|
@@ -25,10 +26,8 @@ Analytics adapter for https://ascendeum.com/. Contact engineering@ascendeum.com
|
|
|
25
26
|
{
|
|
26
27
|
provider: 'bydata',
|
|
27
28
|
options : {
|
|
28
|
-
clientId: "
|
|
29
|
+
clientId: "please contact byData team to get a clientId",
|
|
29
30
|
logFrequency : 100, // Sample Rate Default - 1%
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
```
|
|
33
|
-
|
|
34
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logWarn, createTrackPixelHtml } from '../src/utils.js';
|
|
1
|
+
import { logWarn, createTrackPixelHtml, deepAccess, isArray, deepSetValue } from '../src/utils.js';
|
|
2
2
|
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
3
3
|
|
|
4
4
|
const BIDDER_CODE = 'consumable';
|
|
@@ -78,6 +78,8 @@ export const spec = {
|
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
+
handleEids(data, validBidRequests);
|
|
82
|
+
|
|
81
83
|
ret.data = JSON.stringify(data);
|
|
82
84
|
ret.bidRequest = validBidRequests;
|
|
83
85
|
ret.bidderRequest = bidderRequest;
|
|
@@ -234,4 +236,13 @@ function retrieveAd(decision, unitId, unitName) {
|
|
|
234
236
|
return ad;
|
|
235
237
|
}
|
|
236
238
|
|
|
239
|
+
function handleEids(data, validBidRequests) {
|
|
240
|
+
let bidUserIdAsEids = deepAccess(validBidRequests, '0.userIdAsEids');
|
|
241
|
+
if (isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
|
|
242
|
+
deepSetValue(data, 'user.eids', bidUserIdAsEids);
|
|
243
|
+
} else {
|
|
244
|
+
deepSetValue(data, 'user.eids', undefined);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
237
248
|
registerBidder(spec);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {getWindowSelf, isEmpty, parseSizesInput} from '../src/utils.js';
|
|
1
|
+
import {getWindowSelf, isEmpty, parseSizesInput, isGptPubadsDefined, isSlotMatchingAdUnitCode} from '../src/utils.js';
|
|
2
2
|
import {getGlobal} from '../src/prebidGlobal.js';
|
|
3
3
|
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
4
4
|
import {getStorageManager} from '../src/storageManager.js';
|
|
@@ -291,13 +291,25 @@ function getCharset() {
|
|
|
291
291
|
|
|
292
292
|
function waitForElementsPresent(elements) {
|
|
293
293
|
const observer = new MutationObserver(function (mutationList, observer) {
|
|
294
|
+
let index;
|
|
295
|
+
let adView;
|
|
294
296
|
if (mutationList && Array.isArray(mutationList)) {
|
|
295
297
|
mutationList.forEach(mr => {
|
|
296
298
|
if (mr && mr.addedNodes && Array.isArray(mr.addedNodes)) {
|
|
297
299
|
mr.addedNodes.forEach(ad => {
|
|
298
|
-
|
|
300
|
+
index = elements.indexOf(ad.id);
|
|
301
|
+
adView = ad;
|
|
302
|
+
if (index < 0) {
|
|
303
|
+
elements.forEach(code => {
|
|
304
|
+
let div = _getAdSlotHTMLElement(code);
|
|
305
|
+
if (div && div.contains(ad) && div.getBoundingClientRect().width > 0) {
|
|
306
|
+
index = elements.indexOf(div.id);
|
|
307
|
+
adView = div;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
299
311
|
if (index >= 0) {
|
|
300
|
-
registerViewability(
|
|
312
|
+
registerViewability(adView, elements[index]);
|
|
301
313
|
elements.splice(index, 1);
|
|
302
314
|
if (!elements.length) {
|
|
303
315
|
observer.disconnect();
|
|
@@ -318,19 +330,41 @@ function waitForElementsPresent(elements) {
|
|
|
318
330
|
});
|
|
319
331
|
}
|
|
320
332
|
|
|
321
|
-
function registerViewability(div) {
|
|
333
|
+
function registerViewability(div, name) {
|
|
322
334
|
visibilityHandler({
|
|
323
|
-
name:
|
|
335
|
+
name: name,
|
|
324
336
|
div: div
|
|
325
337
|
});
|
|
326
338
|
}
|
|
327
339
|
|
|
340
|
+
function _mapAdUnitPathToElementId(adUnitCode) {
|
|
341
|
+
if (isGptPubadsDefined()) {
|
|
342
|
+
// eslint-disable-next-line no-undef
|
|
343
|
+
const adSlots = googletag.pubads().getSlots();
|
|
344
|
+
const isMatchingAdSlot = isSlotMatchingAdUnitCode(adUnitCode);
|
|
345
|
+
|
|
346
|
+
for (let i = 0; i < adSlots.length; i++) {
|
|
347
|
+
if (isMatchingAdSlot(adSlots[i])) {
|
|
348
|
+
const id = adSlots[i].getSlotElementId();
|
|
349
|
+
return id;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function _getAdSlotHTMLElement(adUnitCode) {
|
|
358
|
+
return document.getElementById(adUnitCode) ||
|
|
359
|
+
document.getElementById(_mapAdUnitPathToElementId(adUnitCode));
|
|
360
|
+
}
|
|
361
|
+
|
|
328
362
|
function registerViewabilityAllBids(bids) {
|
|
329
363
|
let elementsNotPresent = [];
|
|
330
364
|
bids.forEach(bid => {
|
|
331
|
-
let div =
|
|
365
|
+
let div = _getAdSlotHTMLElement(bid.adUnitCode);
|
|
332
366
|
if (div) {
|
|
333
|
-
registerViewability(div);
|
|
367
|
+
registerViewability(div, bid.adUnitCode);
|
|
334
368
|
} else {
|
|
335
369
|
elementsNotPresent.push(bid.adUnitCode);
|
|
336
370
|
}
|
|
@@ -345,114 +379,65 @@ function getViewabilityTracker() {
|
|
|
345
379
|
let VIEWABILITY_TIME = 1000;
|
|
346
380
|
let VIEWABILITY_MIN_RATIO = 0.5;
|
|
347
381
|
let publicApi;
|
|
348
|
-
let
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
function segmentEndsAfterTheVisibleRange(visibleRangeEnd, p2) {
|
|
359
|
-
return p2 < visibleRangeEnd;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
function axialVisibilityRatio(visibleRangeEnd, p1, p2) {
|
|
363
|
-
let visibilityRatio = 0;
|
|
364
|
-
if (!segmentIsOutsideTheVisibleRange(visibleRangeEnd, p1, p2)) {
|
|
365
|
-
if (segmentBeginsBeforeTheVisibleRange(p1)) {
|
|
366
|
-
visibilityRatio = p2 / (p2 - p1);
|
|
382
|
+
let observer;
|
|
383
|
+
let visibilityAds = {};
|
|
384
|
+
|
|
385
|
+
function intersectionCallback(entries) {
|
|
386
|
+
entries.forEach(function(entry) {
|
|
387
|
+
var adBox = entry.target;
|
|
388
|
+
if (entry.isIntersecting) {
|
|
389
|
+
if (entry.intersectionRatio >= VIEWABILITY_MIN_RATIO && entry.boundingClientRect && entry.boundingClientRect.height > 0 && entry.boundingClientRect.width > 0) {
|
|
390
|
+
visibilityAds[adBox.id] = true;
|
|
391
|
+
}
|
|
367
392
|
} else {
|
|
368
|
-
|
|
393
|
+
visibilityAds[adBox.id] = false;
|
|
369
394
|
}
|
|
370
|
-
}
|
|
371
|
-
return visibilityRatio;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
function isNotHiddenByNonFriendlyIframe() {
|
|
375
|
-
try { return (window === window.top) || window.frameElement; } catch (e) {}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function defineContext(e) {
|
|
379
|
-
try {
|
|
380
|
-
context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined);
|
|
381
|
-
} catch (err) {}
|
|
382
|
-
return context;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function getContext(e) {
|
|
386
|
-
return context;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function verticalVisibilityRatio(position) {
|
|
390
|
-
return axialVisibilityRatio(getContext().innerHeight, position.top, position.bottom);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function horizontalVisibilityRatio(position) {
|
|
394
|
-
return axialVisibilityRatio(getContext().innerWidth, position.left, position.right);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function itIsNotHiddenByBannerAreaPosition(e) {
|
|
398
|
-
let position = e.getBoundingClientRect();
|
|
399
|
-
return (verticalVisibilityRatio(position) * horizontalVisibilityRatio(position)) > VIEWABILITY_MIN_RATIO;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function itIsNotHiddenByDisplayStyleCascade(e) {
|
|
403
|
-
return e.offsetHeight > 0 && e.offsetWidth > 0;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function itIsNotHiddenByOpacityStyleCascade(e) {
|
|
407
|
-
let s = e.style;
|
|
408
|
-
let p = e.parentNode;
|
|
409
|
-
return !(s && parseFloat(s.opacity) === 0) && (!p || itIsNotHiddenByOpacityStyleCascade(p));
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function itIsNotHiddenByVisibilityStyleCascade(e) {
|
|
413
|
-
return getContext().getComputedStyle(e).visibility !== 'hidden';
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function itIsNotHiddenByTabFocus() {
|
|
417
|
-
try { return getContext().top.document.hasFocus(); } catch (e) {}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function isDefined(e) {
|
|
421
|
-
return (e !== null) && (typeof e !== 'undefined');
|
|
395
|
+
});
|
|
422
396
|
}
|
|
423
397
|
|
|
424
|
-
function
|
|
425
|
-
return
|
|
398
|
+
function observedElementIsVisible(element) {
|
|
399
|
+
return visibilityAds[element.id] && document.visibilityState && document.visibilityState === 'visible';
|
|
426
400
|
}
|
|
427
401
|
|
|
428
|
-
function
|
|
429
|
-
|
|
402
|
+
function defineObserver() {
|
|
403
|
+
if (!observer) {
|
|
404
|
+
var observerConfig = {
|
|
405
|
+
root: null,
|
|
406
|
+
rootMargin: '0px',
|
|
407
|
+
threshold: [VIEWABILITY_MIN_RATIO]
|
|
408
|
+
};
|
|
409
|
+
observer = new IntersectionObserver(intersectionCallback.bind(this), observerConfig);
|
|
410
|
+
}
|
|
430
411
|
}
|
|
431
|
-
|
|
432
412
|
function processIntervalVisibilityStatus(elapsedVisibleIntervals, element, callback) {
|
|
433
|
-
let visibleIntervals =
|
|
413
|
+
let visibleIntervals = observedElementIsVisible(element) ? (elapsedVisibleIntervals + 1) : 0;
|
|
434
414
|
if (visibleIntervals === TIME_PARTITIONS) {
|
|
415
|
+
stopObserveViewability(element)
|
|
435
416
|
callback();
|
|
436
417
|
} else {
|
|
437
418
|
setTimeout(processIntervalVisibilityStatus.bind(this, visibleIntervals, element, callback), VIEWABILITY_TIME / TIME_PARTITIONS);
|
|
438
419
|
}
|
|
439
420
|
}
|
|
440
421
|
|
|
441
|
-
function
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
422
|
+
function stopObserveViewability(element) {
|
|
423
|
+
delete visibilityAds[element.id];
|
|
424
|
+
observer.unobserve(element);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function observeAds(element) {
|
|
428
|
+
observer.observe(element);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function initAndVerifyVisibility(element, callback) {
|
|
432
|
+
if (element) {
|
|
433
|
+
defineObserver();
|
|
434
|
+
observeAds(element);
|
|
435
|
+
processIntervalVisibilityStatus(0, element, callback);
|
|
436
|
+
}
|
|
451
437
|
}
|
|
452
438
|
|
|
453
439
|
publicApi = {
|
|
454
|
-
|
|
455
|
-
onView: processIntervalVisibilityStatus.bind(this, 0)
|
|
440
|
+
onView: initAndVerifyVisibility.bind(this)
|
|
456
441
|
};
|
|
457
442
|
|
|
458
443
|
return publicApi;
|