# @rpmadden08/browser-rum-with-local-storage

> Datadog browser rum library.

Latest version **1.0.3** (published 2020-02-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @rpmadden08/browser-rum-with-local-storage
pnpm add @rpmadden08/browser-rum-with-local-storage
yarn add @rpmadden08/browser-rum-with-local-storage
bun add @rpmadden08/browser-rum-with-local-storage
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-02-10 |
| First published | 2020-02-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 189.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | rpmadden08 |

## Links

- npm: https://www.npmjs.com/package/@rpmadden08/browser-rum-with-local-storage
- npm.io page: https://npm.io/package/@rpmadden08/browser-rum-with-local-storage

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) 1.10.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) 4.6.2
- [lodash.assign](https://npm.io/package/lodash.assign.md) 4.2.0
- [@rpmadden08/browser-core-with-local-storage](https://npm.io/package/@rpmadden08/browser-core-with-local-storage.md) 1.0.3

## Recent versions

- 1.0.3 (latest) — 2020-02-10
- 1.0.2 — 2020-02-10
- 1.0.1 — 2020-02-10
- 1.0.0 — 2020-02-10

## README

# `rum`

Datadog browser rum library.

## Setup

### NPM

```
import { datadogRum } from '@rpmadden08/browser-rum-with-local-storage'
datadogRum.init({
  applicationId: 'XXX',
  clientToken: 'XXX',
  datacenter: 'us',
  resourceSampleRate: 100,
  sampleRate: 100
})
```

### Bundle

```
<script src = 'https://www.datadoghq-browser-agent.com/datadog-rum-us.js'>
<script>
  window.DD_RUM.init({
    applicationId: 'XXX',
    clientToken: 'XXX',
    datacenter: 'us',
    resourceSampleRate: 100,
    sampleRate: 100
  });
</script>
```

## Public API

- Init must be called to start the tracking. Configurable options:

  - `sampleRate`: percentage of sessions to track. Only tracked sessions send rum events.
  - `resourceSampleRate`: percentage of tracked sessions with resources collection.
  - `datacenter`: defined to which datacenter we'll send collected data ('us' | 'eu')

  ```
  init(configuration: {
      applicationId: string,
      clientToken: string,
      datacenter?: string,
      resourceSampleRate?: number
      sampleRate?: number
  })
  ```

- Modify the global context

  ```
  addRumGlobalContext (key: string, value: any)  # add one key-value to the default context
  setRumGlobalContext (context: Context)  # entirely replace the default context
  ```

- Add user action

  ```
  addUserAction (name: string, context: Context)
  ```

## TypeScript support

Types are compatible with TypeScript >= 3.0.
For earlier version, you can import js sources and use global variable to avoid any compilation issue:

```
import '@rpmadden08/browser-rum-with-local-storage/bundle/datadog-rum-us';

window.DD_RUM.init({
  applicationId: 'XXX',
  clientToken: 'XXX',
  datacenter: 'us',
  resourceSampleRate: 100,
  sampleRate: 100
});
```

---
_Source: https://npm.io/package/@rpmadden08/browser-rum-with-local-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
