@@ -2,13 +2,13 @@ import { getValue, logError, deepAccess, getBidIdParameter, isArray } from '../s
2
2
import { loadExternalScript } from '../src/adloader.js' ;
3
3
import { registerBidder } from '../src/adapters/bidderFactory.js' ;
4
4
import { BANNER , VIDEO } from '../src/mediaTypes.js' ;
5
-
6
- const ENDPOINT_URL = 'https://layer.serve.admatic.com.tr/pb' ;
7
5
const SYNC_URL = 'https://cdn.serve.admatic.com.tr/showad/sync.js' ;
8
- const BIDDER_CODE = 'admatic' ;
9
6
10
7
export const spec = {
11
8
code : 'admatic' ,
9
+ aliases : [
10
+ { code : 'adpixel' }
11
+ ] ,
12
12
supportedMediaTypes : [ 'video' , 'banner' ] ,
13
13
/**
14
14
* Determines whether or not the given bid request is valid.
@@ -20,11 +20,12 @@ export const spec = {
20
20
let isValid = false ;
21
21
if ( typeof bid . params !== 'undefined' ) {
22
22
let isValidNetworkId = _validateId ( getValue ( bid . params , 'networkId' ) ) ;
23
- isValid = isValidNetworkId ; // && isValidTypeId;
23
+ let isValidHost = getValue ( bid . params , 'host' ) ;
24
+ isValid = isValidNetworkId && isValidHost ;
24
25
}
25
26
26
27
if ( ! isValid ) {
27
- logError ( 'AdMatic networkId parameters are required. Bid aborted.' ) ;
28
+ logError ( ` ${ bid . bidder } networkId and host parameters are required. Bid aborted.` ) ;
28
29
}
29
30
return isValid ;
30
31
} ,
@@ -36,11 +37,13 @@ export const spec = {
36
37
*/
37
38
buildRequests : function ( validBidRequests , bidderRequest ) {
38
39
const bids = validBidRequests . map ( buildRequestObject ) ;
40
+ const bidderName = validBidRequests [ 0 ] . bidder ;
39
41
const networkId = getValue ( validBidRequests [ 0 ] . params , 'networkId' ) ;
42
+ const host = getValue ( validBidRequests [ 0 ] . params , 'host' ) ;
40
43
const currency = getValue ( validBidRequests [ 0 ] . params , 'currency' ) || 'TRY' ;
41
44
42
45
setTimeout ( ( ) => {
43
- loadExternalScript ( SYNC_URL , BIDDER_CODE ) ;
46
+ loadExternalScript ( SYNC_URL , bidderName ) ;
44
47
} , bidderRequest . timeout ) ;
45
48
46
49
const payload = {
@@ -59,14 +62,14 @@ export const spec = {
59
62
imp : bids ,
60
63
ext : {
61
64
'cur' : currency ,
62
- 'type ' : 'admatic'
65
+ 'bidder ' : bidderName
63
66
}
64
67
} ;
65
68
66
69
const payloadString = JSON . stringify ( payload ) ;
67
70
return {
68
71
method : 'POST' ,
69
- url : ENDPOINT_URL ,
72
+ url : `https:// ${ host } /pb?bidder= ${ bidderName } ` ,
70
73
data : payloadString ,
71
74
options : {
72
75
contentType : 'application/json'
@@ -97,7 +100,7 @@ export const spec = {
97
100
advertiserDomains : bid && bid . adomain ? bid . adomain : [ ]
98
101
} ,
99
102
ttl : 360 ,
100
- bidder : 'admatic' ,
103
+ bidder : JSON . parse ( request . data ) . ext . bidder ,
101
104
timeToRespond : 1 ,
102
105
requestTimestamp : 1
103
106
} ;
@@ -109,6 +112,8 @@ export const spec = {
109
112
}
110
113
} ;
111
114
115
+ registerBidder ( spec ) ;
116
+
112
117
function enrichSlotWithFloors ( slot , bidRequest ) {
113
118
try {
114
119
const slotFloors = { } ;
0 commit comments