forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathswanIdSystem.js
44 lines (40 loc) · 1.08 KB
/
swanIdSystem.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
/**
* This module adds swanId to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/swanIdSystem
* @requires module:modules/userId
*/
import {submodule} from '../src/hook.js';
/** @type {Submodule} */
export const swanIdSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: 'swanId',
/**
* decode the stored id value for passing to bid requests
* @function decode
* @param {(Object|string)} value
* @returns {(Object|undefined)}
*/
decode(id) {
return { swanId: id };
},
/**
* performs action to obtain id and return a value in the callback's response argument
* @function
* @param {SubmoduleConfig} [config]
* @param {ConsentData} [consentData]
* @param {(Object|undefined)} cacheIdObj
* @returns {IdResponse|undefined}
*/
getId(config, consentData) {
if (config && config.params && config.params.id) {
return {'id': config.params.id};
} else {
return undefined
}
}
};
submodule('userId', swanIdSubmodule);