npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@logzio/browser

v1.1.0

Published

Library for collecting Real User Monitoring (RUM) in JavaScript and forwarding to Logz.io.

Readme

Logz.io Real User Monitoring

License npm

[!IMPORTANT] LogzioRUM is still in beta phase, breaking changes may be introduced.

This package wraps OpenTelemetry JavaScript for web and provides a simple API to collect and send real user monitoring data to Logz.io.

Table of content

Setup

Install the dependency:

npm install @logzio/browser

Call LogzioRUM.init() to initialize the RUM client. This should be done as early as possible in your application lifecycle.

LogzioRUM.init({
  region: <<LOGZIO_REGION_CODE>>,
  tokens: {
    traces: <<LOGZIO_TRACES_TOKEN>>,
    logs: <<LOGZIO_LOGS_TOKEN>>, // Required unless enable.errorTracking, enable.consoleLogs, enable.viewEvents, and enable.webVitals are all set to false
  },
  endpoint: {
    url: "<<LOGZIO_RUM_URL>>",
  },
  service: {
    name: <<SERVICE_NAME>>,        // Optional
    version: <<SERVICE_VERSION>>,  // Optional
  },
  customAttributes: {
    //// Optional, extra fields containing user metadata to be sent with each event
    //// example:
    // user.name: user.name,
    // user.id: user.id,
    // "user.role": user.role,

    // recommended: add env field (prod, dev, staging...)
    env_id: "prod"
  },
});

Configuration Options

| Parameter Name | Description | Required/Optional | Default | | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | --------------------------- | | region | The Logz.io account region code (e.g., us, eu, au, uk, ca) | Required | us | | tokens.traces | The Logz.io traces shipping token | Required | - | | tokens.logs | The Logz.io logs shipping token. Required unless enable.errorTracking, enable.consoleLogs, enable.viewEvents, and enable.webVitals are all set to false. | Required* | - | | endpoint.url | Endpoint URL to send the collected data to in OTLP. | Required | - | | endpoint.addSuffix | Whether to append data type suffixes (/traces, /logs) to the endpoint URL. | Optional | false | | service.name | The name of the service being monitored. | Optional | "" | | service.version | The version of the service being monitored. | Optional | "" | | session.maxDurationMs | The maximum duration of a session in ms. | Optional | 4 * 60 * 60 * 1000 (4h) | | session.timeoutMs | If a user is inactive for this duration, the session will end. | Optional | 15 * 60 * 1000 (15m) | | enable.userActions | Enable user actions tracking. | Optional | true | | enable.navigation | Enables SPA route change detection and treats them as new views. | Optional | true | | enable.documentLoad | Enables the initial page load span. | Optional | true | | enable.resourceLoad | Enable resource loading tracking such as XHR, fetch, scripts, images. | Optional | true | | enable.errorTracking | Enable exceptions tracking. | Optional | true | | enable.frustrationDetection | Enable frustration detection such as rage clicks, dead clicks and heavy load times. Frustration signals will be marked on trace spans. | Optional | true | | enable.webVitals | Enable web vitals tracking (FCP, LCP, CLS, INP, TTFB). Web vitals will be emitted as logs. | Optional | true | | enable.viewEvents | Enable view end log event which contains the duration to indicate the current session state. | Optional | false | | enable.consoleLogs | Enable console logs tracking. If turned off, no console logs will be sent. | Optional | false | | environmentData.collectOS | Enable collection of user operating system name, version and type information. | Optional | true | | environmentData.collectBrowser | Enable collection of user browser name, version and engine | Optional | true | | environmentData.collectDevice | Enable collection of user device type and screen dimensions | Optional | true | | environmentData.collectLanguage | Enable collection of user language and timezone | Optional | true | | customAttributes | Extra fields containing data to be sent with each event. (such as user context) | Optional | {} | | propagateTraceHeaderCorsUrls | A list of Backend URLs to propagate the trace header to. | Optional | [] | | samplingRate | The rate in which spans are sampled. | Optional | 100(%) | | frustrationThresholds.rageClickCount | The number of clicks within rageClickIntervalMs to consider a click as a rage click. | Optional | 3 | | frustrationThresholds.rageClickIntervalMs | The time interval in milliseconds to consider for rage clicks. | Optional | 1000 (1s) | | frustrationThresholds.heavyLoadThresholdMs | The time in milliseconds to consider a page load as heavy. | Optional | 2000 (2s) | | logLevel | The log level of the RUM library. | Optional | 'info' |

Dynamically inject attributes

You can dynamically inject attributes that will be added to all data generated by the library by using the LogzioRUM.setAttributes() method. This allows you to add or update attributes at runtime, which can be useful for capturing user-specific data or application state.

LogzioRUM.setAttributes({
  ...LogzioRUM.getAttributes(),
  theme: 'dark',
});

[!NOTE] Please note that the LogzioRUM.setAttributes() method will override any existing attributes.

Correlate Browser Traces with Backend Traces

To correlate browser traces with backend traces, you need to follow the below steps, to ensure that the traceparent header is sent with requests to your backend services.

Step 1

Configure the propagateTraceHeaderCorsUrls option with the URLs of your backend services. This will ensure that the traceparent header is sent with requests to these services.

LogzioRUM.init({
  // ... other options
  propagateTraceHeaderCorsUrls: [
    'https://api.example.com', 
    'https://backend.example.com'
  ]
});

Step 2

The traceparent header is not CORS-safelisted, so you need to configure your backend to accept it and use it in your backend tracing implementation.

Collected Data

Web Vitals (Logs)

When enable.webVitals is set to true, the SDK collects and emits the following web vitals as log events:

| Metric | Description | Unit | | ----------------------------------- | --------------------------------------------------- | ---------------- | | FCP (First Contentful Paint) | Time to first visible paint | ms | | LCP (Largest Contentful Paint) | Time until the largest visible element renders | ms | | CLS (Cumulative Layout Shift) | Visual stability across the session | score (unitless) | | INP (Interaction to Next Paint) | Response time to next paint after user interactions | ms | | TTFB (Time to First Byte) | Time from navigation start to first byte received | ms |

Each web vital log includes detailed attribution data to help diagnose performance issues.

Frustration Signals (Traces)

When enable.frustrationDetection is set to true, the SDK detects and marks spans with frustration attributes:

| Frustration Type | Description | | ---------------- | ------------------------------------------------------------------ | | Dead Click | User clicks on an element that doesn't trigger any visible action | | Rage Click | Multiple rapid clicks on the same element (configurable threshold) | | Error Click | Click followed immediately by an error | | Heavy Load | Page or navigation load exceeds threshold (configurable) |

Changelog

Please see CHANGELOG.md for the latest changes.

Contributing

Please see CONTRIBUTING.md ❤️