From b7aff74c8803fa27960c95fd380fe805085a6851 Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Mon, 5 Feb 2024 21:25:41 -0600 Subject: [PATCH] Add analytics --- app/layout.tsx | 5 +++++ package.json | 1 + pnpm-lock.yaml | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/app/layout.tsx b/app/layout.tsx index 1ee442b7..c22d5763 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,4 +1,5 @@ import "./styles/tailwind.css" +import { GoogleAnalytics } from "@next/third-parties/google" import { Metadata } from "next" import { Rubik } from "next/font/google" import { siteMeta } from "./lib/siteMeta" @@ -48,6 +49,10 @@ export default function RootLayout({ children }: RootLayoutProps) { {children} + + {process.env.NEXT_PUBLIC_GA_ID ? ( + + ) : null} ) } diff --git a/package.json b/package.json index da687cb1..e1180e0a 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@mskelton/rehype-shiki": "^0.3.0", "@mskelton/remark-extract-frontmatter": "^0.0.2", "@next/mdx": "^13.5.6", + "@next/third-parties": "^14.1.0", "@octokit/rest": "^20.0.2", "@prisma/client": "^5.5.1", "@tailwindcss/container-queries": "^0.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f677fdfa..61a38e14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ importers: '@next/mdx': specifier: ^13.5.6 version: 13.5.6(@mdx-js/loader@2.3.0)(@mdx-js/react@2.3.0) + '@next/third-parties': + specifier: ^14.1.0 + version: 14.1.0(next@13.5.6)(react@18.2.0) '@octokit/rest': specifier: ^20.0.2 version: 20.0.2 @@ -839,6 +842,17 @@ packages: dev: false optional: true + /@next/third-parties@14.1.0(next@13.5.6)(react@18.2.0): + resolution: {integrity: sha512-f55SdvQ1WWxi4mb5QqtYQh5wRzbm1XaeP7s39DPn4ks3re+n9VlFccbMxBRHqkE62zAyIKmvkUB2cByT/gugGA==} + peerDependencies: + next: ^13.0.0 || ^14.0.0 + react: ^18.2.0 + dependencies: + next: 13.5.6(@babel/core@7.23.2)(react-dom@18.2.0)(react@18.2.0) + react: 18.2.0 + third-party-capital: 1.0.20 + dev: false + /@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1: resolution: {integrity: sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==} dependencies: @@ -7042,6 +7056,10 @@ packages: any-promise: 1.3.0 dev: false + /third-party-capital@1.0.20: + resolution: {integrity: sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA==} + dev: false + /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'}