Skip to content

Commit

Permalink
[BYOB-105] Google Analytics 연결 테스트 (#14)
Browse files Browse the repository at this point in the history
* feat: Google Analytics 사용을 위한 @next/third-parties 설치 및 RootLayout 수정

* feat: GA ID 환경변수 설정
  • Loading branch information
y-ngm-n authored Jul 22, 2024
1 parent 475f9d2 commit bd7b39a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/front_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
run: |
echo "NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL_DEV }}" > .env
echo "NEXT_PUBLIC_API_BASE_URL=${{ secrets.NEXT_PUBLIC_API_BASE_URL_DEV }}" >> .env
echo "NEXT_PUBLIC_GA_ID=${{ secrets.NEXT_PUBLIC_GA_ID }}" >> .env
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/jumo_test_front .
Expand Down
18 changes: 18 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@mui/icons-material": "^5.16.1",
"@mui/material": "^5.16.1",
"@mui/material-nextjs": "^5.16.1",
"@next/third-parties": "^14.2.5",
"@tanstack/react-query": "^5.51.3",
"axios": "^1.3.4",
"embla-carousel-react": "^8.1.6",
Expand Down
4 changes: 4 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import Provider from "./provider";
import { GoogleAnalytics } from "@next/third-parties/google"

const inter = Inter({ subsets: ["latin"] });

const gaId = process.env.NEXT_PUBLIC_GA_ID;

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
Expand All @@ -22,6 +25,7 @@ export default function RootLayout({
{children}
</Provider>
</body>
{ gaId && <GoogleAnalytics gaId={gaId} /> }
</html>
);
}

0 comments on commit bd7b39a

Please sign in to comment.