@@ -6,18 +6,18 @@ import {
66 getBidIdParameter ,
77 triggerPixel ,
88 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" ;
2121const GVLID = 1241 ;
2222const TIME_TO_LIVE = 360 ;
2323const biddersCpms = { } ;
@@ -29,7 +29,7 @@ events.on(CONSTANTS.EVENTS.AUCTION_INIT, () => {
2929} ) ;
3030
3131function getEids ( bidRequest ) {
32- if ( deepAccess ( bidRequest , ' userIdAsEids' ) ) return bidRequest . userIdAsEids ;
32+ if ( deepAccess ( bidRequest , " userIdAsEids" ) ) return bidRequest . userIdAsEids ;
3333}
3434
3535export const spec = {
@@ -45,9 +45,10 @@ export const spec = {
4545 const requests = [ ] ;
4646 window . nmmRefreshCounts = window . nmmRefreshCounts || { } ;
4747 _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 ) ;
5152 const auctionId = bid . auctionId ;
5253 const bidId = bid . bidId ;
5354 const eids = getEids ( bid ) || [ ] ;
@@ -62,7 +63,7 @@ export const spec = {
6263 ext : {
6364 prebid : {
6465 storedrequest : {
65- id : accountId || ' default' ,
66+ id : accountId || " default" ,
6667 } ,
6768 } ,
6869
@@ -87,7 +88,7 @@ export const spec = {
8788 } ,
8889 } ;
8990
90- if ( deepAccess ( bid , ' mediaTypes.banner' ) ) {
91+ if ( deepAccess ( bid , " mediaTypes.banner" ) ) {
9192 imp . banner = {
9293 format : ( sizes || [ ] ) . map ( ( s ) => {
9394 return { w : s [ 0 ] , h : s [ 1 ] } ;
@@ -106,23 +107,23 @@ export const spec = {
106107 if ( uspConsent ) payload . regs . ext . us_privacy = uspConsent ;
107108
108109 if ( gdprConsent ) {
109- if ( typeof gdprConsent . gdprApplies !== ' undefined' ) {
110+ if ( typeof gdprConsent . gdprApplies !== " undefined" ) {
110111 payload . regs . ext . gdpr = gdprConsent . gdprApplies ? 1 : 0 ;
111112 }
112113
113- if ( typeof gdprConsent . consentString !== ' undefined' ) {
114+ if ( typeof gdprConsent . consentString !== " undefined" ) {
114115 payload . user . ext . consent = gdprConsent . consentString ;
115116 }
116117 }
117118 }
118119 const params = bid . params ;
119120
120121 requests . push ( {
121- method : ' POST' ,
122+ method : " POST" ,
122123 url : ENDPOINT ,
123124 data : JSON . stringify ( payload ) ,
124125 options : {
125- contentType : ' text/plain' ,
126+ contentType : " text/plain" ,
126127 withCredentials : true ,
127128 } ,
128129
@@ -139,10 +140,10 @@ export const spec = {
139140 if (
140141 ! serverResponse ||
141142 ! serverResponse . body ||
142- typeof serverResponse . body != ' object' ||
143+ typeof serverResponse . body != " object" ||
143144 Object . keys ( serverResponse . body ) . length === 0
144145 ) {
145- logWarn ( ' no response or body is malformed' ) ;
146+ logWarn ( " no response or body is malformed" ) ;
146147 return [ ] ;
147148 }
148149
@@ -193,15 +194,15 @@ export const spec = {
193194 const queryParams = [ ] ;
194195
195196 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 || "" ) ) ;
199200
200- const strQueryParams = queryParams . join ( '&' ) ;
201+ const strQueryParams = queryParams . join ( "&" ) ;
201202
202203 syncs . push ( {
203- type : ' iframe' ,
204- url : SYNC_ENDPOINT + strQueryParams + ' &type=iframe' ,
204+ type : " iframe" ,
205+ url : SYNC_ENDPOINT + strQueryParams + " &type=iframe" ,
205206 } ) ;
206207
207208 return syncs ;
@@ -232,11 +233,12 @@ export const spec = {
232233 placementIdsArray . push ( param . placement_id ) ;
233234 } ) ;
234235
235- const placementIds = ( placementIdsArray . length && placementIdsArray . join ( ';' ) ) || '' ;
236+ const placementIds =
237+ ( placementIdsArray . length && placementIdsArray . join ( ";" ) ) || "" ;
236238
237239 if ( ! placementIds ) return ;
238240
239- let extraBidParams = '' ;
241+ let extraBidParams = "" ;
240242
241243 if ( eventName === CONSTANTS . EVENTS . BID_RESPONSE ) {
242244 bidder = JSON . stringify ( biddersCpms ) ;
@@ -261,6 +263,14 @@ export const spec = {
261263 extraBidParams = `&cpm=${ bid . originalCpm } ¤cy=${ bid . originalCurrency } ` ;
262264 }
263265
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+
264274 const url = `${ REPORT_ENDPOINT } ?event=${ eventName } &bidder=${ bidder } &placementIds=${ placementIds } &auctionId=${ auctionId } ${ extraBidParams } ×tamp=${ timestamp } ` ;
265275
266276 return url ;
@@ -288,7 +298,7 @@ function getAdEl(bid) {
288298 . find ( ( slot ) => slot . getAdUnitPath ( ) === bid . adUnitCode ) ;
289299 const slotElementId = slot && slot . getSlotElementId ( ) ;
290300 if ( ! slotElementId ) return null ;
291- return document . querySelector ( '#' + slotElementId ) ;
301+ return document . querySelector ( "#" + slotElementId ) ;
292302}
293303
294304function getBoundingClient ( bid ) {
@@ -300,7 +310,7 @@ function getBoundingClient(bid) {
300310function getAd ( bid ) {
301311 let ad , adUrl , vastXml , vastUrl ;
302312
303- switch ( deepAccess ( bid , ' ext.prebid.type' ) ) {
313+ switch ( deepAccess ( bid , " ext.prebid.type" ) ) {
304314 default :
305315 if ( bid . adm && bid . nurl ) {
306316 ad = bid . adm ;
@@ -356,7 +366,8 @@ function initSendingDataStatistic() {
356366 eventHendlers = { } ;
357367
358368 initEvents ( ) {
359- this . disabledSending = ! ! config . getBidderConfig ( ) ?. setupad ?. disabledSendingStatisticData ;
369+ this . disabledSending =
370+ ! ! config . getBidderConfig ( ) ?. setupad ?. disabledSendingStatisticData ;
360371 if ( this . disabledSending ) {
361372 this . removeEvents ( ) ;
362373 } else {
0 commit comments