Adding feature to use url params to temp or permanently disable umami

pull/801/head
Pat 2021-09-28 05:33:47 -07:00
parent 9b1a75fd90
commit 21f0ad2b78
1 changed files with 5 additions and 0 deletions

View File

@ -24,9 +24,14 @@ import { removeTrailingSlash } from '../lib/url';
const useCache = attr('data-cache');
const domains = attr('data-domains');
const getURLParameter = (name) => {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
}
const disableTracking =
localStorage.getItem('umami.disabled') ||
(dnt && doNotTrack()) ||
getURLParameter("dnt") != null
(domains &&
!domains
.split(',')