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

deltatrack

v0.1.3

Published

Lightweight JS error monitoring SDK

Downloads

175

Readme

delatrack

Lightweight JavaScript monitoring SDK for capturing errors, performance metrics, and network events in the browser.

## Features

- Automatic uncaught error and unhandled rejection capturing (via `init`).
- Manual error reporting via `captureError`.
- Small helper modules to capture network calls and performance metrics (see `src/network.js` and `src/performance.js`).
- Sends events to a backend ingest endpoint (`src/config.js`).

## Quick start
  1. Install the package (example name from package.json):
npm install deltatrack
# or
yarn add deltatrack
  1. Initialize the SDK in your app (example using ESM imports / bundler):
import { init, captureError } from 'deltatrack';

// Call once during app startup
init({ projectKey: 'YOUR_PROJECT_KEY' });

// Manually capture an error
try {
	// some code that throws
} catch (err) {
	captureError(err);
}

If you use the built UMD bundle (dist/index.umd.js) you can also include the script directly and access the SDK from the global export (after you build/publish the package).

Public API

  • init({ projectKey })

    • projectKey: string (required) — sets the project API key used when sending events.
    • Calls initErrorTracking() which attaches window.onerror and window.onunhandledrejection handlers.
  • captureError(error)

    • error: Error — sends a manual error event to the ingest endpoint.

Notes:

  • The library's entry file (src/index.js) currently exports only init and captureError. The helper modules for network and performance capture live in src/network.js and src/performance.js. You can import those directly from source during development or wire them into your bundler output if you want to enable automatic network/perf capture.

Example using the helper modules directly (when available in your bundle):

import { captureNetworkEvents } from 'deltatrack/src/network';

captureNetworkEvents( 'my-project-id');

Development

  1. Install dev dependencies:
npm install
  1. Build the library (the repo uses Rollup):
npm run build
  1. The build outputs are configured in package.json (dist/index.cjs.js, dist/index.esm.js, dist/index.umd.js).

Troubleshooting

  • Events not appearing in your backend?

    • Ensure INGEST_URL in src/config.js points to your ingest endpoint.
    • Confirm your backend is accepting POST requests with Content-Type: application/json and the x-project-key header.
    • If projectKey is not set via init, events will be dropped (the SDK logs a warning in that case).
  • Network/performance helpers not working?

    • Those helpers rely on window globals and must run in a browser environment.
    • Ensure your bundler includes those modules in the final bundle or import them directly from source during app initialization.

-## Next steps / suggestions

  • JavaScript usage

    If you're using plain JavaScript, import just the functions you need from the package (for example, init and captureError). If you want to enable the network and performance helpers, consider exporting captureNetworkEvents from the main entry file so they're easier to discover and import.

  • TypeScript usage

    To get proper typing when using TypeScript, add a declaration file named deltatrack.d.ts to your project (or include types in the package). Here's a minimal, ready-to-use example you can copy and adapt to match your exported API:

    declare module 'deltatrack' {
    	export interface InitOptions {
    		// API key for your project (required)
    		projectKey: string;
    		// Optional: override the default ingest URL at runtime
    		ingestUrl?: string;
    	}
    
    	export function init(options: InitOptions): void;
    	export function getProjectKey(): string | null;
    	export function captureError(error: Error | string, context?: Record<string, any>): void;
    
    	// Helpers for network and performance capture. Signatures include
    	// optional parameters so they match the helper modules in `src/`.
    	export function captureNetworkEvents(backendUrl?: string, projectId?: string): void;
    }

    Note: adjust these declarations to exactly match the symbols you actually export from your package. If you don't expose getProjectKey from the public API, remove it from the declaration or add it to src/index.js.

  • Recommended improvements

  • Consider exposing captureNetworkEvents from the main entry (src/index.js) if you want them to be part of the documented public API.

  • Make the ingest URL configurable at runtime (e.g., accept an ingestUrl option in init) instead of hard-coding it in src/config.js.

License

MIT