@@ -4,9 +4,17 @@ import { EVENTS } from '../src/constants.js';
44import adapterManager from '../src/adapterManager.js' ;
55import { deepClone , generateUUID , logError , logInfo , logWarn , getParameterByName } from '../src/utils.js' ;
66
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+
715const analyticsType = 'endpoint' ;
816
9- export const ANALYTICS_VERSION = '2.3.1 ' ;
17+ export const ANALYTICS_VERSION = '2.3.2 ' ;
1018
1119const ANALYTICS_SERVER = 'https://a.greenbids.ai' ;
1220
@@ -97,6 +105,11 @@ export const greenbidsAnalyticsAdapter = Object.assign(adapter({ANALYTICS_SERVER
97105 contentType : 'application/json'
98106 } ) ;
99107 } ,
108+ /**
109+ *
110+ * @param {string } auctionId
111+ * @returns {Message }
112+ */
100113 createCommonMessage ( auctionId ) {
101114 const cachedAuction = this . getCachedAuction ( auctionId ) ;
102115 return {
@@ -111,14 +124,27 @@ export const greenbidsAnalyticsAdapter = Object.assign(adapter({ANALYTICS_SERVER
111124 adUnits : [ ] ,
112125 } ;
113126 } ,
127+ /**
128+ * @param {Bid } bid
129+ * @param {BIDDER_STATUS } status
130+ */
114131 serializeBidResponse ( bid , status ) {
115132 return {
116133 bidder : bid . bidder ,
117134 isTimeout : ( status === BIDDER_STATUS . TIMEOUT ) ,
118135 hasBid : ( status === BIDDER_STATUS . BID ) ,
119136 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+ } : { } ) ,
120141 } ;
121142 } ,
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+ */
122148 addBidResponseToMessage ( message , bid , status ) {
123149 const adUnitCode = bid . adUnitCode . toLowerCase ( ) ;
124150 const adUnitIndex = message . adUnits . findIndex ( ( adUnit ) => {
0 commit comments