Guide
How to measure Core Web Vitals with Umami on WordPress
Umami can record how fast your pages load and respond for the people who actually visit them. It takes one attribute on the tracking script. This guide shows where to add it on WordPress and how to read the results.
Short answer
To measure Core Web Vitals with Umami on WordPress, add data-performance="true" to the Umami script tag, or switch on Core Web Vitals under Settings → WPUmami → Events in Connect for Umami. You need Umami 3.1 or newer. Umami then measures LCP, INP, CLS, FCP and TTFB from real visitors and shows p50, p75 and p95 for each on the website's Performance tab.
What Umami measures
Five metrics, measured in each visitor's browser as they use your site.
| Metric | Stands for | What it measures | Google's "good" mark |
|---|---|---|---|
| LCP | Largest Contentful Paint | How long it takes for the largest visible element on the page to be shown | 2.5 seconds or less |
| INP | Interaction to Next Paint | How quickly the page responds when a visitor clicks, taps or types | 200 milliseconds or less |
| CLS | Cumulative Layout Shift | How much the content shifts around unexpectedly. Lower is better | 0.1 or less |
| FCP | First Contentful Paint | How long it takes for the first content to appear on screen | 1.8 seconds or less |
| TTFB | Time to First Byte | How long it takes from the request until the first byte of the server's response arrives | 0.8 seconds or less |
The "good" marks are Google's, as published on web.dev, and are judged at the 75th percentile of visits. Strictly, Google's Core Web Vitals are LCP, INP and CLS. FCP and TTFB are supporting metrics that help explain a slow LCP.
What you need
- Umami 3.1 or newer. Performance tracking was added in v3.1.0. If you host Umami yourself, update first: older versions ignore the attribute.
- The Umami tracker on your site. If it is not there yet, start with how to add Umami to WordPress.
The measuring is done by the Umami tracker itself, the same script that counts your pageviews, so there is no second script to load. Because the numbers come from real visits, they reflect the devices and connections your visitors really use.
<script defer src="https://cloud.umami.is/script.js" data-website-id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" data-performance="true"></script>How to turn on Core Web Vitals in Umami on WordPress
The change is the same wherever your tracking code lives: one more attribute on the script tag.
Check your Umami version
Core Web Vitals need Umami 3.1 or newer. On a self-hosted instance, update Umami before you go on.
Add the attribute to the script tag
If you pasted the tracking code into a header-scripts box or your theme, add
data-performance="true"to the tag, as shown above. If you enqueue the script infunctions.php, use the snippet below. If you use Connect for Umami, tick Core Web Vitals on the Events tab instead.Clear your page cache
Cached pages still contain the old tag. Clear the page cache, and the CDN cache if you have one, so visitors receive the new tag.
Confirm the attribute is on the page
Open your site in a private browser window, view the page source and search for
data-performance. It should be on the Umami script tag.Open the Performance tab in Umami
In Umami, open the website and click the Performance tab. Figures build up as real visitors load your pages, so give a quiet site some time.
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_script(
'umami',
'https://cloud.umami.is/script.js', // Your script URL.
array(),
null,
array( 'strategy' => 'defer', 'in_footer' => false )
);
} );
// Add the website ID and switch on Core Web Vitals (Umami 3.1+).
add_filter( 'script_loader_tag', function ( $tag, $handle ) {
if ( 'umami' !== $handle ) {
return $tag;
}
$attributes = 'data-website-id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" data-performance="true"';
return str_replace( '<script ', '<script ' . $attributes . ' ', $tag );
}, 10, 2 );Put the snippet in a child theme's functions.php or a code-snippets plugin, and replace the script URL and website ID with your own. If you already enqueue the tracker with the snippet from the setup guide, do not add a second copy. Add data-performance="true" next to the website ID in the filter you have.
The no-code method: one switch in Connect for Umami
The plugin adds the same attribute for you.
Open the Events tab
In WordPress, go to Settings → WPUmami → Events and find the Performance section.
Tick Core Web Vitals and save
Tick Core Web Vitals and click Save Changes. The plugin adds
data-performance="true"to the tracker on every front-end page. Leave Automatic tracking on the Tracking tab switched on, or the tracker does not start and nothing is measured.Check in a private window
The plugin leaves out logged-in administrators by default, so the script is not on the page while you are logged in. View the source in a private window to see the attribute.
How to read the Performance tab
Each metric has its own card. Select a card to focus the chart on that metric, and use the Percentile dropdown to switch between p50, p75 and p95. Umami rates each metric against Google's thresholds as good, needs improvement or poor. Below the chart, the selected metric is broken down by page and by device or browser, which is how you find the slow template or the slow device type.
What p50, p75 and p95 mean
| Percentile | Meaning | Use it for |
|---|---|---|
| p50 | The median. Half of visits were this good or better | A typical visit |
| p75 | 75% of visits were this good or better. This is the one Google uses to score Core Web Vitals | Judging whether a page passes |
| p95 | Only the slowest 5% of visits were worse than this | Finding the worst experiences |
If you send pageviews yourself
Some sites switch off Umami's automatic tracking with data-auto-track="false" and call umami.track() by hand. That also stops performance tracking from starting. Keep automatic tracking on and switch off only the automatic pageview with data-auto-pageview="false". This setup needs Umami v3.2.0 or later.
<script defer src="https://cloud.umami.is/script.js" data-website-id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" data-performance="true" data-auto-pageview="false"></script>Connect for Umami has no switch for data-auto-pageview. Developers can add it with the cfumami_tracker_attributes filter, which receives the script tag's attributes as an array of names and values.
Frequently asked questions
Does Umami track Core Web Vitals?
Yes, from version 3.1. Add data-performance="true" to the Umami script tag and the tracker measures LCP, INP, CLS, FCP and TTFB in your visitors' browsers. The results are on the website's Performance tab in Umami.
Which Umami version do I need for Core Web Vitals?
Umami 3.1 or newer. If you track pageviews manually and use data-auto-pageview="false", you need v3.2.0 or later. Older versions ignore the attribute.
Where do I see Core Web Vitals in Umami?
Open the website in Umami and click the Performance tab. Select a metric card to chart it, and use the Percentile dropdown to switch between p50, p75 and p95.
What does p75 mean in Umami?
It is the 75th percentile: 75% of visits were at this value or better. Google uses the 75th percentile to score Core Web Vitals, so it is the figure to judge a page by.
Why are Umami's numbers different from a speed test?
A speed test loads a page once, from one machine on one connection. Umami records real visits, across the devices and connections your visitors use, so the figures differ. To judge how the site performs for visitors, go by Umami's p75.
Does measuring Core Web Vitals add another script to my site?
No. The Umami tracker you already load does the measuring once data-performance="true" is on its script tag. In Connect for Umami it is one switch on the Events tab, off by default.
Connect WordPress to Umami in about two minutes
One plugin: the tracking script, events, store revenue and your stats inside WordPress. Plans start at $12 a year, with a 14-day money-back guarantee.