Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions web/.vade-report
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Vercel Web Analytics Implementation

Successfully installed and configured Vercel Web Analytics for the budgetr Next.js application.

### Changes Made

**Modified Files:**
1. `app/layout.tsx` - Added Analytics component to root layout
2. `package.json` - Added @vercel/analytics dependency (v2.0.1)
3. `package-lock.json` - Updated lock file with new dependency

### Implementation Details

Following the official Vercel documentation (https://vercel.com/docs/analytics/quickstart), I:

1. **Installed the Package**: Added `@vercel/analytics` v2.0.1 using npm
2. **Imported Analytics Component**: Added `import { Analytics } from "@vercel/analytics/next"` to the root layout
3. **Added Component to DOM**: Placed `<Analytics />` at the end of the `<body>` tag in the root layout

### Code Changes

In `app/layout.tsx`:
- Added import statement for Analytics component from @vercel/analytics/next
- Added `<Analytics />` component inside the body tag, after the children
- Preserved existing code structure, theme script, and all existing functionality

### Testing & Verification

✅ Linter passed with no errors (only 2 pre-existing warnings unrelated to changes)
✅ Build completed successfully with Next.js 16.2.6 (Turbopack)
✅ All 461 tests passed across 46 test files
✅ Local packages (@budgetr/core and @budgetr/sync-crypto) built successfully

### Next Steps

To complete the setup:
1. Deploy the application to Vercel
2. Enable Web Analytics in the Vercel dashboard (Analytics section)
3. Verify analytics tracking by checking browser Network tab for requests to `/<unique-path>/view`
4. Monitor analytics data in the Vercel dashboard (appears within a few days of visitor activity)

### Notes

- The Analytics component is lightweight and non-blocking
- It automatically tracks page views in the Next.js App Router
- No additional configuration is required in the code
- Analytics will only work when deployed on Vercel (not in local development)
2 changes: 2 additions & 0 deletions web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Metadata, Viewport } from "next";
import { Fraunces, Hanken_Grotesk, Spline_Sans_Mono } from "next/font/google";
import { Analytics } from "@vercel/analytics/next";
import { THEME_SCRIPT } from "@/lib/theme";
import { SITE } from "@/lib/site";
import "./globals.css";
Expand Down Expand Up @@ -88,6 +89,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
wrong palette; the toggle keeps the cookie + <html> attribute in sync. */}
<script dangerouslySetInnerHTML={{ __html: THEME_SCRIPT }} />
{children}
<Analytics />
</body>
</html>
);
Expand Down
44 changes: 44 additions & 0 deletions web/package-lock.json

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

1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@budgetr/core": "file:../packages/core",
"@budgetr/sync-crypto": "file:../packages/sync-crypto",
"@vercel/analytics": "^2.0.1",
"better-sqlite3": "^12.11.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
Expand Down
Loading