![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@vercel/speed-insights
Advanced tools
Package description
@vercel/speed-insights is an npm package designed to provide insights into the performance of web applications. It leverages Google's Lighthouse to analyze and generate reports on various performance metrics, helping developers optimize their applications for better speed and user experience.
Generate Performance Report
This feature allows you to generate a performance report for a given URL. The `getSpeedInsights` function fetches the performance metrics and returns a detailed report.
const { getSpeedInsights } = require('@vercel/speed-insights');
async function generateReport(url) {
const report = await getSpeedInsights({ url });
console.log(report);
}
generateReport('https://example.com');
Custom Configuration
This feature allows you to customize the performance report by specifying options such as the strategy (mobile or desktop) and the categories of metrics to include in the report.
const { getSpeedInsights } = require('@vercel/speed-insights');
async function generateCustomReport(url) {
const options = {
strategy: 'mobile',
categories: ['performance', 'accessibility']
};
const report = await getSpeedInsights({ url, options });
console.log(report);
}
generateCustomReport('https://example.com');
Save Report to File
This feature allows you to save the generated performance report to a file. The `fs` module is used to write the report data to a specified file path.
const { getSpeedInsights } = require('@vercel/speed-insights');
const fs = require('fs');
async function saveReportToFile(url, filePath) {
const report = await getSpeedInsights({ url });
fs.writeFileSync(filePath, JSON.stringify(report, null, 2));
console.log(`Report saved to ${filePath}`);
}
saveReportToFile('https://example.com', './report.json');
Lighthouse is an open-source, automated tool for improving the quality of web pages. It can be run as a Chrome Extension or from the command line. It audits performance, accessibility, progressive web apps, SEO, and more. Compared to @vercel/speed-insights, Lighthouse offers a broader range of audits and can be integrated into various CI/CD pipelines.
psi (PageSpeed Insights) is a Node.js module for Google's PageSpeed Insights API. It provides performance reports and suggestions for improving the speed of web pages. While @vercel/speed-insights focuses on Lighthouse metrics, psi directly interfaces with the PageSpeed Insights API, offering a different set of performance insights.
web-vitals is a small, modular library for measuring all the Web Vitals metrics on real users. It is designed to be used in production environments to capture real user performance data. Unlike @vercel/speed-insights, which generates synthetic performance reports, web-vitals focuses on real user monitoring (RUM) to provide insights based on actual user interactions.
Readme
@vercel/speed-insights
automatically tracks web vitals and other performance metrics for your website.
This package does not track data in development mode.
It has 1st class integration with:
Framework | Package |
---|---|
Next.js | @vercel/speed-insights/next |
Nuxt | @vercel/speed-insights/nuxt |
Sveltekit | @vercel/speed-insights/sveltekit |
Remix | @vercel/speed-insights/remix |
React | @vercel/speed-insights/react |
Astro | @vercel/speed-insights/astro |
Vue | @vercel/speed-insights/vue |
It also supports other frameworks, vanilla JS and static websites.
Enable Vercel Speed Insights for a project in the Vercel Dashboard.
Add the @vercel/speed-insights
package to your project
Inject Speed Insights to your app
<SpeedInsights />
component to inject the script into your app.injectSpeedInsights()
function @vercel/speed-insights/sveltekit
in your top-level +layout.js/ts
file.inject
function add the tracking script to your app.Deploy your app to Vercel and see data flowing in.
Find more details about this package in our documentation.
FAQs
Speed Insights is a tool for measuring web performance and providing suggestions for improvement.
We found that @vercel/speed-insights demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.