forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmgidXBidAdapter.js
35 lines (27 loc) · 1.03 KB
/
mgidXBidAdapter.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
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { isBidRequestValid, buildRequestsBase, interpretResponse } from '../libraries/teqblazeUtils/bidderUtils.js';
import { getUserSyncs } from '../libraries/mgidUtils/mgidUtils.js'
const BIDDER_CODE = 'mgidX';
const GVLID = 358;
const AD_URL = 'https://#{REGION}#.mgid.com/pbjs';
const buildRequests = (validBidRequests = [], bidderRequest = {}) => {
const request = buildRequestsBase({ adUrl: AD_URL, validBidRequests, bidderRequest });
const region = validBidRequests[0].params?.region;
if (region === 'eu') {
request.url = AD_URL.replace('#{REGION}#', 'eu-x');
} else {
request.url = AD_URL.replace('#{REGION}#', 'us-east-x');
}
return request;
};
export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
isBidRequestValid: isBidRequestValid(),
buildRequests,
interpretResponse,
getUserSyncs: getUserSyncs,
};
registerBidder(spec);