Skip to content

Add Vercel Web Analytics setup guide#1

Draft
vercel[bot] wants to merge 1 commit intomainfrom
vercel/vercel-web-analytics-setup-gui-wl92q9
Draft

Add Vercel Web Analytics setup guide#1
vercel[bot] wants to merge 1 commit intomainfrom
vercel/vercel-web-analytics-setup-gui-wl92q9

Conversation

@vercel
Copy link

@vercel vercel bot commented Mar 10, 2026

Vercel Web Analytics Implementation

Summary

Successfully implemented Vercel Web Analytics on the PicPDF Web application following the official Vercel guide for plain HTML sites.

Changes Made

Modified Files:

  • index.html - Added Vercel Web Analytics script tags

Implementation Details

Added the Vercel Web Analytics tracking scripts to index.html before the existing library scripts:

<!-- Vercel Web Analytics -->
<script>
    window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>

This implementation:

  1. Initializes the analytics queue - The first script creates the window.va function and window.vaq array to queue analytics events
  2. Loads the tracking script - The second script asynchronously loads the Vercel Insights tracking script from /_vercel/insights/script.js
  3. Uses defer attribute - Ensures the script doesn't block page rendering
  4. Follows HTML implementation pattern - Uses the plain HTML/JavaScript approach as recommended for static sites without a build system

Project Context

This is a pure static HTML/JavaScript application with:

  • No Node.js dependencies or package.json
  • No build system or bundler
  • Client-side only PDF conversion using pdf.js and jsPDF
  • Deployed as static files to Vercel

The HTML implementation pattern was chosen because:

  • No package manager or build system to integrate with
  • No framework-specific components needed
  • Direct script injection is the recommended approach for plain HTML sites
  • No need to install the @vercel/analytics npm package

Next Steps

After deployment to Vercel:

  1. Enable Web Analytics in the Vercel dashboard (Project → Analytics tab → Enable)
  2. Deploy the updated code to Vercel
  3. Verify analytics are working by checking for /_vercel/insights/view requests in browser DevTools Network tab
  4. View analytics data in the Vercel dashboard after users visit the site

Testing

Since this is a static site with no build process:

  • ✅ Changes are minimal and non-breaking (only adds new script tags)
  • ✅ Scripts are loaded with defer to avoid blocking page load
  • ✅ No existing functionality is affected
  • ✅ Analytics will only activate after deployment to Vercel and dashboard enablement

View Project · Web Analytics

Created by davidfph with Vercel Agent

# Vercel Web Analytics Implementation

## Summary
Successfully implemented Vercel Web Analytics on the PicPDF Web application following the official Vercel guide for plain HTML sites.

## Changes Made

### Modified Files:
- **index.html** - Added Vercel Web Analytics script tags

## Implementation Details

Added the Vercel Web Analytics tracking scripts to `index.html` before the existing library scripts:

```html
<!-- Vercel Web Analytics -->
<script>
    window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
```

This implementation:
1. **Initializes the analytics queue** - The first script creates the `window.va` function and `window.vaq` array to queue analytics events
2. **Loads the tracking script** - The second script asynchronously loads the Vercel Insights tracking script from `/_vercel/insights/script.js`
3. **Uses defer attribute** - Ensures the script doesn't block page rendering
4. **Follows HTML implementation pattern** - Uses the plain HTML/JavaScript approach as recommended for static sites without a build system

## Project Context

This is a pure static HTML/JavaScript application with:
- No Node.js dependencies or package.json
- No build system or bundler
- Client-side only PDF conversion using pdf.js and jsPDF
- Deployed as static files to Vercel

The HTML implementation pattern was chosen because:
- No package manager or build system to integrate with
- No framework-specific components needed
- Direct script injection is the recommended approach for plain HTML sites
- No need to install the `@vercel/analytics` npm package

## Next Steps

After deployment to Vercel:
1. Enable Web Analytics in the Vercel dashboard (Project → Analytics tab → Enable)
2. Deploy the updated code to Vercel
3. Verify analytics are working by checking for `/_vercel/insights/view` requests in browser DevTools Network tab
4. View analytics data in the Vercel dashboard after users visit the site

## Testing

Since this is a static site with no build process:
- ✅ Changes are minimal and non-breaking (only adds new script tags)
- ✅ Scripts are loaded with `defer` to avoid blocking page load
- ✅ No existing functionality is affected
- ✅ Analytics will only activate after deployment to Vercel and dashboard enablement

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

vercel bot commented Mar 10, 2026

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

Project Deployment Actions Updated (UTC)
pic-pdf Building Building Preview Mar 10, 2026 0:15am

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.

0 participants