Skip to content

Add Vercel Web Analytics to Next.js#345

Merged
Dargon789 merged 1 commit intomainfrom
vercel/vercel-web-analytics-to-nextjs-pqz30m
Mar 10, 2026
Merged

Add Vercel Web Analytics to Next.js#345
Dargon789 merged 1 commit intomainfrom
vercel/vercel-web-analytics-to-nextjs-pqz30m

Conversation

@vercel
Copy link
Copy Markdown

@vercel vercel bot commented Mar 10, 2026

Successfully installed and configured Vercel Web Analytics for Next.js

Changes Made

1. Installed @vercel/analytics package

  • Added @vercel/analytics version 1.6.1 to the project dependencies
  • Used pnpm (the project's package manager) to install the package
  • Updated pnpm-lock.yaml to reflect the new dependency

2. Configured Analytics in App Router

Modified extras/docs/app/layout.tsx:

  • Imported Analytics component from '@vercel/analytics/next'
  • Added <Analytics /> component inside the <body> tag, after the {children} element
  • Preserved all existing code structure including font configurations and metadata

Files Modified

  • extras/docs/app/layout.tsx - Added Analytics import and component
  • extras/docs/package.json - Added @vercel/analytics dependency
  • pnpm-lock.yaml - Updated with new package dependencies

Implementation Details

This is an App Router Next.js project (using the app directory structure), so the Analytics component was added to the root layout file at extras/docs/app/layout.tsx. The component is placed inside the <body> tag after the children content, which is the recommended placement according to Vercel's documentation.

Verification Steps Completed

✅ Dependencies installed successfully using pnpm
✅ Build completed successfully with no errors
✅ Linter passed with no errors (0 errors, 0 warnings in source files)
✅ All changes properly formatted and follow existing code patterns
✅ Lockfile updated to ensure consistent dependency resolution

The Analytics component will now track page views and web vitals automatically when the application is deployed to Vercel.


View Project · Web Analytics

Created by Dargon789 (esanfxtrader-8164) with Vercel Agent

Successfully installed and configured Vercel Web Analytics for Next.js

## Changes Made

### 1. Installed @vercel/analytics package
- Added `@vercel/analytics` version 1.6.1 to the project dependencies
- Used pnpm (the project's package manager) to install the package
- Updated pnpm-lock.yaml to reflect the new dependency

### 2. Configured Analytics in App Router
Modified `extras/docs/app/layout.tsx`:
- Imported `Analytics` component from '@vercel/analytics/next'
- Added `<Analytics />` component inside the `<body>` tag, after the {children} element
- Preserved all existing code structure including font configurations and metadata

### Files Modified
- **extras/docs/app/layout.tsx** - Added Analytics import and component
- **extras/docs/package.json** - Added @vercel/analytics dependency
- **pnpm-lock.yaml** - Updated with new package dependencies

## Implementation Details

This is an App Router Next.js project (using the `app` directory structure), so the Analytics component was added to the root layout file at `extras/docs/app/layout.tsx`. The component is placed inside the `<body>` tag after the children content, which is the recommended placement according to Vercel's documentation.

## Verification Steps Completed

✅ Dependencies installed successfully using pnpm
✅ Build completed successfully with no errors
✅ Linter passed with no errors (0 errors, 0 warnings in source files)
✅ All changes properly formatted and follow existing code patterns
✅ Lockfile updated to ensure consistent dependency resolution

The Analytics component will now track page views and web vitals automatically when the application is deployed to Vercel.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Mar 10, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel
Copy link
Copy Markdown
Author

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sequence-js-docs Canceled Canceled Mar 10, 2026 0:40am
sequence-js-web Ready Ready Preview, Comment Mar 10, 2026 0:40am

@vercel

This comment was marked as resolved.

@vercel vercel bot temporarily deployed to Preview – sequence-js-docs March 10, 2026 00:40 Inactive
@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Mar 10, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
🔚 Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@Dargon789
Copy link
Copy Markdown
Owner

@Mergifyio update

@mergify
Copy link
Copy Markdown

mergify bot commented Mar 10, 2026

update

☑️ Nothing to do, the required conditions are not met

Details
  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

@Dargon789 Dargon789 merged commit 0d374d7 into main Mar 10, 2026
10 of 17 checks passed
@Dargon789 Dargon789 deleted the vercel/vercel-web-analytics-to-nextjs-pqz30m branch March 10, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vc]: #wagmi@foundry-deployment-team Microsoft Defender For Devops CI workflow execution

1 participant