Skip to content

Commit

Permalink
Wire up Google Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjarling committed May 31, 2024
1 parent 7947c98 commit c1a84d4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Deploy Next.js site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

Expand Down Expand Up @@ -35,6 +30,7 @@ jobs:
env:
NEXT_PUBLIC_CONTENTFUL_SPACE_ID: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_SPACE_ID }}
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@contentful/rich-text-react-renderer": "^15.21.2",
"@headlessui/react": "^2.0.4",
"@heroicons/react": "^2.1.3",
"@next/third-parties": "^14.2.3",
"@tailwindcss/forms": "^0.5.7",
"contentful": "^10.11.7",
"contentful-management": "^11.26.2",
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

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

2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "react-loading-skeleton/dist/skeleton.css";
import { Inter, Open_Sans } from "next/font/google";

import Footer from "@/components/layout/footer";
import { GoogleAnalytics } from "@next/third-parties/google";
import Header from "@/components/layout/header";
import type { Metadata } from "next";
import { ThemeProvider } from "next-themes";
Expand All @@ -23,6 +24,7 @@ export default function RootLayout({
}>) {
return (
<html lang="en" suppressHydrationWarning>
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID!} />
<body className={`${openSans.className} antialiased`}>
<ThemeProvider attribute="class">
<Header />
Expand Down

0 comments on commit c1a84d4

Please sign in to comment.