@@ -7,7 +7,7 @@ const BIDDER_CODE = 'ozone';
7
7
8
8
const OZONEURI = 'https://elb.the-ozone-project.com/openrtb2/auction' ;
9
9
const OZONECOOKIESYNC = 'https://elb.the-ozone-project.com/static/load-cookie.html' ;
10
- const OZONEVERSION = '1.4.4 ' ;
10
+ const OZONEVERSION = '1.4.7 ' ;
11
11
export const spec = {
12
12
code : BIDDER_CODE ,
13
13
@@ -18,72 +18,78 @@ export const spec = {
18
18
*/
19
19
isBidRequestValid ( bid ) {
20
20
if ( ! ( bid . params . hasOwnProperty ( 'placementId' ) ) ) {
21
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : missing placementId : siteId, placementId and publisherId are REQUIRED' ) ;
21
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : missing placementId : siteId, placementId and publisherId are REQUIRED' ) ;
22
22
return false ;
23
23
}
24
24
if ( ! ( bid . params . placementId ) . toString ( ) . match ( / ^ [ 0 - 9 ] { 10 } $ / ) ) {
25
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : placementId must be exactly 10 numeric characters' ) ;
25
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : placementId must be exactly 10 numeric characters' ) ;
26
26
return false ;
27
27
}
28
28
if ( ! ( bid . params . hasOwnProperty ( 'publisherId' ) ) ) {
29
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : missing publisherId : siteId, placementId and publisherId are REQUIRED' ) ;
29
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : missing publisherId : siteId, placementId and publisherId are REQUIRED' ) ;
30
30
return false ;
31
31
}
32
32
if ( ! ( bid . params . publisherId ) . toString ( ) . match ( / ^ [ a - z A - Z 0 - 9 \- ] { 12 } $ / ) ) {
33
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : publisherId must be exactly 12 alphanumieric characters including hyphens' ) ;
33
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : publisherId must be exactly 12 alphanumieric characters including hyphens' ) ;
34
34
return false ;
35
35
}
36
36
if ( ! ( bid . params . hasOwnProperty ( 'siteId' ) ) ) {
37
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : missing siteId : siteId, placementId and publisherId are REQUIRED' ) ;
37
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : missing siteId : siteId, placementId and publisherId are REQUIRED' ) ;
38
38
return false ;
39
39
}
40
40
if ( ! ( bid . params . siteId ) . toString ( ) . match ( / ^ [ 0 - 9 ] { 10 } $ / ) ) {
41
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : siteId must be exactly 10 numeric characters' ) ;
41
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : siteId must be exactly 10 numeric characters' ) ;
42
42
return false ;
43
43
}
44
44
if ( bid . params . hasOwnProperty ( 'customData' ) ) {
45
45
if ( typeof bid . params . customData !== 'object' ) {
46
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : customData is not an object' ) ;
46
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : customData is not an object' ) ;
47
47
return false ;
48
48
}
49
49
}
50
50
if ( bid . params . hasOwnProperty ( 'customParams' ) ) {
51
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : customParams should be renamed to customData' ) ;
51
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : customParams should be renamed to customData' ) ;
52
52
return false ;
53
53
}
54
54
if ( bid . params . hasOwnProperty ( 'ozoneData' ) ) {
55
55
if ( typeof bid . params . ozoneData !== 'object' ) {
56
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : ozoneData is not an object' ) ;
56
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : ozoneData is not an object' ) ;
57
57
return false ;
58
58
}
59
59
}
60
60
if ( bid . params . hasOwnProperty ( 'lotameData' ) ) {
61
61
if ( typeof bid . params . lotameData !== 'object' ) {
62
- utils . logInfo ( 'OZONE BID ADAPTER VALIDATION FAILED : lotameData is not an object' ) ;
62
+ utils . logInfo ( 'OZONE: OZONE BID ADAPTER VALIDATION FAILED : lotameData is not an object' ) ;
63
63
return false ;
64
64
}
65
65
}
66
66
return true ;
67
67
} ,
68
68
buildRequests ( validBidRequests , bidderRequest ) {
69
- utils . logInfo ( 'ozone v' + OZONEVERSION + ' validBidRequests' , validBidRequests , 'bidderRequest' , bidderRequest ) ;
70
- utils . logInfo ( 'buildRequests setting auctionId' , bidderRequest . auctionId ) ;
69
+ utils . logInfo ( 'OZONE: ozone v' + OZONEVERSION + ' validBidRequests' , validBidRequests , 'bidderRequest' , bidderRequest ) ;
70
+ utils . logInfo ( 'OZONE: buildRequests setting auctionId' , bidderRequest . auctionId ) ;
71
71
let singleRequest = config . getConfig ( 'ozone.singleRequest' ) ;
72
+
72
73
singleRequest = singleRequest !== false ; // undefined & true will be true
73
- utils . logInfo ( 'config ozone.singleRequest : ' , singleRequest ) ;
74
+ utils . logInfo ( 'OZONE: config ozone.singleRequest : ' , singleRequest ) ;
74
75
let htmlParams = validBidRequests [ 0 ] . params ; // the html page config params will be included in each element
75
76
let ozoneRequest = { } ; // we only want to set specific properties on this, not validBidRequests[0].params
76
77
// ozoneRequest['id'] = utils.generateUUID();
77
78
78
79
delete ozoneRequest . test ; // don't allow test to be set in the config - ONLY use $_GET['pbjs_debug']
79
80
if ( bidderRequest . gdprConsent ) {
81
+ utils . logInfo ( 'OZONE: ADDING GDPR info' ) ;
80
82
ozoneRequest . regs = { } ;
81
83
ozoneRequest . regs . ext = { } ;
82
84
ozoneRequest . regs . ext . gdpr = bidderRequest . gdprConsent . gdprApplies === true ? 1 : 0 ;
83
85
if ( ozoneRequest . regs . ext . gdpr ) {
84
- ozoneRequest . regs . ext . consent = bidderRequest . gdprConsent . consentString ;
86
+ ozoneRequest . user = { } ;
87
+ ozoneRequest . user . ext = { 'consent' : bidderRequest . gdprConsent . consentString } ;
85
88
}
89
+ } else {
90
+ utils . logInfo ( 'OZONE: WILL NOT ADD GDPR info' ) ;
86
91
}
92
+ ozoneRequest . device = { 'w' : window . innerWidth , 'h' : window . innerHeight } ;
87
93
let tosendtags = validBidRequests . map ( ozoneBidRequest => {
88
94
var obj = { } ;
89
95
obj . id = ozoneBidRequest . bidId ; // this causes a failure if we change it to something else
@@ -95,25 +101,25 @@ export const spec = {
95
101
/* NOTE - if there is sizes element in the config root then there will be a mediaTypes.banner element automatically generated for us, so this code is deprecated */
96
102
if ( ! ozoneBidRequest . hasOwnProperty ( 'mediaTypes' ) ) {
97
103
if ( ozoneBidRequest . hasOwnProperty ( 'sizes' ) ) {
98
- utils . logInfo ( 'no mediaTypes detected - will use the sizes array in the config root' ) ;
104
+ utils . logInfo ( 'OZONE: no mediaTypes detected - will use the sizes array in the config root' ) ;
99
105
arrBannerSizes = ozoneBidRequest . sizes ;
100
106
} else {
101
- utils . logInfo ( 'no mediaTypes detected, no sizes array in the config root either. Cannot set sizes for banner type' ) ;
107
+ utils . logInfo ( 'OZONE: no mediaTypes detected, no sizes array in the config root either. Cannot set sizes for banner type' ) ;
102
108
}
103
109
} else {
104
110
if ( ozoneBidRequest . mediaTypes . hasOwnProperty ( BANNER ) ) {
105
111
arrBannerSizes = ozoneBidRequest . mediaTypes [ BANNER ] . sizes ; /* Note - if there is a sizes element in the config root it will be pushed into here */
106
- utils . logInfo ( 'setting banner size from the mediaTypes.banner element for bidId ' + obj . id + ': ' , arrBannerSizes ) ;
112
+ utils . logInfo ( 'OZONE: setting banner size from the mediaTypes.banner element for bidId ' + obj . id + ': ' , arrBannerSizes ) ;
107
113
}
108
114
// Video integration is not complete yet
109
115
if ( ozoneBidRequest . mediaTypes . hasOwnProperty ( VIDEO ) ) {
110
116
obj . video = ozoneBidRequest . mediaTypes [ VIDEO ] ;
111
- utils . logInfo ( 'setting video object from the mediaTypes.video element: ' + obj . id + ':' , obj . video ) ;
117
+ utils . logInfo ( 'OZONE: setting video object from the mediaTypes.video element: ' + obj . id + ':' , obj . video ) ;
112
118
}
113
119
// Native integration is not complete yet
114
120
if ( ozoneBidRequest . mediaTypes . hasOwnProperty ( NATIVE ) ) {
115
121
obj . native = ozoneBidRequest . mediaTypes [ NATIVE ] ;
116
- utils . logInfo ( 'setting native object from the mediaTypes.native element: ' + obj . id + ':' , obj . native ) ;
122
+ utils . logInfo ( 'OZONE: setting native object from the mediaTypes.native element: ' + obj . id + ':' , obj . native ) ;
117
123
}
118
124
}
119
125
// build the banner request using banner sizes we found in either possible location:
@@ -127,15 +133,10 @@ export const spec = {
127
133
} )
128
134
} ;
129
135
}
130
- if ( ozoneBidRequest . params . hasOwnProperty ( 'placementId' ) ) {
131
- obj . placementId = ( ozoneBidRequest . params . placementId ) . toString ( ) ;
132
- }
133
- if ( ozoneBidRequest . params . hasOwnProperty ( 'publisherId' ) ) {
134
- obj . publisherId = ( ozoneBidRequest . params . publisherId ) . toString ( ) ;
135
- }
136
- if ( ozoneBidRequest . params . hasOwnProperty ( 'siteId' ) ) {
137
- obj . siteId = ( ozoneBidRequest . params . siteId ) . toString ( ) ;
138
- }
136
+ // these 3 MUST exist - we check them in the validation method
137
+ obj . placementId = ( ozoneBidRequest . params . placementId ) . toString ( ) ;
138
+ obj . publisherId = ( ozoneBidRequest . params . publisherId ) . toString ( ) ;
139
+ obj . siteId = ( ozoneBidRequest . params . siteId ) . toString ( ) ;
139
140
// build the imp['ext'] object
140
141
obj . ext = { 'prebid' : { 'storedrequest' : { 'id' : ( ozoneBidRequest . params . placementId ) . toString ( ) } } , 'ozone' : { } } ;
141
142
obj . ext . ozone . adUnitCode = ozoneBidRequest . adUnitCode ; // eg. 'mpu'
@@ -161,7 +162,7 @@ export const spec = {
161
162
// utils.logInfo('_ozoneInternal is', _ozoneInternal);
162
163
// return the single request object OR the array:
163
164
if ( singleRequest ) {
164
- utils . logInfo ( 'buildRequests starting to generate response for a single request' ) ;
165
+ utils . logInfo ( 'OZONE: buildRequests starting to generate response for a single request' ) ;
165
166
ozoneRequest . id = bidderRequest . auctionId ; // Unique ID of the bid request, provided by the exchange.
166
167
ozoneRequest . auctionId = bidderRequest . auctionId ; // not sure if this should be here?
167
168
ozoneRequest . imp = tosendtags ;
@@ -172,29 +173,29 @@ export const spec = {
172
173
data : JSON . stringify ( ozoneRequest ) ,
173
174
bidderRequest : bidderRequest
174
175
} ;
175
- utils . logInfo ( 'buildRequests ozoneRequest for single = ' , ozoneRequest ) ;
176
- utils . logInfo ( 'buildRequests going to return for single: ' , ret ) ;
176
+ utils . logInfo ( 'OZONE: buildRequests ozoneRequest for single = ' , ozoneRequest ) ;
177
+ utils . logInfo ( 'OZONE: buildRequests going to return for single: ' , ret ) ;
177
178
return ret ;
178
179
}
179
180
180
181
// not single request - pull apart the tosendtags array & return an array of objects each containing one element in the imp array.
181
182
let arrRet = tosendtags . map ( imp => {
182
- utils . logInfo ( 'buildRequests starting to generate non-single response, working on imp : ' , imp ) ;
183
+ utils . logInfo ( 'OZONE: buildRequests starting to generate non-single response, working on imp : ' , imp ) ;
183
184
let ozoneRequestSingle = Object . assign ( { } , ozoneRequest ) ;
184
185
imp . ext . ozone . pageAuctionId = bidderRequest [ 'auctionId' ] ; // make a note in the ext object of what the original auctionId was, in the bidderRequest object
185
186
ozoneRequestSingle . id = imp . ext . ozone . transactionId ; // Unique ID of the bid request, provided by the exchange.
186
187
ozoneRequestSingle . auctionId = imp . ext . ozone . transactionId ; // not sure if this should be here?
187
188
ozoneRequestSingle . imp = [ imp ] ;
188
189
ozoneRequestSingle . source = { 'tid' : imp . ext . ozone . transactionId } ;
189
- utils . logInfo ( 'buildRequests ozoneRequestSingle (for non-single) = ' , ozoneRequestSingle ) ;
190
+ utils . logInfo ( 'OZONE: buildRequests ozoneRequestSingle (for non-single) = ' , ozoneRequestSingle ) ;
190
191
return {
191
192
method : 'POST' ,
192
193
url : OZONEURI ,
193
194
data : JSON . stringify ( ozoneRequestSingle ) ,
194
195
bidderRequest : bidderRequest
195
196
} ;
196
197
} ) ;
197
- utils . logInfo ( 'buildRequests going to return for non-single: ' , arrRet ) ;
198
+ utils . logInfo ( 'OZONE: buildRequests going to return for non-single: ' , arrRet ) ;
198
199
return arrRet ;
199
200
} ,
200
201
/**
@@ -205,7 +206,7 @@ export const spec = {
205
206
* @returns {* }
206
207
*/
207
208
interpretResponse ( serverResponse , request ) {
208
- utils . logInfo ( 'ozone v ' + OZONEVERSION + ' interpretResponse' , serverResponse , request ) ;
209
+ utils . logInfo ( 'OZONE: version ' + OZONEVERSION + ' interpretResponse' , serverResponse , request ) ;
209
210
serverResponse = serverResponse . body || { } ;
210
211
if ( serverResponse . seatbid ) {
211
212
if ( utils . isArray ( serverResponse . seatbid ) ) {
@@ -219,19 +220,19 @@ export const spec = {
219
220
let { seat : winningSeat , bid : winningBid } = ozoneGetWinnerForRequestBid ( thisBid , serverResponse . seatbid ) ;
220
221
221
222
if ( winningBid == null ) {
222
- utils . logInfo ( 'FAILED to get winning bid for bid : ' , thisBid , 'will skip. Possibly a non-single request, which will be missing some bid IDs' ) ;
223
+ utils . logInfo ( 'OZONE: FAILED to get winning bid for bid : ' , thisBid , 'will skip. Possibly a non-single request, which will be missing some bid IDs' ) ;
223
224
continue ;
224
225
}
225
226
226
227
const { defaultWidth, defaultHeight} = defaultSize ( arrRequestBids [ i ] ) ;
227
228
winningBid = ozoneAddStandardProperties ( winningBid , defaultWidth , defaultHeight ) ;
228
229
229
- utils . logInfo ( 'Going to add the adserverTargeting custom parameters for key: ' , ozoneInternalKey ) ;
230
+ utils . logInfo ( 'OZONE: Going to add the adserverTargeting custom parameters for key: ' , ozoneInternalKey ) ;
230
231
let adserverTargeting = { } ;
231
232
let allBidsForThisBidid = ozoneGetAllBidsForBidId ( ozoneInternalKey , serverResponse . seatbid ) ;
232
233
// add all the winning & non-winning bids for this bidId:
233
234
Object . keys ( allBidsForThisBidid ) . forEach ( function ( bidderName , index , ar2 ) {
234
- utils . logInfo ( 'inside allBidsForThisBidid:foreach' , bidderName , index , ar2 , allBidsForThisBidid ) ;
235
+ utils . logInfo ( 'OZONE: inside allBidsForThisBidid:foreach' , bidderName , index , ar2 , allBidsForThisBidid ) ;
235
236
adserverTargeting [ 'oz_' + bidderName ] = bidderName ;
236
237
adserverTargeting [ 'oz_' + bidderName + '_pb' ] = String ( allBidsForThisBidid [ bidderName ] . price ) ;
237
238
adserverTargeting [ 'oz_' + bidderName + '_crid' ] = String ( allBidsForThisBidid [ bidderName ] . crid ) ;
@@ -246,14 +247,14 @@ export const spec = {
246
247
adserverTargeting [ 'oz_response_id' ] = String ( serverResponse . id ) ;
247
248
248
249
winningBid . adserverTargeting = adserverTargeting ;
249
- utils . logInfo ( 'winner is' , winningBid ) ;
250
+ utils . logInfo ( 'OZONE: winner is' , winningBid ) ;
250
251
arrWinners . push ( winningBid ) ;
251
- utils . logInfo ( 'arrWinners is' , arrWinners ) ;
252
+ utils . logInfo ( 'OZONE: arrWinners is' , arrWinners ) ;
252
253
}
253
254
let winnersClean = arrWinners . filter ( w => {
254
255
return ( w . bidId ) ; // will be cast to boolean
255
256
} ) ;
256
- utils . logInfo ( 'going to return winnersClean:' , winnersClean ) ;
257
+ utils . logInfo ( 'OZONE: going to return winnersClean:' , winnersClean ) ;
257
258
return winnersClean ;
258
259
} else {
259
260
return [ ] ;
@@ -326,7 +327,7 @@ export function ozoneGetWinnerForRequestBid(requestBid, serverResponseSeatBid) {
326
327
* @returns { } = {ozone:{obj}, appnexus:{obj}, ... }
327
328
*/
328
329
export function ozoneGetAllBidsForBidId ( matchBidId , serverResponseSeatBid ) {
329
- utils . logInfo ( 'ozoneGetAllBidsForBidId - starting, with: ' , matchBidId , serverResponseSeatBid ) ;
330
+ utils . logInfo ( 'OZONE: ozoneGetAllBidsForBidId - starting, with: ' , matchBidId , serverResponseSeatBid ) ;
330
331
let objBids = { } ;
331
332
for ( let j = 0 ; j < serverResponseSeatBid . length ; j ++ ) {
332
333
let theseBids = serverResponseSeatBid [ j ] . bid ;
@@ -338,7 +339,7 @@ export function ozoneGetAllBidsForBidId(matchBidId, serverResponseSeatBid) {
338
339
}
339
340
}
340
341
}
341
- utils . logInfo ( 'ozoneGetAllBidsForBidId - going to return: ' , objBids ) ;
342
+ utils . logInfo ( 'OZONE: ozoneGetAllBidsForBidId - going to return: ' , objBids ) ;
342
343
return objBids ;
343
344
}
344
345
@@ -379,4 +380,4 @@ export function getTestQuerystringValue() {
379
380
}
380
381
381
382
registerBidder ( spec ) ;
382
- utils . logInfo ( 'ozoneBidAdapter ended' ) ;
383
+ utils . logInfo ( 'OZONE: ozoneBidAdapter ended' ) ;
0 commit comments