From 8e64ae91df5e7a6deffaede85acab4ed8dfe03ec Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Tue, 17 Mar 2026 21:53:38 +0800 Subject: [PATCH 1/2] feat: Track visitors with Vercel Analytics --- package.json | 1 + pnpm-lock.yaml | 34 ++++++++++++++++++++++++++++++++++ src/pages/index.astro | 2 ++ 3 files changed, 37 insertions(+) diff --git a/package.json b/package.json index 1df908c..cc43217 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@fontsource-variable/inter": "^5.2.8", "@lucide/astro": "^0.577.0", "@tailwindcss/vite": "^4.2.1", + "@vercel/analytics": "^2.0.1", "astro": "^6.0.4", "astro-favicons": "^3.1.6", "remeda": "^2.33.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fee05f9..f5058b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: '@tailwindcss/vite': specifier: ^4.2.1 version: 4.2.1(vite@7.3.1(jiti@2.6.1)(lightningcss@1.31.1)) + '@vercel/analytics': + specifier: ^2.0.1 + version: 2.0.1 astro: specifier: ^6.0.4 version: 6.0.4(jiti@2.6.1)(lightningcss@1.31.1)(rollup@4.59.0)(typescript@5.9.3) @@ -865,6 +868,35 @@ packages: '@ungap/structured-clone@1.3.0': resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} + '@vercel/analytics@2.0.1': + resolution: {integrity: sha512-MTQG6V9qQrt1tsDeF+2Uoo5aPjqbVPys1xvnIftXSJYG2SrwXRHnqEvVoYID7BTruDz4lCd2Z7rM1BdkUehk2g==} + peerDependencies: + '@remix-run/react': ^2 + '@sveltejs/kit': ^1 || ^2 + next: '>= 13' + nuxt: '>= 3' + react: ^18 || ^19 || ^19.0.0-rc + svelte: '>= 4' + vue: ^3 + vue-router: ^4 + peerDependenciesMeta: + '@remix-run/react': + optional: true + '@sveltejs/kit': + optional: true + next: + optional: true + nuxt: + optional: true + react: + optional: true + svelte: + optional: true + vue: + optional: true + vue-router: + optional: true + anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -2526,6 +2558,8 @@ snapshots: '@ungap/structured-clone@1.3.0': {} + '@vercel/analytics@2.0.1': {} + anymatch@3.1.3: dependencies: normalize-path: 3.0.0 diff --git a/src/pages/index.astro b/src/pages/index.astro index 8257452..a749e5c 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -13,6 +13,7 @@ const projects = sortBy(await getCollection("projects"), [ "asc", ]); +import Analytics from "@vercel/analytics/astro"; import { Image } from "astro:assets"; import { LinkIcon } from "@lucide/astro"; import SquidIcon from "@/assets/icon.svg"; @@ -37,6 +38,7 @@ import SquidIcon from "@/assets/icon.svg"; /> )) } + + +