app-MAIL-temp/static/js/an.js

30 lines
1,009 B
JavaScript
Raw Permalink Normal View History

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
// <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;
plausibleScript.dataset.api = "/p/api/event";
plausibleScript.dataset.domain = "app.simplelogin.io,everything.simplelogin.com";
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
// allow custom event
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }
2020-12-28 16:30:44 +01:00
})();