Skip to content

Commit

Permalink
fix: added app tsx file
Browse files Browse the repository at this point in the history
  • Loading branch information
poonamjain96 committed Aug 30, 2024
1 parent f6b0194 commit 9b4383e
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions WebpageRevamped/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
import './App.css';
import Home from "./components/home/Home";
import {useEffect} from "react";
import ReactGA from 'react-ga4';
import Home from './components/home/Home';
import useGoogleAnalytics from './hooks/useGoogleAnalytics';

function App() {
const trackingId = process.env.REACT_APP_GOOGLE_ANALYTICS_TOKEN;

useEffect(() => {
if (trackingId) {
// Initialize Google Analytics using the tracking ID from environment variables
ReactGA.initialize(trackingId);

// Track the initial page load
ReactGA.send('pageview');
} else {
console.warn('Google Analytics tracking ID is not set.');
}
}, []);// The empty dependency array ensures this runs once on mount

return (
<Home/>
);
const trackingId = process.env.REACT_APP_GOOGLE_ANALYTICS_TOKEN;
useGoogleAnalytics(trackingId);
return (
<Home/>
);
}

export default App;

0 comments on commit 9b4383e

Please sign in to comment.