add DNT to matomo

This commit is contained in:
Ashley 2023-11-26 18:07:17 +00:00
parent a96c2e2ab3
commit 36d0b26b0c

View file

@ -1825,7 +1825,41 @@ window.addEventListener("unload", cleanup)
</script>
<script>
var _paq = window._paq = window._paq || [];
if (typeof Ashley === "undefined") {
var Ashley = {};
}
Ashley.dntEnabled = function (dnt, ua) {
"use strict";
var dntStatus =
dnt || navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
var userAgent = ua || navigator.userAgent;
var anomalousWinVersions = [
"Windows NT 6.1",
"Windows NT 6.2",
"Windows NT 6.3",
];
var fxMatch = userAgent.match(/Firefox\/(\d+)/);
var ieRegEx = /MSIE|Trident/i;
var isIE = ieRegEx.test(userAgent);
var platform = userAgent.match(/Windows.+?(?=;)/g);
if (isIE && typeof Array.prototype.indexOf !== "function") {
return false;
} else if (fxMatch && parseInt(fxMatch[1], 10) < 32) {
dntStatus = "Unspecified";
} else if (
isIE &&
platform &&
anomalousWinVersions.indexOf(platform.toString()) !== -1
) {
dntStatus = "Unspecified";
} else {
dntStatus = { 0: "Disabled", 1: "Enabled" }[dntStatus] || "Unspecified";
}
return dntStatus === "Enabled" ? true : false;
};
// only load if DNT is not enabled
if (Ashley && !Ashley.dntEnabled()) {
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", anondocumenttitle(document.domain, 5) + "/" + anondocumenttitle(document.title, 5)]);
_paq.push(["setDoNotTrack", true]);
@ -1839,6 +1873,7 @@ window.addEventListener("unload", cleanup)
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
}
</script>
<noscript><p><img src="//data.poketube.fun/matomo.php?idsite=2&amp;rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->