Book a call Free rebuild
Home/Glossary/Performance/User Timing API

User Timing API

November 21, 2022 Updated November 16, 2026 2 min read

Performance glossaryThe User Timing API lets developers mark moments in their own code and measure the time between them, to see how long specific parts of a page take.

The User Timing API is a small browser API for measuring a site's own code. Built-in metrics such as Largest Contentful Paint describe the page as a whole; they cannot say how long a product filter took to update or a booking widget took to appear. User Timing fills that gap with two tools: marks, which record a named timestamp, and measures, which record the time between two marks.

How it works

performance.mark('filter-start');
applyFilters();
performance.mark('filter-end');
performance.measure('filter', 'filter-start', 'filter-end');

const [entry] = performance.getEntriesByName('filter', 'measure');
console.log(entry.duration); // milliseconds

Marks and measures go into the browser's performance timeline alongside resource and navigation timings. Their timestamps are high resolution, counted in fractions of a millisecond from the start of the page load, and unlike Date.now() they are not affected by changes to the system clock. Browsers deliberately reduce that precision slightly for security reasons.

Current versions of the API also accept an options object, so a measure can be given explicit start and end times, or a detail field with extra data. MDN documents the full interface under performance.mark().

Where the results appear

  • Chrome DevTools shows marks and measures in the Timings track of the Performance panel, lined up with everything else the page did.
  • Lighthouse, and therefore PageSpeed Insights, lists them under "User Timing marks and measures".
  • Scripts on the page can read them with performance.getEntriesByType('measure') or a PerformanceObserver and send them to an analytics or monitoring service. That gives real-user data for the parts of the site that matter most.

Typical uses

  • Timing how long a single-page app takes to render a view after navigation.
  • Measuring an AJAX or fetch() request from click to updated screen.
  • Timing a third-party widget, such as a map, chat, or booking tool, from load to ready.
  • Checking whether a code change made a specific interaction faster, before and after release.

Tips

  • Use consistent, descriptive names, such as checkout:render-start, so entries are easy to find and filter.
  • On long-lived pages, clear entries that are no longer needed with performance.clearMarks() and performance.clearMeasures().
  • Measure what people actually wait for, not internal steps nobody notices.

Source: W3C User Timing specification.

WP Services

WordPress services at revolutionary pricing.

Productized WordPress services, from builds to care, delivered by Seahawk and tracked in one app. For the WordPress lovers.