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

@shakhearacom/tracktor

v0.0.47

Published

A JavaScript library for event tracking with failed events storage and retry mechanism

Readme

@shakhearacom/tracktor

Event and user tracking library with offline retry, IndexedDB storage, and a simple React/Next.js adapter.

Features

  • Anonymous/user-based tracking with encryption-aware controllers
  • Custom events, page views, interactions, performance and error tracking
  • Offline detection and retry for failed events
  • React/Next.js provider and hooks for easy integration

Installation

npm install @shakhearacom/tracktor
# or
yarn add @shakhearacom/tracktor

If you use React/Next.js:

# peer deps (if not already present)
npm install react react-dom

Quick Start (Browser)

Using ESM import:

import Tracktor from '@shakhearacom/tracktor/dist/main.js';

const t = new Tracktor();
await t.ready;

await t.authorizeUser('1234567890', { name: 'John Doe' });
await t.trackEvent('click-button', { foo: 'bar' });

Via script tag (UMD):

<script src="/dist/main.umd.js"></script>
<script>
  const t = new window.Tracktor();
  t.ready.then(async () => {
    await t.authorizeUser('1234567890', { name: 'John Doe' });
    await t.trackEvent('click-button', { foo: 'bar' });
  });
</script>

Quick Start (React / Next.js)

Wrap your app with the provider:

import { TracktorProvider } from '@shakhearacom/tracktor/react';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return <TracktorProvider>{children}</TracktorProvider>;
}

Use hooks to interact with the Tracktor:

import { useTrackEvent, useAuthorizeUser, useUser } from '@shakhearacom/tracktor/react';

export function ExampleButton() {
  const trackEvent = useTrackEvent();
  const authorizeUser = useAuthorizeUser();
  const user = useUser();

  return (
    <button
      onClick={async () => {
        await authorizeUser('1234567890', { name: 'John Doe' });
        await trackEvent('click-button', { foo: 'bar' });
      }}
    >
      Track
    </button>
  );
}

Available React APIs:

  • TracktorProvider – initializes the Tracktor in the browser
  • useTracktor() – returns { tracktor, isReady }
  • useTrackEvent() – function to send custom events
  • useAuthorizeUser() – function to authorize/set user
  • useDeauthorizeUser() – function to clear user
  • useUser() – gets the decrypted user info (async on mount)

Core API (non-React)

All methods are available on the Tracketor instance:

  • ready: Promise<void> – resolves when initialization is done
  • authorizeUser(userId, userInfo?)
  • updateUser(userId, userInfo?) – replace existing user info
  • deauthorizeUser()
  • getUser() – returns { is_authorized, user_id, user }
  • trackEvent(name, data) – sends a custom event

Initialization side-effects (based on site options):

  • Session tracking, page views, interactions, performance, and error tracking may auto-initialize

TypeScript

  • Types are emitted for public entries: . and ./react
  • tsconfig.json sets jsx to react-jsx for the React adapter

Build & Development

Commands:

npm run dev         # rollup watch for demo
npm run build       # tsup + rollup build
npm run build:secure # build + obfuscate to dist-obf

Main outputs:

  • ESM/CJS: dist/index.js, dist/index.cjs
  • React subpath: dist/react/index.js, dist/react/index.cjs
  • Browser UMD: dist/main.umd.js (+ .map, .gz)

Notes for Next.js

  • Provider only runs in the browser. Use it in client components/layouts
  • Avoid calling hooks on the server
  • The Tracktor waits for ready before allowing operations

License

MIT