# Timing and measurements

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Fjavascript%2Fbrowser-sdk%2Ffeatures%2Ftiming-and-measurements.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Fjavascript%2Fbrowser-sdk%2Ffeatures%2Ftiming-and-measurements.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

### Custom measurement[​](#custom-measurement "Direct link to Custom measurement")

Custom measurement allows you to send numeric data to Coralogix for precise monitoring and analysis.

```
CoralogixRum.sendCustomMeasurement('my-page-load', 1000);
```

### Add timing[​](#add-timing "Direct link to Add timing")

Add timing is a simple API to add extra performance timing to your RUM data.<br />The timing relates to the time between the page load and the moment the timing is added.<br />For example, you can add a timing for the first click event.

```
window.addEventListener('click', function handler() {

  window.removeEventListener('click', handler);



  CoralogixRum.addTiming('first-click');

});
```

OR

You can provide your own timing.

```
window.addEventListener('click', function handler() {

  window.removeEventListener('click', handler);



  CoralogixRum.addTiming('first-click', 1000);

});
```

### Custom time measurement[​](#custom-time-measurement "Direct link to Custom time measurement")

Custom time measurement allows you to track the time between two points by starting a timer with `startTimeMeasure` and stopping it with `endTimeMeasure`, using a unique name to identify each measurement. Labels can be added at the start for additional context.

```
CoralogixRum.startTimeMeasure('login', {

  paymentMethod: 'visa',

  userTheme: 'dark',

});
```

```
CoralogixRum.endTimeMeasure('login');
```

A few behaviours worth knowing:

* Starting a key while a measurement for it is still in progress does nothing, and neither does a blank key: `startTimeMeasure` returns and the running timer is left alone.
* `endTimeMeasure` takes only the key, so there is no way to pass labels at the end. The object handed to `startTimeMeasure` is held by reference, and at the end it is merged over the SDK's global labels as they stand then - so a later `CoralogixRum.setLabels()` does affect the result.
* Ending a measurement releases its key, so the same key can be measured again afterwards.
* Open measurements are dropped the next time you start or end one while the session is idle. The check runs on those calls rather than on a timer, and activity clears the idle flag, so a measurement spanning a short idle gap may still report.
