Install Vercel Speed Insights#2
Draft
vercel[bot] wants to merge 1 commit into
Draft
Conversation
# Vercel Speed Insights Integration
Successfully installed and configured Vercel Speed Insights for this static HTML project.
## Changes Made
### 1. Package Installation
- **Modified**: `package.json`
- Added `@vercel/speed-insights` version `^2.0.0` as a dependency
- **Modified**: `package-lock.json`
- Updated with `@vercel/speed-insights` package and its dependencies
### 2. Speed Insights Integration
- **Modified**: `index.html`
- Added Speed Insights initialization script before the closing `</body>` tag
- Implemented the queue-based approach recommended for static sites
- Added two script tags:
1. Initialization script that sets up the `window.si` function and queue
2. Deferred loading of the Speed Insights script from `/_vercel/speed-insights/script.js`
## Implementation Details
This project is a vanilla HTML/CSS/JavaScript static site without a build process. Following the official Vercel documentation for static sites, I implemented the queue-based initialization pattern:
```html
<!-- Vercel Speed Insights -->
<script>
window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
```
This approach:
- Works seamlessly when deployed to Vercel
- Uses the `defer` attribute for optimal performance
- Queues events before the script loads to prevent data loss
- Automatically starts tracking web vitals and performance metrics
## Next Steps
To complete the setup:
1. Deploy the project to Vercel (the Speed Insights script will be automatically served)
2. Enable Speed Insights in the Vercel dashboard for this project
3. After deployment and user visits, view performance data in the Speed Insights dashboard
## Notes
- The Speed Insights integration follows Vercel's official quickstart documentation
- The `/_vercel/speed-insights/script.js` path is automatically handled by Vercel's platform
- No additional configuration is required for basic functionality
- The integration preserves all existing code structure and functionality
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Author
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vercel Speed Insights Integration
Successfully installed and configured Vercel Speed Insights for this static HTML project.
Changes Made
1. Package Installation
Modified:
package.json@vercel/speed-insightsversion^2.0.0as a dependencyModified:
package-lock.json@vercel/speed-insightspackage and its dependencies2. Speed Insights Integration
index.html</body>tagwindow.sifunction and queue/_vercel/speed-insights/script.jsImplementation Details
This project is a vanilla HTML/CSS/JavaScript static site without a build process. Following the official Vercel documentation for static sites, I implemented the queue-based initialization pattern:
This approach:
deferattribute for optimal performanceNext Steps
To complete the setup:
Notes
/_vercel/speed-insights/script.jspath is automatically handled by Vercel's platformView Project · Speed Insights
Created by zeke-codes with Vercel Agent