@@ -4,9 +4,17 @@ import { EVENTS } from '../src/constants.js';
4
4
import adapterManager from '../src/adapterManager.js' ;
5
5
import { deepClone , generateUUID , logError , logInfo , logWarn , getParameterByName } from '../src/utils.js' ;
6
6
7
+ /**
8
+ * @typedef {import('../src/adapters/bidderFactory.js').Bid } Bid
9
+ */
10
+
11
+ /**
12
+ * @typedef {object } Message Payload message sent to the Greenbids API
13
+ */
14
+
7
15
const analyticsType = 'endpoint' ;
8
16
9
- export const ANALYTICS_VERSION = '2.3.1 ' ;
17
+ export const ANALYTICS_VERSION = '2.3.2 ' ;
10
18
11
19
const ANALYTICS_SERVER = 'https://a.greenbids.ai' ;
12
20
@@ -97,6 +105,11 @@ export const greenbidsAnalyticsAdapter = Object.assign(adapter({ANALYTICS_SERVER
97
105
contentType : 'application/json'
98
106
} ) ;
99
107
} ,
108
+ /**
109
+ *
110
+ * @param {string } auctionId
111
+ * @returns {Message }
112
+ */
100
113
createCommonMessage ( auctionId ) {
101
114
const cachedAuction = this . getCachedAuction ( auctionId ) ;
102
115
return {
@@ -111,14 +124,27 @@ export const greenbidsAnalyticsAdapter = Object.assign(adapter({ANALYTICS_SERVER
111
124
adUnits : [ ] ,
112
125
} ;
113
126
} ,
127
+ /**
128
+ * @param {Bid } bid
129
+ * @param {BIDDER_STATUS } status
130
+ */
114
131
serializeBidResponse ( bid , status ) {
115
132
return {
116
133
bidder : bid . bidder ,
117
134
isTimeout : ( status === BIDDER_STATUS . TIMEOUT ) ,
118
135
hasBid : ( status === BIDDER_STATUS . BID ) ,
119
136
params : ( bid . params && Object . keys ( bid . params ) . length > 0 ) ? bid . params : { } ,
137
+ ...( status === BIDDER_STATUS . BID ? {
138
+ cpm : bid . cpm ,
139
+ currency : bid . currency
140
+ } : { } ) ,
120
141
} ;
121
142
} ,
143
+ /**
144
+ * @param {* } message Greenbids API payload
145
+ * @param {Bid } bid Bid to add to the payload
146
+ * @param {BIDDER_STATUS } status Bidding status
147
+ */
122
148
addBidResponseToMessage ( message , bid , status ) {
123
149
const adUnitCode = bid . adUnitCode . toLowerCase ( ) ;
124
150
const adUnitIndex = message . adUnits . findIndex ( ( adUnit ) => {
0 commit comments