-
Notifications
You must be signed in to change notification settings - Fork 1
feat : ga/gtm 설치 #157
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
base: main
Are you sure you want to change the base?
feat : ga/gtm 설치 #157
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @caseBread, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 프로젝트에 Google Analytics(GA) 및 Google Tag Manager(GTM)를 통합하는 것을 목표로 합니다. 이를 위해 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이번 PR은 @next/third-parties 의존성을 추가하고 루트 레이아웃에 GoogleTagManager 컴포넌트를 포함하여 Google Tag Manager를 연동하는 변경 사항을 담고 있습니다. 제 리뷰는 GTM ID를 하드코딩하는 대신 환경 변수를 사용하도록 제안하여 보안과 유지보수성을 개선하는 데 중점을 두었습니다.
src/app/layout.tsx
Outdated
| })(window, document, 'https://snippet.maze.co/maze-universal-loader.js', '65a6039c-2384-4c2d-a8e1-546a4f859a08');`} | ||
| </Script> */} | ||
|
|
||
| <GoogleTagManager gtmId='GTM-PH2N3NWM' /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하드코딩된 GTM ID는 보안 및 유지보수 측면에서 좋지 않습니다. 환경 변수를 사용하여 관리하는 것이 좋습니다.
Next.js에서는 .env.local 파일에 환경 변수를 저장하고, NEXT_PUBLIC_ 접두사를 사용하여 브라우저에 노출시킬 수 있습니다.
예를 들어, .env.local 파일에 다음과 같이 추가합니다:
NEXT_PUBLIC_GTM_ID=GTM-PH2N3NWM
그리고 코드에서는 process.env.NEXT_PUBLIC_GTM_ID로 접근할 수 있습니다. 이렇게 하면 개발, 스테이징, 프로덕션 환경마다 다른 GTM ID를 쉽게 적용할 수 있고, 민감한 정보가 코드에 직접 노출되는 것을 방지할 수 있습니다. GTM ID가 없는 환경에서는 스크립트가 렌더링되지 않도록 조건부 렌더링을 사용하는 것이 좋습니다.
| <GoogleTagManager gtmId='GTM-PH2N3NWM' /> | |
| {process.env.NEXT_PUBLIC_GTM_ID && <GoogleTagManager gtmId={process.env.NEXT_PUBLIC_GTM_ID} />} |
요약
ga <-> gtm <-> 프론트 일케 연동 했습니다.

구현 사항
📸 스크린샷
Need Review
Reference
📜 리뷰 규칙
Reviewer는 아래 P5 Rule을 참고하여 리뷰를 진행합니다.
P5 Rule을 통해 Reviewer는 Reviewee에게 리뷰의 의도를 보다 정확히 전달할 수 있습니다.