Skip to content

Enable Vercel Speed Insights on your project#2

Open
vercel[bot] wants to merge 1 commit intomainfrom
vercel/enable-vercel-speed-insights-o-efvlla
Open

Enable Vercel Speed Insights on your project#2
vercel[bot] wants to merge 1 commit intomainfrom
vercel/enable-vercel-speed-insights-o-efvlla

Conversation

@vercel
Copy link
Copy Markdown

@vercel vercel bot commented Mar 11, 2026

Vercel Speed Insights Implementation

Summary

Successfully implemented Vercel Speed Insights for the ProScholarsTools static HTML website. Speed Insights will now track Core Web Vitals and performance metrics for all pages on the site.

Changes Made

1. Added Speed Insights Scripts to All HTML Files (46 files)

Added the following Speed Insights initialization code before the closing </body> tag in all HTML files:

<script>
  window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>

Files Modified:

  • All 39 HTML files in /public/ directory (index.html, about.html, pricing.html, tools.html, contact.html, privacy.html, terms.html, thank-you.html, 404.html, GUMROAD_SETUP_GUIDE.html, and all 29 tool pages)
  • All 7 HTML files in /public/blog/ directory (blog index and 6 blog posts)

2. Updated Content Security Policy in vercel.json

Modified the Content-Security-Policy header to allow Speed Insights scripts and connections:

Added to script-src:

  • https://va.vercel-scripts.com - for Vercel Analytics scripts

Added to connect-src:

  • https://vitals.vercel-insights.com - for sending performance metrics to Vercel

Implementation Details

This implementation follows Vercel's official documentation for HTML-based sites:

  • No package installation required (Speed Insights is served from /_vercel/speed-insights/script.js)
  • Scripts are loaded with defer attribute for optimal performance
  • The initialization function (window.si) is set up before the script loads
  • Scripts are added before the closing </body> tag to ensure DOM is ready

Next Steps

To complete the Speed Insights setup:

  1. Enable Speed Insights in Vercel Dashboard:

    • Go to your project in the Vercel dashboard
    • Navigate to the "Speed Insights" tab
    • Click "Enable" to activate the feature
    • This will add the necessary routes (/_vercel/speed-insights/*) after deployment
  2. Deploy to Vercel:

    vercel deploy --prod
  3. Verify Installation:

    • After deployment, visit any page on your site
    • Open browser DevTools > Network tab
    • Verify that /_vercel/speed-insights/script.js is loading successfully
  4. View Data:

    • After deployment and user visits, go to your Vercel dashboard
    • Select your project
    • Click the "Speed Insights" tab to view performance metrics
    • Data will populate after a few days of visitor traffic

Technical Notes

  • The Speed Insights script is served from the same origin (/_vercel/speed-insights/*), which is already allowed by CSP's script-src 'self'
  • The script automatically tracks Core Web Vitals (LCP, FID, CLS, FCP, TTFB, INP)
  • No impact on existing functionality - the script loads asynchronously
  • Privacy-compliant - follows Vercel's privacy and data compliance standards
  • No cookies required - uses lightweight beacon API for metrics transmission

Files Changed

  • vercel.json - Updated CSP headers
  • public/**/*.html - Added Speed Insights scripts (46 files total)

View Project · Speed Insights

Created by rogaareef with Vercel Agent

# Vercel Speed Insights Implementation

## Summary
Successfully implemented Vercel Speed Insights for the ProScholarsTools static HTML website. Speed Insights will now track Core Web Vitals and performance metrics for all pages on the site.

## Changes Made

### 1. Added Speed Insights Scripts to All HTML Files (46 files)
Added the following Speed Insights initialization code before the closing `</body>` tag in all HTML files:

```html
<script>
  window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
```

**Files Modified:**
- All 39 HTML files in `/public/` directory (index.html, about.html, pricing.html, tools.html, contact.html, privacy.html, terms.html, thank-you.html, 404.html, GUMROAD_SETUP_GUIDE.html, and all 29 tool pages)
- All 7 HTML files in `/public/blog/` directory (blog index and 6 blog posts)

### 2. Updated Content Security Policy in vercel.json
Modified the Content-Security-Policy header to allow Speed Insights scripts and connections:

**Added to script-src:**
- `https://va.vercel-scripts.com` - for Vercel Analytics scripts

**Added to connect-src:**
- `https://vitals.vercel-insights.com` - for sending performance metrics to Vercel

## Implementation Details

This implementation follows Vercel's official documentation for HTML-based sites:
- No package installation required (Speed Insights is served from `/_vercel/speed-insights/script.js`)
- Scripts are loaded with `defer` attribute for optimal performance
- The initialization function (`window.si`) is set up before the script loads
- Scripts are added before the closing `</body>` tag to ensure DOM is ready

## Next Steps

To complete the Speed Insights setup:

1. **Enable Speed Insights in Vercel Dashboard:**
   - Go to your project in the Vercel dashboard
   - Navigate to the "Speed Insights" tab
   - Click "Enable" to activate the feature
   - This will add the necessary routes (`/_vercel/speed-insights/*`) after deployment

2. **Deploy to Vercel:**
   ```bash
   vercel deploy --prod
   ```

3. **Verify Installation:**
   - After deployment, visit any page on your site
   - Open browser DevTools > Network tab
   - Verify that `/_vercel/speed-insights/script.js` is loading successfully

4. **View Data:**
   - After deployment and user visits, go to your Vercel dashboard
   - Select your project
   - Click the "Speed Insights" tab to view performance metrics
   - Data will populate after a few days of visitor traffic

## Technical Notes

- The Speed Insights script is served from the same origin (`/_vercel/speed-insights/*`), which is already allowed by CSP's `script-src 'self'`
- The script automatically tracks Core Web Vitals (LCP, FID, CLS, FCP, TTFB, INP)
- No impact on existing functionality - the script loads asynchronously
- Privacy-compliant - follows Vercel's privacy and data compliance standards
- No cookies required - uses lightweight beacon API for metrics transmission

## Files Changed

- `vercel.json` - Updated CSP headers
- `public/**/*.html` - Added Speed Insights scripts (46 files total)

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

vercel bot commented Mar 11, 2026

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

Project Deployment Actions Updated (UTC)
new-pro Ready Ready Preview, Comment Mar 11, 2026 2:35pm

@rogaareef rogaareef marked this pull request as ready for review March 11, 2026 14:38
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