Switch to Simple Analytics
This commit is contained in:
parent
a5b38c775e
commit
d8da0ad17b
1 changed files with 34 additions and 40 deletions
|
@ -29,46 +29,6 @@
|
||||||
<!-- Release styles: bundled using purifycss from the dev sources -->
|
<!-- Release styles: bundled using purifycss from the dev sources -->
|
||||||
<link href="/css/bundle.css" rel="stylesheet" type="text/css">
|
<link href="/css/bundle.css" rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
<!-- Azure Application Insights -->
|
|
||||||
<script type='text/javascript'>
|
|
||||||
// Enables app insights IF AND ONLY IF user does not send a DNT request
|
|
||||||
// Shamelessly stolen from https://dev.to/spekulatius1984/how-to-check-do-not-track-dnt-in-javascript-57g1
|
|
||||||
let dntActive = () => {
|
|
||||||
// get the value from the various browser implementations.
|
|
||||||
let dnt_active = parseInt(
|
|
||||||
// Internet Explorer 9 and 10 vendor prefix
|
|
||||||
navigator.msDoNotTrack ||
|
|
||||||
|
|
||||||
// IE 11 uses window.doNotTrack
|
|
||||||
window.doNotTrack ||
|
|
||||||
|
|
||||||
// W3C
|
|
||||||
navigator.doNotTrack,
|
|
||||||
10
|
|
||||||
);
|
|
||||||
|
|
||||||
// If this comes to exactly 1 DNT is set.
|
|
||||||
return (dnt_active === 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if DNT is active.
|
|
||||||
if (dntActive()) {
|
|
||||||
// active
|
|
||||||
console.log("Azure Application Insights has been disabled due to user's Do Not Track request")
|
|
||||||
} else {
|
|
||||||
// inactive
|
|
||||||
console.log("Azure Application Insights is active")
|
|
||||||
var appInsights = window.appInsights || function (config) {
|
|
||||||
function r(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } }
|
|
||||||
var t = { config: config }, u = document, e = window, o = 'script', s = u.createElement(o), i, f; for (s.src = config.url || '//az416426.vo.msecnd.net/scripts/a/ai.0.js', u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = ['Event', 'Exception', 'Metric', 'PageView', 'Trace', 'Ajax']; i.length;)r('track' + i.pop()); return r('setAuthenticatedUserContext'), r('clearAuthenticatedUserContext'), config.disableExceptionTracking || (i = 'onerror', r('_' + i), f = e[i], e[i] = function (config, r, u, e, o) { var s = f && f(config, r, u, e, o); return s !== !0 && t['_' + i](config, r, u, e, o), s }), t
|
|
||||||
}({
|
|
||||||
instrumentationKey: '6a3cb8a6-9523-4f84-8237-915370d025ef'
|
|
||||||
});
|
|
||||||
|
|
||||||
window.appInsights = appInsights;
|
|
||||||
appInsights.trackPageView(null, null, { urlReferrer: document.referrer });
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="alert alert-dismissible alert-danger text-center">
|
<div class="alert alert-dismissible alert-danger text-center">
|
||||||
|
@ -156,5 +116,39 @@
|
||||||
|
|
||||||
<!-- Script Bundle: Custom -->
|
<!-- Script Bundle: Custom -->
|
||||||
<script src="/js/MillironX_CustomScripts.js" type="text/javascript"></script>
|
<script src="/js/MillironX_CustomScripts.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<!-- Simple Analytics -->
|
||||||
|
<script type='text/javascript'>
|
||||||
|
// Enables app insights IF AND ONLY IF user does not send a DNT request
|
||||||
|
// Shamelessly stolen from https://dev.to/spekulatius1984/how-to-check-do-not-track-dnt-in-javascript-57g1
|
||||||
|
let dntActive = () => {
|
||||||
|
// get the value from the various browser implementations.
|
||||||
|
let dnt_active = parseInt(
|
||||||
|
// Internet Explorer 9 and 10 vendor prefix
|
||||||
|
navigator.msDoNotTrack ||
|
||||||
|
|
||||||
|
// IE 11 uses window.doNotTrack
|
||||||
|
window.doNotTrack ||
|
||||||
|
|
||||||
|
// W3C
|
||||||
|
navigator.doNotTrack,
|
||||||
|
10
|
||||||
|
);
|
||||||
|
|
||||||
|
// If this comes to exactly 1 DNT is set.
|
||||||
|
return (dnt_active === 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if DNT is active.
|
||||||
|
if (dntActive()) {
|
||||||
|
// active
|
||||||
|
console.log("Simple Analytics has been disabled due to user's Do Not Track request")
|
||||||
|
} else {
|
||||||
|
// inactive
|
||||||
|
console.log("Simple Analytics is active")
|
||||||
|
document.write("<script async defer src=\"https://scripts.simpleanalyticscdn.com/latest.js\"><\/script>")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue