ObserveSpeed Insights
Speed Insights
Core Web Vitals from real visits to your production site, on your visitors' own phones and networks, with the slowest routes and the elements behind them. Add `@useorbits/speed-insights` and turn it on for the project. Pro plan.
How it works
Speed Insights measures how fast your pages load and respond for the people actually using them. Like Analytics, it has two halves:
- A switch on the project. Turning Speed Insights on makes your production addresses serve Orbits' script,
/_orbits/speed-insights.js, and record what it sends. - A small package in your app,
@useorbits/speed-insights, which loads that script from your site's own address.
The script measures five Web Vitals with Google's web-vitals library and sends them together, in one report per page load, when the visitor leaves the page. Reports go to /_orbits/e on your own host; they never reach your app. Only production deployments are measured.
1. Turn it on
Open the project, choose Speed Insights and press Turn on Speed Insights. Owners, admins and members can switch it; viewers can't. The change reaches your addresses within seconds. Until reports arrive, the page says Speed Insights is on and shows the snippet to add. Turn it off at the foot of the page stops it.
2. Install the package
$ npm install @useorbits/speed-insightsAdd it once, where your framework renders on every page.
Each page load is reported against the route that served it (/blog/[slug]).
import { SpeedInsights } from "@useorbits/speed-insights/next";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<SpeedInsights />
</body>
</html>
);
}With the Pages Router, render it in pages/_app.tsx instead.
For Vite, React Router, TanStack Router, Remix and other React apps:
import { SpeedInsights } from "@useorbits/speed-insights/react";
export function App() {
return (
<>
<Routes />
<SpeedInsights />
</>
);
}<script setup lang="ts">
import { SpeedInsights } from "@useorbits/speed-insights/vue";
</script>
<template>
<RouterView />
<SpeedInsights />
</template>import { injectSpeedInsights } from "@useorbits/speed-insights/sveltekit";
injectSpeedInsights();---
import SpeedInsights from "@useorbits/speed-insights/astro";
---
<SpeedInsights />With a bundler, call injectSpeedInsights() once in code that runs in the browser:
import { injectSpeedInsights } from "@useorbits/speed-insights";
injectSpeedInsights();Without one, add the script itself:
<script defer src="/_orbits/speed-insights.js"></script>Deploy to production. Reports show as real visitors browse.
What's measured
| Metric | What it tells you | Good | The element named |
|---|---|---|---|
| LCP, Largest Contentful Paint | When the main content appeared | 2.5 s or less | The largest element |
| INP, Interaction to Next Paint | How quickly the page responds to taps and clicks | 200 ms or less | The one interacted with |
| CLS, Cumulative Layout Shift | How much the layout jumps around while loading | 0.1 or less | The one that shifted most |
| FCP, First Contentful Paint | When anything first appeared | 1.8 s or less | |
| TTFB, Time to First Byte | How long the server took to start answering | 0.8 s or less |
LCP, INP, FCP and TTFB are in milliseconds; CLS is a score with no unit. Each report also carries the connection the visitor was on (4G, 3G and so on) where the browser says.
Reading the page
Choose a Device, Mobile (tablets count as mobile) or Desktop, and a Time range: 24 hours, 7 days (the default) or 30 days. Every figure is the 75th percentile (p75): the value three in four page loads did better than.
| Panel | |
|---|---|
| Real experience score | 0 to 100, from the p75s there are (below) |
| Each metric | Its p75 against the good line |
| Largest paint over time | LCP's p75, bucket by bucket |
| By route | The most visited routes, ten at most, each with every vital's p75. Slowest first sorts them |
| What's slowing it | The elements (as CSS selectors) most often behind LCP, INP and CLS, five each, with how often and their p75 |
| Connections | LCP samples by the connection they were measured on |
Routes are the ones your framework named (Next.js, SvelteKit and Astro report them), or else the path with its ids grouped (/products/8412 is /products/[id]).
How the score is worked out
Each metric's p75 is scored the way Lighthouse scores it, 90 at its good line and 50 at its median, then weighted:
| Metric | Weight |
|---|---|
| FCP | 15% |
| LCP | 30% |
| INP | 30% |
| CLS | 25% |
TTFB is shown, not scored. With no reports at all, there is no score.
Options
<SpeedInsights /> takes the same options as injectSpeedInsights():
| Option | Default | |
|---|---|---|
sampleRate | 1 | The share of page loads that report, from 0 to 1. On a busy site, 0.5 reports half. |
beforeSend | A function that gets each report before it's sent. Return it, changed or not, or null to drop it. | |
mode | "auto" | "development" measures nothing; "auto" is development in a dev build or on localhost. |
debug | false | Log each report the script sends. |
scriptSrc | "/_orbits/speed-insights.js" | Where the script is loaded from. |
endpoint | "/_orbits/e" | Where reports go. |
<SpeedInsights sampleRate={0.5} />The Astro component can't take a function: set window.orbitsSpeedInsightsBeforeSend before it renders instead.
Privacy
Speed Insights follows the same rules as Analytics: no cookies, no IP addresses stored, nothing sent in development, and bots and headless browsers left out. See Analytics › Privacy.
In the weekly summary
When the team's weekly summary is on, it includes mobile Web Vitals from the busiest project that has Speed Insights.
From the API
| Call | |
|---|---|
GET /v1/teams/{team}/projects/{project}/speed-insights?device=mobile&range=7d | The page's numbers. { "enabled": false } while it's off |
PUT .../speed-insights with { "enabled": true } | Turn it on or off. On Free, turning it on is 402 with code: plan_required |
See API › Insights.