Skip to content

Commit 70941ef

Browse files
authored
Setup GA4 (#17)
* add next/third-parties * add biomejs to ignoredBuiltDependencies * add ga4 * add serve * add privacy * update home * fix * fix
1 parent 8ee1b61 commit 70941ef

9 files changed

Lines changed: 88 additions & 3 deletions

File tree

app/layout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Metadata } from "next";
44
import { Inter } from "next/font/google";
55
import Link from "next/link";
66
import "./globals.css";
7+
import { GoogleAnalytics } from "@next/third-parties/google";
78

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

@@ -42,8 +43,17 @@ export default function RootLayout({
4243
</div>
4344
</header>
4445
<div className="flex-1">{children}</div>
46+
<footer className="border-t">
47+
<div className="mx-auto flex h-14 w-full max-w-5xl items-center justify-between px-6 text-xs text-muted-foreground">
48+
<p>© {new Date().getFullYear()} Nozomi Hijikata</p>
49+
<Link href="/privacy" className="hover:underline">
50+
Privacy Policy
51+
</Link>
52+
</div>
53+
</footer>
4554
</div>
4655
</body>
56+
<GoogleAnalytics gaId="G-BVCVM7BMVH" />
4757
</html>
4858
);
4959
}

app/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default function Home() {
1212
<TypographyH1>nozomemein</TypographyH1>
1313
<div>
1414
<TypographyP>
15-
Hello, I&apos;m nozomemein, a passionate software engineer.
15+
Hello, I&apos;m Nozomi Hijikata (nozomemein), a passionate software
16+
engineer.
1617
</TypographyP>
1718
<TypographyP>
1819
I enjoy building solutions and continuously learning to improve my

app/privacy/page.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import PrivacyContent, { frontmatter } from "@/content/pages/privacy.mdx";
2+
import type { Metadata } from "next";
3+
4+
export const metadata: Metadata = {
5+
title: frontmatter.title,
6+
description: frontmatter.description,
7+
alternates: { canonical: "/privacy" },
8+
robots: { index: true, follow: true },
9+
};
10+
11+
export default function Privacy() {
12+
return (
13+
<main className="mx-auto w-full max-w-3xl px-6 py-16">
14+
<article className="space-y-6 text-sm leading-7 text-foreground">
15+
<PrivacyContent />
16+
</article>
17+
</main>
18+
);
19+
}

content/pages/privacy.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: "プライバシーポリシー"
3+
description: "Google アナリティクス(GA4)の利用について"
4+
---
5+
6+
# プライバシーポリシー
7+
8+
当サイトでは、アクセス解析のために Google による解析ツール「Google アナリティクス(GA4)」を利用しています。
9+
10+
Google アナリティクスは、Cookie 等を利用して当サイトの利用状況(閲覧したページ、滞在時間、参照元、端末情報など)を収集し、Google に送信する場合があります。収集されるデータは匿名であり、個人を特定するものではありません。
11+
12+
Cookie を無効にすることで、データ収集を拒否することが可能です。設定方法はご利用のブラウザのヘルプ等をご確認ください。
13+
14+
Google アナリティクスの利用規約およびプライバシーに関する詳細は、Google の提供するページをご参照ください。
15+
16+
- [Google アナリティクス利用規約](https://marketingplatform.google.com/about/analytics/terms/jp/)
17+
- [Google のプライバシーポリシー](https://policies.google.com/privacy?hl=ja)

mdx.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare module "*.mdx" {
2+
import type { ComponentType } from "react";
3+
4+
const MDXComponent: ComponentType;
5+
export const frontmatter: {
6+
title?: string;
7+
description?: string;
8+
[key: string]: unknown;
9+
};
10+
export default MDXComponent;
11+
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"dev": "next dev",
77
"build": "next build",
8-
"start": "next start",
8+
"start": "npx serve@latest out",
99
"lint": "biome lint .",
1010
"format": "biome format --write .",
1111
"check": "biome check .",
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"@mdx-js/react": "^3.1.0",
1717
"@next/mdx": "^16.1.6",
18+
"@next/third-parties": "^16.1.6",
1819
"@radix-ui/react-slot": "^1.2.4",
1920
"class-variance-authority": "^0.7.1",
2021
"clsx": "^2.1.1",
@@ -30,11 +31,11 @@
3031
"wrangler": "^4.61.1"
3132
},
3233
"devDependencies": {
34+
"@biomejs/biome": "^1.9.4",
3335
"@types/mdx": "^2.0.13",
3436
"@types/node": "^20.19.30",
3537
"@types/react": "^18.3.27",
3638
"@types/react-dom": "^18.3.7",
37-
"@biomejs/biome": "^1.9.4",
3839
"postcss": "^8.5.6",
3940
"tailwindcss": "^3.4.19",
4041
"typescript": "^5.9.3"

pnpm-lock.yaml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packages:
2+
- "."
3+
4+
ignoredBuiltDependencies:
5+
- '@biomejs/biome'

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"include": [
2626
"next-env.d.ts",
27+
"**/*.d.ts",
2728
"**/*.ts",
2829
"**/*.tsx",
2930
".next/types/**/*.ts",

0 commit comments

Comments
 (0)