2020-12-28 16:30:44 +01:00
|
|
|
(function () {
|
|
|
|
// only enable on prod
|
|
|
|
if (!window.location.host.endsWith('simplelogin.io')) {
|
|
|
|
console.log("Analytics should only be enabled in prod");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (store.get('analytics-ignore') === 't') {
|
|
|
|
console.log("Analytics is disabled");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("init Analytics");
|
|
|
|
|
|
|
|
// Add Plausible script
|
2022-10-24 18:18:22 +02:00
|
|
|
// <script async defer data-domain="app.simplelogin.io,everything.simplelogin.com" src="/p.outbound.js"></script>
|
2020-12-28 16:30:44 +01:00
|
|
|
var plausibleScript = document.createElement('script');
|
|
|
|
plausibleScript.defer = 1;
|
|
|
|
plausibleScript.async = 1;
|
2022-10-24 18:18:22 +02:00
|
|
|
plausibleScript.dataset.api = "/p/api/event";
|
2022-10-14 10:38:43 +02:00
|
|
|
plausibleScript.dataset.domain = "app.simplelogin.io,everything.simplelogin.com";
|
2022-10-24 18:18:22 +02:00
|
|
|
plausibleScript.src = '/p.outbound.js';
|
2020-12-28 16:30:44 +01:00
|
|
|
|
|
|
|
var ins = document.getElementsByTagName('script')[0];
|
2022-02-03 11:18:10 +01:00
|
|
|
ins.parentNode.insertBefore(plausibleScript, ins);
|
2020-12-28 16:30:44 +01:00
|
|
|
|
2022-10-14 10:38:43 +02:00
|
|
|
// allow custom event
|
|
|
|
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }
|
|
|
|
|
2020-12-28 16:30:44 +01:00
|
|
|
})();
|