mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Refactor do not track code.
This commit is contained in:
parent
fd0c22c09d
commit
0ba7676e97
3 changed files with 21 additions and 24 deletions
35
lib/web.js
35
lib/web.js
|
|
@ -48,26 +48,17 @@ export const hook = (_this, method, callback) => {
|
|||
};
|
||||
|
||||
export const doNotTrack = () => {
|
||||
if (
|
||||
window.doNotTrack ||
|
||||
navigator.doNotTrack ||
|
||||
navigator.msDoNotTrack ||
|
||||
(window.external && 'msTrackingProtectionEnabled' in window.external)
|
||||
) {
|
||||
if (
|
||||
window.doNotTrack == '1' ||
|
||||
navigator.doNotTrack == 'yes' ||
|
||||
navigator.doNotTrack == '1' ||
|
||||
navigator.msDoNotTrack == '1' ||
|
||||
(window.external &&
|
||||
window.external.msTrackingProtectionEnabled &&
|
||||
window.external.msTrackingProtectionEnabled())
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
const { doNotTrack, navigator, external } = window;
|
||||
|
||||
const msTracking = () => {
|
||||
return (
|
||||
external &&
|
||||
typeof external.msTrackingProtectionEnabled === 'function' &&
|
||||
external.msTrackingProtectionEnabled()
|
||||
);
|
||||
};
|
||||
|
||||
const dnt = doNotTrack || navigator.doNotTrack || navigator.msDoNotTrack || msTracking();
|
||||
|
||||
return dnt === true || dnt === 1 || dnt === 'yes' || dnt === '1';
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue