diff --git a/web/utils/umami.tsx b/web/utils/umami.tsx index ac9e703049..277ae12235 100644 --- a/web/utils/umami.tsx +++ b/web/utils/umami.tsx @@ -1,65 +1,31 @@ import { useEffect } from 'react' -import Script from 'next/script' - -// Define the type for the umami data object -interface UmamiData { - version: string -} - -declare global { - interface Window { - umami: - | { - track: (event: string, data?: UmamiData) => void - } - | undefined - } -} - const Umami = () => { - const appVersion = VERSION - const analyticsHost = ANALYTICS_HOST - const analyticsId = ANALYTICS_ID - useEffect(() => { - if (!appVersion || !analyticsHost || !analyticsId) return - const ping = () => { - // Check if umami is defined before ping - if (window.umami !== null && typeof window.umami !== 'undefined') { - window.umami.track(appVersion, { - version: appVersion, - }) - } - } - - // Wait for umami to be defined before ping - if (window.umami !== null && typeof window.umami !== 'undefined') { - ping() - } else { - // Listen for umami script load event - document.addEventListener('umami:loaded', ping) - } - - // Cleanup function to remove event listener if the component unmounts - return () => { - document.removeEventListener('umami:loaded', ping) - } - }, [appVersion, analyticsHost, analyticsId]) - - return ( - <> - {appVersion && analyticsHost && analyticsId && ( -