From 1e3403ade54d6094be94fc0efd9e128819754ee4 Mon Sep 17 00:00:00 2001 From: Jaewook Ahn Date: Wed, 17 Apr 2024 19:12:30 +0900 Subject: [PATCH] feat(ga): add Google Analytics script - add nextjs third parties module - remove index.html from public directory - add ga id to env variable --- .env | 1 + app/layout.tsx | 2 ++ package.json | 1 + public/index.html | 37 ------------------------------------- yarn.lock | 12 ++++++++++++ 5 files changed, 16 insertions(+), 37 deletions(-) delete mode 100644 public/index.html diff --git a/.env b/.env index 36fb81c..ebbedf6 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ NEXT_PUBLIC_API=https://portfolio.api.jaewook.me/api +GA_ID="G-8SNMEHDQJ0" diff --git a/app/layout.tsx b/app/layout.tsx index 6bb3b71..90e894d 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,3 +1,4 @@ +import { GoogleAnalytics } from "@next/third-parties/google"; import type { Metadata } from "next"; import "normalize.css"; @@ -15,6 +16,7 @@ const RootLayout = ({ children }: PropsWithChildren) => { href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@200;300;400;500;600;700;800;900&display=swap" rel="stylesheet" /> + {process.env.GA_ID ? : null}
diff --git a/package.json b/package.json index 39b7700..505bffb 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "typescript": "^5.1.6" }, "dependencies": { + "@next/third-parties": "^14.2.1", "@vanilla-extract/css": "^1.14.0", "@vanilla-extract/dynamic": "^2.1.0", "@vanilla-extract/recipes": "^0.5.1", diff --git a/public/index.html b/public/index.html deleted file mode 100644 index d86d582..0000000 --- a/public/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Jaewook's portfolio - - - -
- - - - diff --git a/yarn.lock b/yarn.lock index 3c90071..9532911 100644 --- a/yarn.lock +++ b/yarn.lock @@ -759,6 +759,13 @@ resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.7.tgz#5137780f58d7f0230adc293a0429821bfa7d8c21" integrity sha512-sW9Yt36Db1nXJL+mTr2Wo0y+VkPWeYhygvcHj1FF0srVtV+VoDjxleKtny21QHaG05zdeZnw2fCtf2+dEqgwqA== +"@next/third-parties@^14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/third-parties/-/third-parties-14.2.1.tgz#a417099d0c4cdeb1368eae8185e51131ee890623" + integrity sha512-iHVq3uHT1BLR4O8LXJ/AJeRCATnsxWNq5S223BYhrQMceMUr/5TtKIroQwJpXrbwxkOr7SFX72mZqPTXxd/TnQ== + dependencies: + third-party-capital "1.0.20" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -3742,6 +3749,11 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +third-party-capital@1.0.20: + version "1.0.20" + resolved "https://registry.yarnpkg.com/third-party-capital/-/third-party-capital-1.0.20.tgz#e218a929a35bf4d2245da9addb8ab978d2f41685" + integrity sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA== + through2@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764"