-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathvidazooBidAdapter.js
57 lines (50 loc) · 1.79 KB
/
vidazooBidAdapter.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
47
48
49
50
51
52
53
54
55
56
57
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {getStorageManager} from '../src/storageManager.js';
import {
createSessionId,
isBidRequestValid,
getCacheOpt,
getNextDealId,
onBidWon,
createUserSyncGetter,
getVidazooSessionId,
createBuildRequestsFn,
createInterpretResponseFn
} from '../libraries/vidazooUtils/bidderUtils.js';
import {OPT_CACHE_KEY, OPT_TIME_KEY} from '../libraries/vidazooUtils/constants.js';
const GVLID = 744;
const DEFAULT_SUB_DOMAIN = 'prebid';
const BIDDER_CODE = 'vidazoo';
const BIDDER_VERSION = '1.0.0';
export const storage = getStorageManager({bidderCode: BIDDER_CODE});
export const webSessionId = createSessionId();
export function createDomain(subDomain = DEFAULT_SUB_DOMAIN) {
return `https://${subDomain}.cootlogix.com`;
}
function createUniqueRequestData(hashUrl) {
const dealId = getNextDealId(storage, hashUrl);
const sessionId = getVidazooSessionId(storage);
const ptrace = getCacheOpt(storage, OPT_CACHE_KEY);
const vdzhum = getCacheOpt(storage, OPT_TIME_KEY);
return {
dealId: dealId, sessionId: sessionId, ptrace: ptrace, vdzhum: vdzhum, webSessionId: webSessionId
};
}
const buildRequests = createBuildRequestsFn(createDomain, createUniqueRequestData, storage, BIDDER_CODE, BIDDER_VERSION, true);
const interpretResponse = createInterpretResponseFn(BIDDER_CODE, true);
const getUserSyncs = createUserSyncGetter({
iframeSyncUrl: 'https://sync.cootlogix.com/api/sync/iframe', imageSyncUrl: 'https://sync.cootlogix.com/api/sync/image'
});
export const spec = {
code: BIDDER_CODE,
version: BIDDER_VERSION,
gvlid: GVLID,
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid,
buildRequests,
interpretResponse,
getUserSyncs,
onBidWon
};
registerBidder(spec);