feat: add opt-in umami analytics (WIP)

This commit is contained in:
David Ralph
2021-06-21 17:42:14 +01:00
parent 4449957fe6
commit f7c39eeebb
23 changed files with 135 additions and 10 deletions

View File

@@ -10,6 +10,9 @@ import 'react-toastify/dist/ReactToastify.min.css';
import '@fontsource/lexend-deca/400.css';
// this is opt-in btw
import Analytics from './modules/helpers/analytics';
// language
import merge from '@material-ui/utils/esm/deepmerge';
@@ -36,6 +39,14 @@ if (window.languagecode !== 'en_GB' || window.languagecode !== 'en_US') {
}
window.constants = Constants;
if (localStorage.getItem('analytics') === 'true' && localStorage.getItem('offlineMode') !== 'true') {
window.analytics = new Analytics(window.constants.UMAMI_ID);
} else {
window.analytics = {
tabLoad: () => '',
postEvent: () => ''
}
}
ReactDOM.render(
<App/>,