Skip to content

Install Vercel Web Analytics#20

Merged
dongjiang1989 merged 1 commit into
mainfrom
vercel/install-vercel-web-analytics-c2k0h5
Jun 15, 2026
Merged

Install Vercel Web Analytics#20
dongjiang1989 merged 1 commit into
mainfrom
vercel/install-vercel-web-analytics-c2k0h5

Conversation

@vercel

@vercel vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Vercel Web Analytics Installation Complete

Successfully installed and configured Vercel Web Analytics for this Astro project.

Changes Made:

1. Package Installation

  • Added dependency: @astrojs/vercel version ^10.0.8 to package.json
  • Updated package-lock.json with the new dependency and its transitive dependencies

2. Configuration Changes

  • Modified: astro.config.ts
    • Added import: import vercel from '@astrojs/vercel';
    • Added Vercel adapter configuration with web analytics enabled:
      adapter: vercel({
        webAnalytics: {
          enabled: true,
        },
      }),

Implementation Details:

Following the official Vercel and Astro documentation, I used the framework-specific approach for Astro projects:

  • Instead of installing @vercel/analytics directly, I installed the @astrojs/vercel adapter
  • The adapter includes built-in support for Vercel Web Analytics through the webAnalytics.enabled configuration option
  • This approach is the recommended method for Astro projects according to the official documentation

Verification:

Build Success: Ran npm run build - completed successfully
Type Check: Ran npm run check:astro - no errors
Linting: Ran npm run check:eslint - passed
Adapter Confirmation: Build output shows adapter: @astrojs/vercel is being used
Output Structure: Vercel output directory created at .vercel/output/static

Next Steps:

Once deployed to Vercel, the web analytics will automatically start tracking:

  • Page views
  • User interactions
  • Custom events (if configured)

The analytics data will be visible in the Vercel dashboard under the Analytics section of your project.

Notes:

  • The project maintains its output: 'static' mode (no changes required for analytics)
  • All existing functionality is preserved
  • The .vercel/ directory was created during the build and should remain in .gitignore

View Project · Web Analytics

Created by dongjiang2010-9642 with Vercel Agent

## Vercel Web Analytics Installation Complete

Successfully installed and configured Vercel Web Analytics for this Astro project.

### Changes Made:

#### 1. Package Installation
- **Added dependency**: `@astrojs/vercel` version `^10.0.8` to `package.json`
- Updated `package-lock.json` with the new dependency and its transitive dependencies

#### 2. Configuration Changes
- **Modified**: `astro.config.ts`
  - Added import: `import vercel from '@astrojs/vercel';`
  - Added Vercel adapter configuration with web analytics enabled:
    ```typescript
    adapter: vercel({
      webAnalytics: {
        enabled: true,
      },
    }),
    ```

### Implementation Details:

Following the official Vercel and Astro documentation, I used the framework-specific approach for Astro projects:
- Instead of installing `@vercel/analytics` directly, I installed the `@astrojs/vercel` adapter
- The adapter includes built-in support for Vercel Web Analytics through the `webAnalytics.enabled` configuration option
- This approach is the recommended method for Astro projects according to the official documentation

### Verification:

✅ **Build Success**: Ran `npm run build` - completed successfully  
✅ **Type Check**: Ran `npm run check:astro` - no errors  
✅ **Linting**: Ran `npm run check:eslint` - passed  
✅ **Adapter Confirmation**: Build output shows `adapter: @astrojs/vercel` is being used  
✅ **Output Structure**: Vercel output directory created at `.vercel/output/static`

### Next Steps:

Once deployed to Vercel, the web analytics will automatically start tracking:
- Page views
- User interactions
- Custom events (if configured)

The analytics data will be visible in the Vercel dashboard under the Analytics section of your project.

### Notes:

- The project maintains its `output: 'static'` mode (no changes required for analytics)
- All existing functionality is preserved
- The `.vercel/` directory was created during the build and should remain in `.gitignore`

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

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

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

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Jun 15, 2026 1:41am

@dongjiang1989 dongjiang1989 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dongjiang1989 dongjiang1989 merged commit 44714b3 into main Jun 15, 2026
10 checks passed
@dongjiang1989 dongjiang1989 deleted the vercel/install-vercel-web-analytics-c2k0h5 branch June 15, 2026 02:28
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.

1 participant