mirror of
https://github.com/kremalicious/umami.git
synced 2024-09-27 11:48:48 +02:00
commit
30c84dd54a
12
lib/web.js
12
lib/web.js
@ -46,3 +46,15 @@ export const hook = (_this, method, callback) => {
|
|||||||
return orig.apply(_this, args);
|
return orig.apply(_this, args);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const doNotTrack = () => {
|
||||||
|
if (window.doNotTrack || navigator.doNotTrack || navigator.msDoNotTrack || 'msTrackingProtectionEnabled' in window.external) {
|
||||||
|
if (window.doNotTrack == "1" || navigator.doNotTrack == "yes" || navigator.doNotTrack == "1" || navigator.msDoNotTrack == "1" || window.external.msTrackingProtectionEnabled()) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
import 'promise-polyfill/src/polyfill';
|
import 'promise-polyfill/src/polyfill';
|
||||||
import 'unfetch/polyfill';
|
import 'unfetch/polyfill';
|
||||||
import { post, hook } from '../lib/web';
|
import { post, hook, doNotTrack } from '../lib/web';
|
||||||
|
|
||||||
(window => {
|
(window => {
|
||||||
const {
|
const {
|
||||||
@ -13,7 +13,7 @@ import { post, hook } from '../lib/web';
|
|||||||
|
|
||||||
const script = document.querySelector('script[data-website-id]');
|
const script = document.querySelector('script[data-website-id]');
|
||||||
|
|
||||||
if (!script) return;
|
if (!script || doNotTrack()) return;
|
||||||
|
|
||||||
const website = script.getAttribute('data-website-id');
|
const website = script.getAttribute('data-website-id');
|
||||||
const hostUrl = new URL(script.src).origin;
|
const hostUrl = new URL(script.src).origin;
|
||||||
|
Loading…
Reference in New Issue
Block a user