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

구글 태그 인식을 위한 script 코드 추가, 사이드바에서 Toast가 잘려 보이는 이슈 해결 #593

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 24 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"msw": "^1.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-gtm-module": "^2.0.11",
"react-router-dom": "^6.14.1"
},
"eslintConfig": {
Expand All @@ -47,6 +48,7 @@
"@types/jest": "^29.5.2",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/react-gtm-module": "^2.0.1",
"@types/styled-components": "^5.1.26",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
Expand Down
9 changes: 0 additions & 9 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,4 @@
<body>
<div id="root"></div>
</body>
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id=%VOTOGETHER_GOOGLE_TAG_ID%"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
</html>
28 changes: 16 additions & 12 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import router from '@routes/router';
import ErrorBoundaryForTopClass from '@pages/ErrorBoundaryForTopClass';

import ChannelTalk from '@components/ChannelTalk';
import GoogleTagManager from '@components/GoogleTagManager';

import { GlobalStyle } from '@styles/globalStyle';
import { theme } from '@styles/theme';
Expand All @@ -23,18 +24,21 @@ ChannelTalk.boot({
});

const App = () => (
<ErrorBoundaryForTopClass>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<GlobalStyle />
<PostOptionProvider>
<AuthProvider>
<RouterProvider router={router} />
</AuthProvider>
</PostOptionProvider>
</ThemeProvider>
</QueryClientProvider>
</ErrorBoundaryForTopClass>
<>
<ErrorBoundaryForTopClass>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<GlobalStyle />
<PostOptionProvider>
<AuthProvider>
<RouterProvider router={router} />
</AuthProvider>
</PostOptionProvider>
</ThemeProvider>
</QueryClientProvider>
</ErrorBoundaryForTopClass>
Copy link
Member Author

@inyeong-kang inyeong-kang Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

에러가 나는 경우에도 구글 태그가 있어야 지속적인 사용자 추적이 가능해서 최상단에 구글 태그를 두었습니다.

<GoogleTagManager gtmId={process.env.VOTOGETHER_GOOGLE_TAG_ID} />
</>
);

export default App;
10 changes: 10 additions & 0 deletions frontend/src/components/GoogleTagManager/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useEffect } from 'react';
import TagManager from 'react-gtm-module';

export default function GoogleTagManager({ gtmId }: { gtmId: string }) {
useEffect(() => {
TagManager.initialize({ gtmId });
});

return <></>;
}