Socket
Socket
Sign inDemoInstall

@datadog/browser-core

Package Overview
Dependencies
0
Maintainers
1
Versions
248
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @datadog/browser-core

Datadog browser core utilities.


Version published
Maintainers
1
Install size
958 kB
Created

Package description

What is @datadog/browser-core?

The @datadog/browser-core package is a core library for Datadog's Real User Monitoring (RUM) and logging libraries. It provides foundational functionality for monitoring web applications, including the collection of telemetry data, handling of browser events, and communication with Datadog's servers.

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

Telemetry Data Collection

This code initializes the Datadog RUM SDK, which relies on @datadog/browser-core to collect telemetry data such as performance metrics, errors, and user actions.

import { datadogRum } from '@datadog/browser-rum';
datadogRum.init({
  applicationId: 'YOUR_APP_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,
});

Error Tracking

This code snippet demonstrates how to initialize Datadog's logging library, which uses @datadog/browser-core to track and forward errors to Datadog's servers for monitoring and alerting.

import { datadogLogs } from '@datadog/browser-logs';
datadogLogs.init({
  clientToken: 'YOUR_CLIENT_TOKEN',
  site: 'datadoghq.com',
  forwardErrorsToLogs: true,
  sampleRate: 100
});
datadogLogs.logger.error('Error message', { error: new Error('Error stack') });

User Action Tracking

This code demonstrates how to manually track user actions such as clicks, which can be used to measure user interaction and engagement within the application.

import { datadogRum } from '@datadog/browser-rum';
datadogRum.startUserAction('click', 'button clicked', {
  element: document.getElementById('submit-button')
});
// After the action is completed
setTimeout(() => {
  datadogRum.stopUserAction();
}, 1000);

Other packages similar to @datadog/browser-core

Changelog

Source

v4.50.0

  • ✨ [RUM-1062] add a prefix to all console message displayed by the SDK (#2432)
  • ✨ [extension] add columns to the event list (#2372)
  • ✨ [extension] revamp event description and JSON viz (#2371)
  • ✨ [extension] revamp filter UI (#2370)
  • ✨ [extension] filter outdated events (#2369)
  • 🐛 [RUM-1085] Remove lock usage from Local Storage strategy (#2435)
  • ♻️ rename scroll fields (#2439)
  • 🔇 Remove cwv attribution telemetry
  • ♻️ [RUM-1039] Harmonize view tests (#2430)
  • Report scroll metrics when page is resized (#2399)
  • ♻️ [RUM-253] adapt transport to send encoded data (#2415)
  • 🔊 [RUM-253] customize deflate worker failure logs (#2414)
  • ♻️ Use performance entry fixtures in tests (#2428)
  • ⚗️ [RUM-1020] Collect core web vitals target selectors (#2418)

Readme

Source

core

Datadog browser core utilities.

FAQs

Last updated on 26 Sep 2023

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