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

analyzer-analytics

v0.1.3

Published

Lightweight analytics tracker for web applications (<3KB gzipped)

Downloads

409

Readme

analyzer-analytics

Lightweight analytics tracker for web applications. Under 3KB gzipped with support for older browsers and optimized for slow networks.

Features

  • Tiny footprint - Core bundle <3KB gzipped
  • Auto pageview tracking - Tracks pageviews on load
  • Custom events - Track any event with properties
  • Offline support - Events queued and sent when online
  • sendBeacon - Reliable delivery on page unload
  • Bot filtering - Automatically ignores known bots

Quick Start

Script Tag

<script
  src="/analytics.min.js"
  data-api-key="your_api_key"
></script>

Track Events

// Custom events
analytics.track('signup', { plan: 'pro' });
analytics.track('purchase', { product_id: 'abc', price: 99 });

Installation

Option 1: Script Tag (recommended)

<script
  src="/path/to/analytics.min.js"
  data-api-key="pk_test_abc123"
  data-debug="true"
></script>

To override the endpoint (e.g., for local development):

<script
  src="/path/to/analytics.min.js"
  data-api-key="pk_test_abc123"
  data-endpoint="http://localhost:8080"
  data-debug="true"
></script>

Option 2: ES Module

import analytics from 'analyzer-analytics';

// Default endpoint is production (https://analyzer-ancient-field-3067.fly.dev)
analytics.init('pk_test_abc123');

// Or override for local development:
analytics.init('pk_test_abc123', {
  endpoint: 'http://localhost:8080'
});

Configuration

| Attribute | Default | Description | |-----------|---------|-------------| | data-api-key | required | Your project API key | | data-endpoint | https://analyzer-ancient-field-3067.fly.dev | Analytics server URL (optional override) | | data-debug | false | Enable console logging | | data-auto-track | true | Auto-track pageviews |

API

// Initialize
analytics.init(apiKey, { endpoint, debug, autoTrack });

// Track event
analytics.track('event_name', { key: 'value' });

// Force send queued events
await analytics.flush();

// Get visitor/session IDs
analytics.instance.getVisitorId();
analytics.instance.getSessionId();

Documentation

See the complete SDK Usage Guide for:

  • Framework integration (Astro, React, Vue, Next.js)
  • SPA route tracking
  • Event tracking examples
  • Troubleshooting

Development

Prerequisites

  • Bun v1.0 or later

Setup

bun install

Build

# Build all formats
bun run build

# Development mode (watch)
bun run dev

Build Output

| File | Size | Description | |------|------|-------------| | dist/analytics.min.js | ~1.6KB gzip | Core build (recommended) | | dist/analytics.esm.js | ~10KB gzip | ES Module | | dist/analytics.js | ~10KB gzip | IIFE unminified | | dist/analytics.full.min.js | ~8KB gzip | Full features |

Testing

bun test
bun test:watch

Size Check

bun run size-check

Target: Core bundle <3KB gzipped

License

MIT