Skip to content

Commit 7a2e0e2

Browse files
committed
Admatic Bid Adapter: alias and bid floor features activated
1 parent 7a845b7 commit 7a2e0e2

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

modules/admaticBidAdapter.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { getValue, logError, deepAccess, getBidIdParameter, isArray } from '../s
22
import { loadExternalScript } from '../src/adloader.js';
33
import { registerBidder } from '../src/adapters/bidderFactory.js';
44
import { BANNER, VIDEO } from '../src/mediaTypes.js';
5-
6-
const ENDPOINT_URL = 'https://layer.serve.admatic.com.tr/pb';
75
const SYNC_URL = 'https://cdn.serve.admatic.com.tr/showad/sync.js';
8-
const BIDDER_CODE = 'admatic';
96

107
export const spec = {
118
code: 'admatic',
9+
aliases: [
10+
{code: 'adpixel'}
11+
],
1212
supportedMediaTypes: ['video', 'banner'],
1313
/**
1414
* Determines whether or not the given bid request is valid.
@@ -20,11 +20,12 @@ export const spec = {
2020
let isValid = false;
2121
if (typeof bid.params !== 'undefined') {
2222
let isValidNetworkId = _validateId(getValue(bid.params, 'networkId'));
23-
isValid = isValidNetworkId;// && isValidTypeId;
23+
let isValidHost = getValue(bid.params, 'host');
24+
isValid = isValidNetworkId && isValidHost;
2425
}
2526

2627
if (!isValid) {
27-
logError('AdMatic networkId parameters are required. Bid aborted.');
28+
logError(`${bid.bidder} networkId and host parameters are required. Bid aborted.`);
2829
}
2930
return isValid;
3031
},
@@ -36,11 +37,13 @@ export const spec = {
3637
*/
3738
buildRequests: function(validBidRequests, bidderRequest) {
3839
const bids = validBidRequests.map(buildRequestObject);
40+
const bidderName = validBidRequests[0].bidder;
3941
const networkId = getValue(validBidRequests[0].params, 'networkId');
42+
const host = getValue(validBidRequests[0].params, 'host');
4043
const currency = getValue(validBidRequests[0].params, 'currency') || 'TRY';
4144

4245
setTimeout(() => {
43-
loadExternalScript(SYNC_URL, BIDDER_CODE);
46+
loadExternalScript(SYNC_URL, bidderName);
4447
}, bidderRequest.timeout);
4548

4649
const payload = {
@@ -59,14 +62,14 @@ export const spec = {
5962
imp: bids,
6063
ext: {
6164
'cur': currency,
62-
'type': 'admatic'
65+
'bidder': bidderName
6366
}
6467
};
6568

6669
const payloadString = JSON.stringify(payload);
6770
return {
6871
method: 'POST',
69-
url: ENDPOINT_URL,
72+
url: `https://${host}/pb?bidder=${bidderName}`,
7073
data: payloadString,
7174
options: {
7275
contentType: 'application/json'
@@ -97,7 +100,7 @@ export const spec = {
97100
advertiserDomains: bid && bid.adomain ? bid.adomain : []
98101
},
99102
ttl: 360,
100-
bidder: 'admatic',
103+
bidder: JSON.parse(request.data).ext.bidder,
101104
timeToRespond: 1,
102105
requestTimestamp: 1
103106
};
@@ -109,6 +112,8 @@ export const spec = {
109112
}
110113
};
111114

115+
registerBidder(spec);
116+
112117
function enrichSlotWithFloors(slot, bidRequest) {
113118
try {
114119
const slotFloors = {};

modules/admaticBidAdapter.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Use `admatic` as bidder.
1818
bids: [{
1919
bidder: 'admatic',
2020
params: {
21-
networkId: 12345
21+
networkId: 12345,
22+
host: 'layer.serve.admatic.com.tr'
2223
}
2324
}]
2425
},{
@@ -27,14 +28,14 @@ Use `admatic` as bidder.
2728
bids: [{
2829
bidder: 'admatic',
2930
params: {
30-
networkId: 12345
31+
networkId: 12345,
32+
host: 'layer.serve.admatic.com.tr'
3133
}
3234
}]
3335
}];
3436
```
3537

3638
## UserSync example
37-
3839
```
3940
pbjs.setConfig({
4041
userSync: {

src/adloader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const _approvedLoadExternalJSList = [
77
'debugging',
88
'adloox',
99
'admatic',
10+
'adpixel',
1011
'criteo',
1112
'outstream',
1213
'adagio',

0 commit comments

Comments
 (0)