-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
adprimeBidAdapter.js
46 lines (38 loc) · 1.51 KB
/
adprimeBidAdapter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { getAllOrtbKeywords } from '../libraries/keywords/keywords.js';
import {
isBidRequestValid,
buildRequestsBase,
interpretResponse,
getUserSyncs,
buildPlacementProcessingFunction
} from '../libraries/teqblazeUtils/bidderUtils.js';
const BIDDER_CODE = 'adprime';
const AD_URL = 'https://delta.adprime.com/pbjs';
const SYNC_URL = 'https://sync.adprime.com';
const addCustomFieldsToPlacement = (bid, bidderRequest, placement) => {
if (placement.adFormat === VIDEO) {
placement.wPlayer = placement.playerSize?.[0]?.[0];
placement.hPlayer = placement.playerSize?.[0]?.[1];
}
if (bid.userId && bid.userId.idl_env) {
placement.identeties = {};
placement.identeties.identityLink = bid.userId.idl_env;
}
placement.keywords = getAllOrtbKeywords(bidderRequest.ortb2, bid.params.keywords);
placement.audiences = bid.params.audiences || [];
};
const placementProcessingFunction = buildPlacementProcessingFunction({ addCustomFieldsToPlacement });
const buildRequests = (validBidRequests = [], bidderRequest = {}) => {
return buildRequestsBase({ adUrl: AD_URL, validBidRequests, bidderRequest, placementProcessingFunction });
};
export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
isBidRequestValid: isBidRequestValid(['placementId']),
buildRequests,
interpretResponse,
getUserSyncs: getUserSyncs(SYNC_URL)
};
registerBidder(spec);