diff --git a/public/index.html b/public/index.html index aa069f2..12c9ff8 100644 --- a/public/index.html +++ b/public/index.html @@ -24,8 +24,16 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + RouterArena + + +
diff --git a/src/App.tsx b/src/App.tsx index a924740..0ae2848 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,13 +5,11 @@ import Header from './components/Header'; import HomePage from './pages/HomePage'; import LeaderboardPage from './pages/LeaderboardPage'; import SubmitPromptPage from './pages/SubmitPromptPage'; -import GoogleAnalytics from './components/GoogleAnalytics'; const App: React.FC = () => { return (
-
diff --git a/src/components/GoogleAnalytics.tsx b/src/components/GoogleAnalytics.tsx deleted file mode 100644 index 77ff3d4..0000000 --- a/src/components/GoogleAnalytics.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { useEffect } from 'react'; -import { useLocation } from 'react-router-dom'; - -const GA_MEASUREMENT_ID = 'G-CFZYZLHP5X'; - -const GoogleAnalytics: React.FC = () => { - const location = useLocation(); - - useEffect(() => { - // Load Google Analytics script - const script1 = document.createElement('script'); - script1.async = true; - script1.src = `https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`; - document.head.appendChild(script1); - - // Initialize dataLayer and gtag function - window.dataLayer = window.dataLayer || []; - function gtag(...args: any[]) { - window.dataLayer.push(args); - } - window.gtag = gtag; - - gtag('js', new Date()); - gtag('config', GA_MEASUREMENT_ID, { - page_path: window.location.pathname, - }); - }, []); - - useEffect(() => { - // Track page view on route change - if (window.gtag) { - window.gtag('config', GA_MEASUREMENT_ID, { - page_path: location.pathname + location.search, - }); - } - }, [location]); - - return null; -}; - -export default GoogleAnalytics;