Socket
Socket
Sign inDemoInstall

@datadog/browser-rum

Package Overview
Dependencies
5
Maintainers
1
Versions
245
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @datadog/browser-rum

Datadog browser rum library.


Version published
Maintainers
1
Install size
643 kB
Created

Package description

What is @datadog/browser-rum?

The @datadog/browser-rum package is a Real User Monitoring (RUM) solution provided by Datadog. It allows developers to collect and analyze performance and user behavior data from their web applications in real-time. This data can be used to identify and troubleshoot issues, improve user experience, and monitor application performance.

What are @datadog/browser-rum's main functionalities?

Real User Monitoring

Initializes the RUM SDK to start collecting data from the user's browser, including session replay recording.

import { datadogRum } from '@datadog/browser-rum';

datadogRum.init({
  applicationId: 'YOUR_APPLICATION_ID',
  clientToken: 'YOUR_CLIENT_TOKEN',
  site: 'datadoghq.com',
  service:'your-service-name',
  // Specify a version number to identify the deployed version of your application in Datadog
  version: '1.0.0',
  sampleRate: 100,
  trackInteractions: true,
});

datadogRum.startSessionReplayRecording();

Custom User Actions

Records custom user actions, such as button clicks, with additional context.

datadogRum.addAction('button_click', { buttonId: 'my-button' });

Logging Errors

Logs errors manually with additional context to help with debugging.

datadogRum.addError(new Error('Something went wrong'), {
  context: {
    productId: 123
  }
});

User Tracking

Sets user information to track user-specific data and associate it with the collected RUM data.

datadogRum.setUser({
  id: '1234',
  name: 'John Doe',
  email: 'john.doe@example.com',
  // User-defined attributes
  plan_type: 'premium',
});

Other packages similar to @datadog/browser-rum

Changelog

Source

v1.2.5

  • 🔊🐛 [RUMF-201] add internal logs for abnormal timeOrigin (#219)
  • 🔧[e2e cbt] setup retry (#218)

Readme

Source

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)
    

FAQs

Last updated on 20 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc