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

@ralphralphai/tracker

v1.1.0

Published

Browser SDK for Ralph. Records data-track-id clicks, page views and pointer position, and streams them as compressed columnar batches.

Readme

@ralphralphai/tracker

The browser SDK for Ralph. It records clicks on tagged elements, page views and pointer position, buffers them, and streams them to the ingest API as gzipped columnar batches, roughly 8 bytes per event on the wire.

No runtime dependencies. React is a peer.

pnpm add @ralphralphai/tracker

Mount it once

GlobalTracker uses hooks, so it ships from a separate ./client entry point behind a client boundary. That keeps TrackedButton and the attribute constants importable from a Server Component without dragging a client boundary along.

import { GlobalTracker } from '@ralphralphai/tracker/client';
import { createIngestTransport } from '@ralphralphai/tracker';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        <GlobalTracker
          buildId={process.env.NEXT_PUBLIC_BUILD_ID}
          sendBatch={createIngestTransport({
            endpoint: 'https://ingest.example.com',
            apiKey: process.env.NEXT_PUBLIC_RALPH_KEY!,
          })}
        />
        {children}
      </body>
    </html>
  );
}

buildId identifies the deploy the events were recorded against. It is what lines a recorded session up with the navigation graph a crawl produced for the same build.

Tag what you want measured

import { TrackedButton } from '@ralphralphai/tracker';

<TrackedButton trackId="signup-cta" crawlFollow>
  Get started
</TrackedButton>;

trackId emits data-track-id, which makes the element's clicks reportable. Adding crawlFollow also emits data-follow-id, which tells the crawler to click this element and explore what lies beyond it. A data-track-id on its own is measured but never crawled.

The transport is injected

sendBatch is a plain function, so an app that already has an authenticated client, a queue, or a proxy route supplies its own instead of createIngestTransport:

import { encodeForTransport, type SendBatch } from '@ralphralphai/tracker';

const sendBatch: SendBatch = async (batch, { keepalive }) => {
  await fetch('/api/ralph', {
    method: 'POST',
    body: await encodeForTransport(batch),
    keepalive,
  });
};

Delivery is best effort by design. The wire format carries no client batch id and the server does not deduplicate, so the tracker drops a failed flush rather than retrying it. A retry would risk double-counting, which is worse than a gap for aggregate analytics.

Where tracking silently does nothing

The tracker needs localStorage and sessionStorage for its anonymous user and session ids. Where those throw (Safari in Lockdown Mode, some private-mode quota errors) it disables itself rather than crashing your app. Server-side rendering is a no-op for the same reason.

License

Apache-2.0