mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:38:25 +01:00
add DNT to matomo
This commit is contained in:
parent
a96c2e2ab3
commit
36d0b26b0c
1 changed files with 36 additions and 1 deletions
|
@ -1825,6 +1825,40 @@ window.addEventListener("unload", cleanup)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
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 || [];
|
var _paq = window._paq = window._paq || [];
|
||||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||||
_paq.push(["setDocumentTitle", anondocumenttitle(document.domain, 5) + "/" + anondocumenttitle(document.title, 5)]);
|
_paq.push(["setDocumentTitle", anondocumenttitle(document.domain, 5) + "/" + anondocumenttitle(document.title, 5)]);
|
||||||
|
@ -1839,6 +1873,7 @@ window.addEventListener("unload", cleanup)
|
||||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
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);
|
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
})();
|
})();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<noscript><p><img src="//data.poketube.fun/matomo.php?idsite=2&rec=1" style="border:0;" alt="" /></p></noscript>
|
<noscript><p><img src="//data.poketube.fun/matomo.php?idsite=2&rec=1" style="border:0;" alt="" /></p></noscript>
|
||||||
<!-- End Matomo Code -->
|
<!-- End Matomo Code -->
|
||||||
|
|
Loading…
Reference in a new issue