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

@jakobinn/analyticsotter

v0.1.0

Published

Client-side analytics tracker.

Readme

Short answer: No. That README describes @jakobinn/aj-client-sdk (single package). You’ve split into core + adapters and changed names/behavior. Here’s an accurate, paste-ready README for the new setup.


AJ Analytics — Monorepo

Lightweight analytics client with batching and graceful flushing. Targets Web, React Native, and Node via thin adapters over a shared Core.

Packages

  • @jakobinn/aj-analytics-core — shared types, constants, client class
  • @jakobinn/aj-analytics-web — browser adapter (adds optional campaign/referrer auto-tracking)
  • @jakobinn/aj-analytics-react-native — RN adapter (safe RN environment detection)
  • @jakobinn/aj-analytics-node — Node adapter (server-side usage)

If you’re building for a specific runtime, install that adapter (it re-exports the client). If you only need types/utilities across runtimes, depend on core.

Install

# pick what you use
npm i @jakobinn/aj-analytics-web
npm i @jakobinn/aj-analytics-react-native
npm i @jakobinn/aj-analytics-node

# shared
npm i @jakobinn/aj-analytics-core

Quick start

Web (browser)

import { AnalyticsJJClient } from '@jakobinn/aj-analytics-web';

const analytics = new AnalyticsJJClient({
  apiKey: 'YOUR_PUBLIC_OR_SERVER_KEY',
  // host optional in browser: defaults to current origin => POST /api/v1/track
  refer: true,   // auto-track ?trc11 and external referrers (once per session)
  debug: false,
});

analytics.track('SCREEN_VIEW', 'HOME_SCREEN_OPENED', { userId: 'user_123' });
analytics.feedback('FEATURE_RATING', 'FEATURE_MODAL', { rating: 5, text: 'Great!' });
await analytics.flush();

React Native

import { AnalyticsJJClient } from '@jakobinn/aj-analytics-react-native';

const analytics = new AnalyticsJJClient({
  apiKey: 'YOUR_SERVER_API_KEY',
  host: 'https://your-analytics.example.com', // REQUIRED in RN
  runtime: 'react_native',
  debug: false,
});

Node

import { AnalyticsJJClient } from '@jakobinn/aj-analytics-node';

const analytics = new AnalyticsJJClient({
  apiKey: 'YOUR_SERVER_API_KEY',
  host: 'https://your-analytics.example.com', // REQUIRED in Node
  runtime: 'server',
});

Configuration

| key | type | default | notes | | | | | | ------------------ | ------- | ------- | -------------------------------------------------------------------------------------- | --------------- | -------- | ----- | -------------------------------- | | apiKey | string | — | Sent as Authorization: Bearer <apiKey> header. | | | | | | host | string | '' | Browser: optional (uses current origin). Node/RN: required (absolute URL). | | | | | | flushInterval | number | 5000 | ms after last event before auto-flush. | | | | | | batchSize | number | 20 | flush immediately when queue ≥ size. | | | | | | refer | boolean | false | Web-only. Tracks ?trc11 and external document.referrer once per session. | | | | | | runtime | string | — | e.g. `'browser' | 'react_native' | 'server' | 'app' | 'client'`. Added to each event. | | setUserTimestamp | boolean | false | Adds ISO user_timestamp to each event. | | | | | | debug | boolean | false | Logs request diagnostics and warnings. | | | | |

Environment auto-detection: if properties.environment isn’t set, the client uses process.env.ENVIRONMENT (or NODE_ENV) when available: production | development | test.

API

new AnalyticsJJClient(config: {
  apiKey: string;
  host?: string;
  flushInterval?: number;
  batchSize?: number;
  refer?: boolean;           // web only
  runtime?: 'server' | 'app' | 'client' | 'browser' | 'react_native' | string;
  setUserTimestamp?: boolean;
  debug?: boolean;
});

track(eventType: AnalyticsEventType, eventName: string, properties?: TrackProperties): void;

feedback(
  eventName: string,
  source: string,                 // e.g. 'FEATURE_MODAL'
  data?: Partial<FeedbackDataV1>, // { rating, vote, kind, text, ... }
  properties?: TrackProperties
): void;

flush(): Promise<void>;

Event types (AnalyticsEventType): CLICKTHROUGH | INTERACTION | SUBMIT | SEARCH | SCREEN_VIEW | SYSTEM | ERROR | SESSION | AUTH | CONVERSION | FEEDBACK | CUSTOM

Properties highlights: userId, email, groupId, subscriptionStatus, isSubscribed, data, jsonData, environment, event_name_detailed, runtime, user_timestamp, deviceType, windowWidth, windowHeight, timezone, browser, os, osVersion.

Feedback events

analytics.feedback('FEATURE_RATING', 'FEATURE_MODAL', { rating: 4, text: 'Nice' });
analytics.feedback('POSTER_VOTE', 'POSTER_WIDGET', { vote: 'GOOD' });
analytics.feedback('BUG_REPORTED', 'UPLOAD_SCREEN', {
  kind: 'BUG', severity: 'HIGH', text: 'Crash on large file', contactOk: true, email: '[email protected]'
});

feedback() attaches a structured jsonData payload with schema: 'feedback.v1'.

Automatic campaign/referrer tracking (Web)

Enabled when refer: true:

  • If URL contains ?trc11=XYZCLICKTHROUGH / CAMPAIGN_CLICK with event_name_detailed=XYZ (once per session), then the param is removed from the URL.
  • Else if external document.referrer is present → CLICKTHROUGH / REFERRAL_VISIT with event_name_detailed=document.referrer (once per session).

Auth & transport

  • Auth: Authorization: Bearer <apiKey>
  • Endpoint: POST {host or current-origin}/api/v1/track
  • Body: { "events": [...] }
  • Browser unload: uses timers + lifecycle hooks; consider enabling a server endpoint that accepts smaller batches for keepalive/sendBeacon reliability.

Breaking from @jakobinn/aj-client-sdk

  • Package names:

    • Web → @jakobinn/aj-analytics-web
    • React Native → @jakobinn/aj-analytics-react-native
    • Node → @jakobinn/aj-analytics-node
    • Shared types/constants → @jakobinn/aj-analytics-core
  • Imports: replace

    // old
    import { AnalyticsJJClient } from '@jakobinn/aj-client-sdk';
    // new (choose your adapter)
    import { AnalyticsJJClient } from '@jakobinn/aj-analytics-web'; // or -react-native / -node
  • host is now required in Node and React Native (browser can omit).

  • Event names: warnings if not UPPER_SNAKE_CASE (web & RN console warns in dev).

Troubleshooting

  • 404 Scope not found: you’re publishing under a scope you don’t own; use @jakobinn/* or unscoped names.
  • EUSAGE provenance provider: null: local publish tried --provenance. Run with --no-provenance (your publish script already handles this).
  • OTP prompt: optional unless your org/token enforces 2FA. If needed, pass --otp 123456.

If you want this split into per-package READMEs (web/RN/node/core) I can generate those too, but this covers the project accurately after your changes.