diff --git a/src/App.js b/src/App.js index 4ed5a91..6a82da0 100644 --- a/src/App.js +++ b/src/App.js @@ -71,7 +71,7 @@ function trigger_download(name, data){ function UmamiLink({ href, name, target, children, ...props }) { const handleClick = useCallback(event => { - if (name) { + if (window.umami && name) { window.umami.trackEvent('A: ' + name) // Log Anker / Link } @@ -291,9 +291,11 @@ function App({ getString, locales, currentLocale, onLanguageChange }) { const frameName = frame.name || 'No-Frame' const hashtagName = hashtag.name || 'No-Hashtag' - window.umami.trackEvent('F: ' + frameName) // Log Frame - window.umami.trackEvent('H: ' + hashtagName) // Log Hashtag - window.umami.trackEvent('C: ' + [frameName, hashtagName].join(' | ')) // Log Combined + if (window.umami) { + window.umami.trackEvent('F: ' + frameName) // Log Frame + window.umami.trackEvent('H: ' + hashtagName) // Log Hashtag + window.umami.trackEvent('C: ' + [frameName, hashtagName].join(' | ')) // Log Combined + } }) } diff --git a/src/index.js b/src/index.js index fa4c933..5823f01 100644 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ function AppLanguageWrapper() { useEffect(() => { let systemLocales = navigator.languages - if (!!systemLocales || Array.isArray(systemLocales)) { + if (window.umami && (!!systemLocales || Array.isArray(systemLocales))) { for (const locale of systemLocales) { window.umami.trackEvent('L: ' + locale) // Log Locale / Languages }