JSPM

@datadog/browser-rum

1.3.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5644667
  • Score
    100M100P100Q227569F
  • License Apache-2.0

Package Exports

  • @datadog/browser-rum

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@datadog/browser-rum) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rum

Datadog browser rum library.

Setup

NPM

import { datadogRum } from '@datadog/browser-rum'
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 '@datadog/browser-rum/bundle/datadog-rum-us';

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