Get

The get API lets you read information that RUMvision has collected for the current pageview.

Requirement: Make sure the RUMvision JavaScript API is enabled. See JavaScript API requirements.

Introduction

You can use it to inspect all currently available RUM data, retrieve a specific group such as metrics, get a single value without knowing where it is stored, or retrieve multiple matching values with a regular expression.

Timing matters

RUMvision collects information throughout the page lifecycle. A value that is not available yet can become available later.

For example, TTFB and FCP are generally known early, while LCP, CLS and INP can change or only become final later in the pageview. Therefore:

rumv('get', 'inp'); 

may return false when no INP value has been observed yet.

Get available data

Our get API is quite versatile.

Get all data

Call get without a key to return the data currently available for the pageview:

rumv('get'); 

Depending on the moment at which it is called, this can contain objects such as:

  • session
  • request
  • meta
  • metrics
  • beacon

Not every object or value is necessarily available immediately. Some information is collected later during the page lifecycle.

Get a specific group

If you already know which group you need, pass its name:

rumv('get', 'metrics'); 

This returns the complete metrics object for the current pageview.

The same applies to other available groups:

rumv('get', 'session');
rumv('get', 'request');
rumv('get', 'meta');
rumv('get', 'beacon');

Get a single value

You do not need to know which group contains a value.

For example:

rumv('get', 'ttfb'); 

RUMvision searches through the available data and returns the first matching value.

This means you do not need to write something like:

rumv('get', 'ttfb', 'metrics'); 

The internal data structure can therefore stay out of your implementation.

If no matching value is available, false is returned.

Get multiple values (via regex)

A JavaScript RegExp can be used when you want to retrieve multiple related values.

For example, to retrieve all keys starting with ttfb:

rumv('get', /^ttfb/); 

Or all browser-related information:

rumv('get', /^browser/); 

The result is an object containing every matching key and its value:

{ browser_brand: 'Google Chrome', browser_version: 145, browser_engine: 'Blink' } 

This is especially useful for data that shares a predictable prefix.

You can use regular expressions for more specific matching as well:

rumv('get', /_time$/);
rumv('get', /^(lcp|inp)_/);
rumv('get', /browser_(brand|version)/);

For predictable key matching, avoid stateful g and y flags.

By group

Core Web Vitals

Core Web Vitals and their attribution data can be read through the same get API.

Get all collected metrics:

rumv('get', 'metrics'); 

Or get a single metric directly:

rumv('get', 'ttfb');
rumv('get', 'fcp');
rumv('get', 'lcp');
rumv('get', 'cls');
rumv('get', 'inp');

When attribution or additional metric fields are available, a regular expression is useful:

rumv('get', /^lcp/);
rumv('get', /^inp/);

Examples

Get everything currently available:

const rumData = rumv('get'); 

Get all metrics:

const metrics = rumv('get', 'metrics'); 

Get TTFB without knowing where it is stored:

const ttfb = rumv('get', 'ttfb'); 

Get all browser information:

const browser = rumv('get', /^browser/); 

Get all TTFB-related information:

const ttfb = rumv('get', /^ttfb/); 

Return values

CallReturns
rumv('get')All currently available RUM data
rumv('get', 'metrics')A specific data group
rumv('get', 'ttfb')The first matching value
rumv('get', /^ttfb/)An object with all matching key/value pairs
Unknown keyfalse