Install Vercel Speed Insights#1
Draft
vercel[bot] wants to merge 1 commit into
Draft
Conversation
## Vercel Speed Insights Implementation
Successfully installed and configured Vercel Speed Insights for the advisory-engine project.
### Changes Made:
#### 1. Package Installation
- Installed `@vercel/speed-insights` version 2.0.0
- Added package to `package.json` dependencies
- Generated `package-lock.json` with all dependencies locked
#### 2. Speed Insights Integration
- Added Speed Insights tracking script to `public/index.html`
- Implementation follows Vercel's official documentation for vanilla HTML/JavaScript projects
- Added two script tags before closing `</body>` tag:
1. Initialization script to set up the `window.si` queue function
2. Deferred loading of the Speed Insights script from `/_vercel/speed-insights/script.js`
### Implementation Details:
**Framework Identified:** Vanilla HTML/JavaScript with Vercel Serverless Functions
**Method Used:** Manual script injection (official method for static HTML sites)
The implementation uses the recommended approach from Vercel's documentation:
```html
<script>
window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
```
This approach:
- Initializes the Speed Insights queue before the main script loads
- Uses deferred loading to avoid blocking page rendering
- Loads the script from Vercel's CDN path which is automatically available when deployed
- Will only track metrics in production (not in development)
### Files Modified:
1. **package.json**
- Added `@vercel/speed-insights` dependency
2. **public/index.html**
- Added Speed Insights script tags before closing `</body>` tag
- Placed after all other scripts to ensure proper page loading
3. **package-lock.json** (generated)
- Locked all dependency versions for consistent installs
### Verification:
- No build errors (project uses static HTML, no build step required)
- No linter/test suite configured in project (verified)
- HTML syntax validated and properly formatted
- Speed Insights will activate automatically when deployed to Vercel
### Next Steps (for the developer):
1. Deploy the changes to Vercel
2. Enable Speed Insights in the Vercel Dashboard (Settings → Speed Insights)
3. After deployment and user traffic, performance data will appear in the Speed Insights dashboard
4. Data typically appears within a few days of deployment
### Notes:
- Speed Insights does NOT track data in development mode
- The script is loaded asynchronously and will not impact page performance
- The `/_vercel/speed-insights/script.js` path is automatically available on Vercel's infrastructure
- No additional configuration is required for basic usage
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 Implementation
Successfully installed and configured Vercel Speed Insights for the advisory-engine project.
Changes Made:
1. Package Installation
@vercel/speed-insightsversion 2.0.0package.jsondependenciespackage-lock.jsonwith all dependencies locked2. Speed Insights Integration
public/index.html</body>tag:window.siqueue function/_vercel/speed-insights/script.jsImplementation Details:
Framework Identified: Vanilla HTML/JavaScript with Vercel Serverless Functions
Method Used: Manual script injection (official method for static HTML sites)
The implementation uses the recommended approach from Vercel's documentation:
This approach:
Files Modified:
package.json
@vercel/speed-insightsdependencypublic/index.html
</body>tagpackage-lock.json (generated)
Verification:
Next Steps (for the developer):
Notes:
/_vercel/speed-insights/script.jspath is automatically available on Vercel's infrastructureView Project · Speed Insights
Created by 8in (8in) with Vercel Agent