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

@9apes/rum-sdk

v0.1.2

Published

**Real User Monitoring by [9Apes](https://9apes.com)**

Downloads

48

Readme

@9apes/rum-sdk

Real User Monitoring by 9Apes

Production-grade RUM SDK for tracking performance, errors, user behavior, and session replay — all in one lightweight package.


Overview

@9apes/rum-sdk is part of the 9Apes observability platform. It captures real user data from your web applications and streams it to your 9Apes dashboard, giving you full visibility into how your product performs in the wild.

A valid 9Apes API key is required. Get yours at 9apes.com.

What it tracks

  • Core Web Vitals — CLS, INP, FCP, LCP, TTFB
  • Errors — JS exceptions, resource errors, unhandled promise rejections with full stack traces and severity classification
  • Performance — Navigation timing, resource timing, memory usage
  • User behavior — Clicks, scrolls, form interactions, rage click detection, automatic action tracking
  • Network — Fetch/XHR request monitoring
  • Session replay — rrweb-based full session recording with privacy controls and console capture
  • CPU monitoring — Frame-based CPU usage estimation with dropped frame detection
  • Long Animation Frames — Script-level attribution for UI jank (Chrome 123+)

Installation

pnpm add @9apes/rum-sdk

Quick Start

import { initWatchdog } from '@9apes/rum-sdk';

initWatchdog({
  apiKey: 'YOUR_API_KEY',
  env: 'production',     // optional — filter by environment in the dashboard
  userId: 'user-123',    // optional
});

That's it. With just an API key, the SDK automatically begins collecting Web Vitals, errors, performance data, and user behavior. All data is batched and sent to your 9Apes dashboard.


Configuration

Required

| Field | Type | Description | | -------- | -------- | ------------------------------------------------------- | | apiKey | string | Your 9Apes API key. Obtain from the 9Apes dashboard. |

Optional

initWatchdog({
  apiKey: 'YOUR_API_KEY',

  // Identity & environment
  userId: 'user-123',
  env: 'production',        // Sent with every event — filter by environment in the dashboard

  // Sampling (cost control)
  sampleRate: 100,                    // % of sessions to track (0-100, default: 100)
  sessionRecordingSampleRate: 50,     // % of tracked sessions with session replay (0-100, default: 100)

  // Feature toggles
  enableWebVitals: true,
  enableErrorTracking: true,
  enablePerformanceTracking: true,
  enableBehaviorTracking: true,
  enableBusinessMetrics: true,
  enableSessionRecording: false,

  // Privacy
  enablePrivacyMode: false,
  sensitiveSelectors: ['.credit-card', '#ssn'],
  maskAllInputs: true,

  // Console recording (when session recording is on)
  enableConsoleRecording: true,
  consoleRecordingLevels: ['log', 'warn', 'error', 'info', 'debug'],

  // Error behavior
  sendCriticalErrorsImmediately: true,

  // Action tracking
  enableActionTracking: true,
  actionAttributeName: 'data-watchdog-action',
  excludeActionSelectors: ['.ignore-tracking'],

  // Debugging
  debug: false,
});

API Reference

Core

initWatchdog(config: WatchdogConfig): void

Initialize the SDK. Must be called before any other function.

destroyWatchdog(): void

Tear down the SDK, flush remaining events, and release all resources.


Tracking

trackFeatureUsage(featureName: string, context?: object): void

Track product feature adoption.

trackFeatureUsage('export-pdf', { format: 'a4', pages: 10 });

trackConversion(event: string, value?: number, metadata?: object): void

Track conversion and revenue events.

trackConversion('purchase', 99.99, { productId: '123', quantity: 2 });

trackError(error: Error | string, context?: object): void

Manually report an error (useful for framework-level error boundaries).

trackError(error, { component: 'Checkout', info: 'Payment failed' });

addCustomBreadcrumb(message: string, data?: object): void

Add a breadcrumb for richer error context.

addCustomBreadcrumb('User clicked checkout', { cartItems: 3, total: 149.99 });

Session Control

pauseRecording(): void

Pause session recording — use on sensitive screens (e.g. payment forms).

resumeRecording(): void

Resume session recording.

updateUserId(userId: string): void

Update the user ID after login or authentication.


Utilities

forceFlush(): void

Immediately flush all buffered events to the 9Apes backend.

getAnalyticsStatus(): object | null

Returns current SDK status.

const status = getAnalyticsStatus();
// {
//   isRecording: true,
//   sessionId: '...',
//   bufferSize: 5,
//   collectors: ['WebVitalsCollector', 'ErrorCollector', ...]
// }

Middleware System

Extend the event pipeline with custom middleware. Three hooks are available:

| Hook | Purpose | | ---------------- | -------------------------------------------- | | onPreCollect | Filter or modify events before collection | | onPostCollect | Enrich events after collection | | onPreSend | Transform the full batch before transmission |

import { registerMiddleware } from '@9apes/rum-sdk';

registerMiddleware({
  name: 'build-tagger',

  onPostCollect(event) {
    return { ...event, buildVersion: '2.1.0' };
  },

  onPreSend(batch) {
    return { ...batch, metadata: { release: 'v2.1.0' } };
  },
});

Built-in Middleware

The SDK ships with enrichers that run automatically:

  • BreadcrumbEnricher — attaches breadcrumb trail to error events
  • SessionEnricher — adds session-level metrics
  • ViewportEnricher — adds device category and viewport dimensions
  • ConnectionEnricher — adds network quality classification

Framework Integrations

React

import { useEffect } from 'react';
import { initWatchdog, updateUserId } from '@9apes/rum-sdk';

function App() {
  useEffect(() => {
    initWatchdog({ apiKey: process.env.REACT_APP_9APES_KEY! });
  }, []);

  const handleLogin = (user) => {
    updateUserId(user.id);
  };

  return <YourApp />;
}

Next.js

// app/providers.tsx  (or pages/_app.tsx)
import { useEffect } from 'react';
import { initWatchdog } from '@9apes/rum-sdk';

export function Providers({ children }) {
  useEffect(() => {
    initWatchdog({ apiKey: process.env.NEXT_PUBLIC_9APES_KEY! });
  }, []);

  return <>{children}</>;
}

Vue

import { createApp } from 'vue';
import { WatchdogVuePlugin } from '@9apes/rum-sdk';
import App from './App.vue';

const app = createApp(App);

app.use(WatchdogVuePlugin, {
  apiKey: import.meta.env.VITE_9APES_KEY,
});

app.mount('#app');

License

This software is proprietary and provided under a commercial license by 9Apes Technologies. Unauthorized copying, modification, distribution, or use of this software outside the terms of your subscription agreement is strictly prohibited.

Refer to your service agreement or contact [email protected] for licensing details.


Support

| Channel | Details | | ------------------------ | ---------------------------------------------------- | | Documentation | docs.9apes.com | | Email | [email protected] | | Dashboard | app.9apes.com |

For enterprise support plans and SLAs, contact your account manager.