@@ -6,18 +6,18 @@ import {
6
6
getBidIdParameter ,
7
7
triggerPixel ,
8
8
logWarn ,
9
- } from ' ../src/utils.js' ;
10
- import { registerBidder } from ' ../src/adapters/bidderFactory.js' ;
11
- import { getRefererInfo } from ' ../src/refererDetection.js' ;
12
- import { config } from ' ../src/config.js' ;
13
- import * as events from ' ../src/events.js' ;
14
- import { BANNER } from ' ../src/mediaTypes.js' ;
15
- import CONSTANTS from ' ../src/constants.json' ;
16
-
17
- const BIDDER_CODE = ' setupad' ;
18
- const ENDPOINT = ' https://prebid.setupad.io/openrtb2/auction' ;
19
- const SYNC_ENDPOINT = ' https://cookie.stpd.cloud/sync?' ;
20
- const REPORT_ENDPOINT = ' https://adapter-analytics.setupad.io' ;
9
+ } from " ../src/utils.js" ;
10
+ import { registerBidder } from " ../src/adapters/bidderFactory.js" ;
11
+ import { getRefererInfo } from " ../src/refererDetection.js" ;
12
+ import { config } from " ../src/config.js" ;
13
+ import * as events from " ../src/events.js" ;
14
+ import { BANNER } from " ../src/mediaTypes.js" ;
15
+ import CONSTANTS from " ../src/constants.json" ;
16
+
17
+ const BIDDER_CODE = " setupad" ;
18
+ const ENDPOINT = " https://prebid.setupad.io/openrtb2/auction" ;
19
+ const SYNC_ENDPOINT = " https://cookie.stpd.cloud/sync?" ;
20
+ const REPORT_ENDPOINT = " https://adapter-analytics.setupad.io" ;
21
21
const GVLID = 1241 ;
22
22
const TIME_TO_LIVE = 360 ;
23
23
const biddersCpms = { } ;
@@ -29,7 +29,7 @@ events.on(CONSTANTS.EVENTS.AUCTION_INIT, () => {
29
29
} ) ;
30
30
31
31
function getEids ( bidRequest ) {
32
- if ( deepAccess ( bidRequest , ' userIdAsEids' ) ) return bidRequest . userIdAsEids ;
32
+ if ( deepAccess ( bidRequest , " userIdAsEids" ) ) return bidRequest . userIdAsEids ;
33
33
}
34
34
35
35
export const spec = {
@@ -45,9 +45,10 @@ export const spec = {
45
45
const requests = [ ] ;
46
46
window . nmmRefreshCounts = window . nmmRefreshCounts || { } ;
47
47
_each ( validBidRequests , function ( bid ) {
48
- window . nmmRefreshCounts [ bid . adUnitCode ] = window . nmmRefreshCounts [ bid . adUnitCode ] || 0 ;
49
- const id = getBidIdParameter ( 'placement_id' , bid . params ) ;
50
- const accountId = getBidIdParameter ( 'account_id' , bid . params ) ;
48
+ window . nmmRefreshCounts [ bid . adUnitCode ] =
49
+ window . nmmRefreshCounts [ bid . adUnitCode ] || 0 ;
50
+ const id = getBidIdParameter ( "placement_id" , bid . params ) ;
51
+ const accountId = getBidIdParameter ( "account_id" , bid . params ) ;
51
52
const auctionId = bid . auctionId ;
52
53
const bidId = bid . bidId ;
53
54
const eids = getEids ( bid ) || [ ] ;
@@ -62,7 +63,7 @@ export const spec = {
62
63
ext : {
63
64
prebid : {
64
65
storedrequest : {
65
- id : accountId || ' default' ,
66
+ id : accountId || " default" ,
66
67
} ,
67
68
} ,
68
69
@@ -87,7 +88,7 @@ export const spec = {
87
88
} ,
88
89
} ;
89
90
90
- if ( deepAccess ( bid , ' mediaTypes.banner' ) ) {
91
+ if ( deepAccess ( bid , " mediaTypes.banner" ) ) {
91
92
imp . banner = {
92
93
format : ( sizes || [ ] ) . map ( ( s ) => {
93
94
return { w : s [ 0 ] , h : s [ 1 ] } ;
@@ -106,23 +107,23 @@ export const spec = {
106
107
if ( uspConsent ) payload . regs . ext . us_privacy = uspConsent ;
107
108
108
109
if ( gdprConsent ) {
109
- if ( typeof gdprConsent . gdprApplies !== ' undefined' ) {
110
+ if ( typeof gdprConsent . gdprApplies !== " undefined" ) {
110
111
payload . regs . ext . gdpr = gdprConsent . gdprApplies ? 1 : 0 ;
111
112
}
112
113
113
- if ( typeof gdprConsent . consentString !== ' undefined' ) {
114
+ if ( typeof gdprConsent . consentString !== " undefined" ) {
114
115
payload . user . ext . consent = gdprConsent . consentString ;
115
116
}
116
117
}
117
118
}
118
119
const params = bid . params ;
119
120
120
121
requests . push ( {
121
- method : ' POST' ,
122
+ method : " POST" ,
122
123
url : ENDPOINT ,
123
124
data : JSON . stringify ( payload ) ,
124
125
options : {
125
- contentType : ' text/plain' ,
126
+ contentType : " text/plain" ,
126
127
withCredentials : true ,
127
128
} ,
128
129
@@ -139,10 +140,10 @@ export const spec = {
139
140
if (
140
141
! serverResponse ||
141
142
! serverResponse . body ||
142
- typeof serverResponse . body != ' object' ||
143
+ typeof serverResponse . body != " object" ||
143
144
Object . keys ( serverResponse . body ) . length === 0
144
145
) {
145
- logWarn ( ' no response or body is malformed' ) ;
146
+ logWarn ( " no response or body is malformed" ) ;
146
147
return [ ] ;
147
148
}
148
149
@@ -193,15 +194,15 @@ export const spec = {
193
194
const queryParams = [ ] ;
194
195
195
196
queryParams . push ( `bidders=${ bidders } ` ) ;
196
- queryParams . push ( ' gdpr=' + + gdprConsent . gdprApplies ) ;
197
- queryParams . push ( ' gdpr_consent=' + gdprConsent . consentString ) ;
198
- queryParams . push ( ' usp_consent=' + ( uspConsent || '' ) ) ;
197
+ queryParams . push ( " gdpr=" + + gdprConsent . gdprApplies ) ;
198
+ queryParams . push ( " gdpr_consent=" + gdprConsent . consentString ) ;
199
+ queryParams . push ( " usp_consent=" + ( uspConsent || "" ) ) ;
199
200
200
- const strQueryParams = queryParams . join ( '&' ) ;
201
+ const strQueryParams = queryParams . join ( "&" ) ;
201
202
202
203
syncs . push ( {
203
- type : ' iframe' ,
204
- url : SYNC_ENDPOINT + strQueryParams + ' &type=iframe' ,
204
+ type : " iframe" ,
205
+ url : SYNC_ENDPOINT + strQueryParams + " &type=iframe" ,
205
206
} ) ;
206
207
207
208
return syncs ;
@@ -232,11 +233,12 @@ export const spec = {
232
233
placementIdsArray . push ( param . placement_id ) ;
233
234
} ) ;
234
235
235
- const placementIds = ( placementIdsArray . length && placementIdsArray . join ( ';' ) ) || '' ;
236
+ const placementIds =
237
+ ( placementIdsArray . length && placementIdsArray . join ( ";" ) ) || "" ;
236
238
237
239
if ( ! placementIds ) return ;
238
240
239
- let extraBidParams = '' ;
241
+ let extraBidParams = "" ;
240
242
241
243
if ( eventName === CONSTANTS . EVENTS . BID_RESPONSE ) {
242
244
bidder = JSON . stringify ( biddersCpms ) ;
@@ -261,6 +263,14 @@ export const spec = {
261
263
extraBidParams = `&cpm=${ bid . originalCpm } ¤cy=${ bid . originalCurrency } ` ;
262
264
}
263
265
266
+ if (
267
+ eventName === CONSTANTS . EVENTS . BID_REQUESTED ||
268
+ eventName === CONSTANTS . EVENTS . BID_TIMEOUT ||
269
+ eventName === CONSTANTS . EVENTS . NO_BID
270
+ ) {
271
+ bidder = BIDDER_CODE ;
272
+ }
273
+
264
274
const url = `${ REPORT_ENDPOINT } ?event=${ eventName } &bidder=${ bidder } &placementIds=${ placementIds } &auctionId=${ auctionId } ${ extraBidParams } ×tamp=${ timestamp } ` ;
265
275
266
276
return url ;
@@ -288,7 +298,7 @@ function getAdEl(bid) {
288
298
. find ( ( slot ) => slot . getAdUnitPath ( ) === bid . adUnitCode ) ;
289
299
const slotElementId = slot && slot . getSlotElementId ( ) ;
290
300
if ( ! slotElementId ) return null ;
291
- return document . querySelector ( '#' + slotElementId ) ;
301
+ return document . querySelector ( "#" + slotElementId ) ;
292
302
}
293
303
294
304
function getBoundingClient ( bid ) {
@@ -300,7 +310,7 @@ function getBoundingClient(bid) {
300
310
function getAd ( bid ) {
301
311
let ad , adUrl , vastXml , vastUrl ;
302
312
303
- switch ( deepAccess ( bid , ' ext.prebid.type' ) ) {
313
+ switch ( deepAccess ( bid , " ext.prebid.type" ) ) {
304
314
default :
305
315
if ( bid . adm && bid . nurl ) {
306
316
ad = bid . adm ;
@@ -356,7 +366,8 @@ function initSendingDataStatistic() {
356
366
eventHendlers = { } ;
357
367
358
368
initEvents ( ) {
359
- this . disabledSending = ! ! config . getBidderConfig ( ) ?. setupad ?. disabledSendingStatisticData ;
369
+ this . disabledSending =
370
+ ! ! config . getBidderConfig ( ) ?. setupad ?. disabledSendingStatisticData ;
360
371
if ( this . disabledSending ) {
361
372
this . removeEvents ( ) ;
362
373
} else {
0 commit comments