Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] Hotfix react ga4 에러 해결 #507

Merged
merged 6 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { RouterProvider } from 'react-router-dom';
import router from './router';
import RouteChangeTracker from './utils/RouteChangeTracker';

const App = () => {
RouteChangeTracker();

return <RouterProvider router={router} />;
};

Expand Down
5 changes: 5 additions & 0 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import theme from './themes';
import GlobalStyle from './GlobalStyle';
import ErrorBoundary from './components/ErrorBoundary';
import NotFound from './pages/NotFound';
import ReactGA from 'react-ga4';

const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Failed to find the root element');
Expand All @@ -15,6 +16,10 @@ const root = ReactDOM.createRoot(rootElement);
// worker.start({ quiet: true });
// }

if (process.env.REACT_APP_GOOGLE_ANALYTICS) {
ReactGA.initialize(process.env.REACT_APP_GOOGLE_ANALYTICS);
}

root.render(
<ThemeProvider theme={theme}>
<GlobalStyle />
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/RootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { Outlet } from 'react-router-dom';
import Layout from '../components/Layout';
import LayoutWidthProvider from '../context/LayoutWidthContext';
import NavbarHighlightsProvider from '../context/NavbarHighlightsContext';
import RouteChangeTracker from '../utils/RouteChangeTracker';

const RootPage = () => {
RouteChangeTracker();
return (
<>
<LayoutWidthProvider>
Expand Down
Loading