Install Vercel Speed Insights Integration#53
Draft
vercel[bot] wants to merge 1 commit into
Draft
Conversation
# Vercel Speed Insights Integration for Matter Documentation ## Summary Successfully integrated Vercel Speed Insights into the Matter (Connected Home IP) project's Sphinx-based documentation site. ## What Was Implemented ### 1. Created Speed Insights JavaScript Integration **File:** `docs/_static/vercel-speed-insights.js` - Created a vanilla JavaScript implementation of Vercel Speed Insights - This script loads the Speed Insights library from `/_vercel/speed-insights/script.js` - Implements the recommended pattern from Vercel's official documentation for non-framework sites - The script initializes `window.si` and dynamically loads the Speed Insights script ### 2. Updated Sphinx Configuration **File:** `docs/conf.py` - Added `html_js_files` configuration to include the Speed Insights JavaScript - The script will be automatically included in all generated HTML pages - Configured to load on all documentation pages ### 3. Updated Documentation Requirements **File:** `docs/requirements.txt` - Added documentation comments explaining the Speed Insights integration - Noted that no Python packages are required (JavaScript-only integration) - Provided reference to the configuration file for developers ## Implementation Details ### Why This Approach? This project uses **Sphinx** (Python-based static site generator), not a JavaScript framework like Next.js, React, or Vue. Therefore: 1. **No npm package installation required** - The `@vercel/speed-insights` npm package is designed for JavaScript frameworks 2. **Used vanilla JavaScript approach** - Following Vercel's documentation for "Other" frameworks 3. **Integrated via Sphinx's html_js_files** - Standard Sphinx approach for adding custom JavaScript ### How It Works 1. When Sphinx builds the documentation, it includes `vercel-speed-insights.js` in all HTML pages 2. The script dynamically loads Vercel's Speed Insights library from `/_vercel/speed-insights/script.js` 3. Speed Insights tracks page performance metrics automatically 4. Data appears in the Vercel dashboard after deployment ### Next Steps for the User To enable Speed Insights data collection: 1. **Enable in Vercel Dashboard:** - Navigate to your Vercel project dashboard - Go to Speed Insights settings - Click "Enable" to activate the feature 2. **Deploy to Vercel:** - Run `vercel deploy` or push to your connected Git repository - The `/_vercel/speed-insights/*` routes will be automatically available 3. **Monitor Performance:** - After users visit the site, view metrics in the Vercel Speed Insights dashboard - No additional configuration needed ## Files Modified - `docs/_static/vercel-speed-insights.js` (created) - `docs/conf.py` (modified) - `docs/requirements.txt` (modified) ## Testing - ✓ Python syntax validation passed for `docs/conf.py` - ✓ JavaScript syntax validation passed for `vercel-speed-insights.js` - ✓ Configuration follows Sphinx best practices - ✓ Implementation follows Vercel's official documentation ## Notes - This implementation is framework-agnostic and will work with any Sphinx version - No build or runtime errors introduced - Fully compatible with existing Sphinx configuration - The integration is non-intrusive and can be easily removed if needed 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 for Matter Documentation
Summary
Successfully integrated Vercel Speed Insights into the Matter (Connected Home IP) project's Sphinx-based documentation site.
What Was Implemented
1. Created Speed Insights JavaScript Integration
File:
docs/_static/vercel-speed-insights.js/_vercel/speed-insights/script.jswindow.siand dynamically loads the Speed Insights script2. Updated Sphinx Configuration
File:
docs/conf.pyhtml_js_filesconfiguration to include the Speed Insights JavaScript3. Updated Documentation Requirements
File:
docs/requirements.txtImplementation Details
Why This Approach?
This project uses Sphinx (Python-based static site generator), not a JavaScript framework like Next.js, React, or Vue. Therefore:
@vercel/speed-insightsnpm package is designed for JavaScript frameworksHow It Works
vercel-speed-insights.jsin all HTML pages/_vercel/speed-insights/script.jsNext Steps for the User
To enable Speed Insights data collection:
Enable in Vercel Dashboard:
Deploy to Vercel:
vercel deployor push to your connected Git repository/_vercel/speed-insights/*routes will be automatically availableMonitor Performance:
Files Modified
docs/_static/vercel-speed-insights.js(created)docs/conf.py(modified)docs/requirements.txt(modified)Testing
docs/conf.pyvercel-speed-insights.jsNotes
View Project · Speed Insights
Created by mrkingswingdaddy-2420 with Vercel Agent