# Set

The `set` API lets you add or overwrite data that RUMvision sends with a pageview.

> **Requirement:** Make sure the RUMvision JavaScript API is enabled. See [JavaScript API requirements](/md/help-center/apis/js/introduction/#requirement).

## Introduction

Use `set` for custom values that belong to the collected RUM data.

For example:

```
rumv('set', 'release', '2026.09.15');
```

Use `config` instead when you want to change how the RUMvision script itself behaves.

### Timing matters

Values added with `set` belong to the RUM data that is currently being collected.

Whenever possible, set values before RUMvision sends the relevant data. A value added later can still be included in a later beacon, but data that has already been finalized or sent cannot always be changed retroactively.

This is especially important when a value depends on consent.

For example, when storage consent is not available from the start, configure that before RUMvision initializes:

```
rumv('config', 'consent_storage', 0);
```

Then update the configuration when consent is granted:

```
rumv('config', 'consent_storage', 1);
```

### Reading values

Values written with `set` can be retrieved through `get`:

```
rumv('set', 'release', '2026.09.15');
  
  rumv('get', 'release');
  // '2026.09.15'
```

This makes it easy to inspect custom values during development without needing to know which internal object contains them.

## Set data

### Set a single value

By default, custom values are added to the current request. The key must correspond to a custom dimension that exists in your RUMvision configuration.

```
rumv('set', 'my_key', 'my value');
```

For example:

```
rumv('set', 'release', '2026.09.15');
  rumv('set', 'checkout_step', 3);
  rumv('set', 'feature_enabled', true);
```

The stored value is returned by the call.

### Set multiple values

You can pass an object to set multiple request values at once:

```
rumv('set', {
  release: '2026.09.15',
  checkout_step: 3,
  feature_enabled: true
  });
```

Do note:

- Each key is added to the current request data.
- Each key must correspond to an available custom dimension or will otherwise be ignored during data ingestion.

### Overwrite a value

`set` can overwrite an existing value:

```
rumv('set', 'checkout_step', 2);
  rumv('set', 'checkout_step', 3);
```

The latest value becomes the value stored for that key.

## Where data is stored

Custom data is stored at request level. The field must first exist as a custom dimension in RUMvision. Internal field mapping is handled automatically.

### Request

Custom data is added to the current request:

```
rumv('set', 'my_key', 'my value');
```

The `request` type is the default and recommended target for custom data.

### Custom dimensions

Custom values are only stored when the field exists as a custom dimension in your RUMvision setup.

Create the custom dimension in RUMvision first, then use its configured name with `set`.

RUMvision handles the internal field mapping automatically.

Example:

```
rumv('set', 'release', '2026.09.15');
```

## Value types

### Supported values

Strings, numbers, booleans and arrays can be used directly:

```
rumv('set', 'release', '2026.09.15');
  rumv('set', 'product_count', 4);
  rumv('set', 'logged_in', true);
  rumv('set', 'experiments', ['header-a', 'search-b']);
```

### Objects

When a plain JavaScript object is passed as a value, RUMvision converts its values to an array.

For example:

```
rumv('set', 'example', {
  first: 'a',
  second: 'b'
  });
```

is stored as a value equivalent to:

```
['a', 'b']
```

If you need separate named fields, set them as separate keys instead.

### PII sanitization

Custom request values are passed through RUMvision's request-data sanitization when applicable.

This is especially relevant for values originating from application state, data layers or other user-controlled sources.

You should still avoid intentionally sending personally identifiable information to RUMvision.

## Examples

Add a release identifier:

```
rumv('set', 'release', '2026.09.15');
```

Add multiple values:

```
rumv('set', {
  release: '2026.09.15',
  deployment: 'blue',
  feature_checkout: true
  });
```

Add a value to the session-type payload:

```
rumv('set', 'experiment', 'variant-b', 'session');
```

Add a custom metric:

```
rumv('set', 'custom_metric', 123, 'metric');
```

## Return values

| Call | Returns |
| --- | --- |
| `rumv('set', 'key', value)` | The stored value |
| `rumv('set', { key: value })` | The last stored value |
| Unknown custom dimension | May be ignored during data ingestion |

Last changed 15 September 2026
