Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 1x 1x 2x 1x 1x | const NOT_AVAILABLE = 'Unknown';
const addData = (
defaultParams: Record<string, unknown>,
userInput: Record<string, unknown>
): Record<string, unknown> => {
userInput.lang = getLanguage();
userInput.sr = getScreenResolution();
userInput.url = typeof window !== 'undefined' ? window.location.href : null;
userInput.r = typeof document !== 'undefined' ? document.referrer : null;
// override/remove user input for the following fields.
userInput.db = null;
userInput.dm = null;
userInput.os = null;
userInput.osv = null;
userInput.p = null;
userInput.web_host = null;
// user input should override default params
return Object.assign(defaultParams, userInput);
};
const getLanguage = (): string | null => {
Eif (typeof navigator !== 'undefined') {
return navigator.language || NOT_AVAILABLE;
}
return null;
};
const getScreenResolution = (): string | null => {
Eif (typeof screen !== 'undefined') {
return `${screen.width}x${screen.height}`;
}
return null;
};
export { addData, getLanguage, getScreenResolution };
|