Sending a sample of events to Speed Insights

Learn how to send a sample of your data to Speed insights.
Last updated on August 2, 2024
Observability

By default, all events are sent to Speed Insights.

To send only a sample of your data, you can add the Speed Insights component with the sampleRate prop to your app's root layout. The sampleRate prop accepts a number between 0 and 1, where 0 is 0% and 1 is 100%:

app/layout.tsx
import { SpeedInsights } from '@vercel/speed-insights/next';
 
export default function RootLayout({ children, }: {children: React.ReactNode;}) {
  return (
    <html lang="en">
      <head>
        <title>Next.js</title>
      </head>
      <body>
        {children}
        <SpeedInsights sampleRate={0.5} />
      </body>
    </html>
  );
}