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

@tinytrack/cloudflare-worker

v0.1.2

Published

Tinytrack analytics worker for Cloudflare based deployments. Use this to track server side events, this package will pass-through requests to tinytrack.io

Readme

tinytrack-cloudflare-worker

TinyTrack analytics worker for Cloudflare based deployments.

A transparent proxy that counts pageviews server-side, auto-injects the TinyTrack script, and serves the tracker and beacons first-party.

Install

Cloudflare clones this repo and sets up the worker.

Deploy to Cloudflare

Setup:

  1. Set your website id.
    1. Go to: Workers & Pages
    2. Open: tinytrack-cloudflare-worker -> Settings -> Variables: set TINYTRACK_WEBSITE_ID (TinyTrack Settings → Tracking)
  2. Route it over your site: Domains → Add Route, e.g. example.com/* (see Cloudflare configuration).

You can reduce the number of requests to your worker by excluding assets, see Reducing Worker invocations.

Install (manual)

Prerequisites:

  • Requires a Cloudflare account with your site's DNS proxied
  • Node.js 18+
  • TinyTrack website ID

1. Setup

git clone https://github.com/tinytrack-io/cloudflare-worker
cd tinytrack-cloudflare-worker
npm install
npx wrangler login

2. Add tinytrack websiteId secret

npx wrangler secret put TINYTRACK_WEBSITE_ID

3. Deploy

npm run deploy

4. Cloudflare configuration

Workers & Pages → tinytrack-cloudflare-worker → Domains → Add Route, e.g. example.com/*, covering the whole site.

Use Worker Routes, not Custom Domains: a Custom Domain replaces your origin and breaks the proxy.

Reducing Worker invocations

A example.com/* route sends every request through the worker, including assets it just passes through. The worker only needs to see HTML document requests and /_tinytrack/*. To stop paying invocations for the rest, add routes with the Worker set to None for your high-volume static prefixes:

To add exclusions:

  1. Go to Cloudflare -> Domains
  2. Go to your domain example.com
  3. Go to Workers routes
  4. Add routes you want to exclude with Add Route
  5. Worker should be None

Route patterns match path prefixes only (no file extensions) and a route without a Worker negates broader patterns, see the Workers routes docs.

Example exclusions:

  • example.com/_app/immutable/* (SvelteKit)
  • example.com/_next/static/* (Next.js)
  • example.com/assets/*
  • example.com/static/*
  • example.com/images/*
  • example.com/api/*

Route patterns cannot match file extensions (*.jpg is invalid), only path prefixes.

Configuration

| Var | Default | Notes | |---|---|---| | TINYTRACK_WEBSITE_ID | (none) | Required. Public by design. | | TINYTRACK_DOMAIN | request hostname minus www. | Set explicitly when your route spans multiple subdomains, or sessions split. | | INJECT_SCRIPT | "true" | "false" = server-side pageviews only. | | TINYTRACK_PATH_PREFIX | /_tinytrack | First-party paths the worker serves itself. | | TINYTRACK_DEBUG | "false" | "true" = step-by-step debug logs for HTML document requests. |

Only TINYTRACK_WEBSITE_ID is declared in wrangler.jsonc, so it is the only field shown on the one-click deploy setup page. The optional vars fall back to the defaults above; to override one, add it in Workers & Pages → Settings → Variables (kept across deploys, the config sets keep_vars) or to the vars block in wrangler.jsonc.

What gets tracked

  • Server-side: one page_view per HTML request (any status). Static assets, /api/-style paths, prefetches, and non-GET requests are skipped.
  • Client-side: SPA navigations, outbound clicks, goals, scroll depth, session pings, custom events. The injected script skips the initial pageview, so there is no double counting.
  • Bots are recorded for crawler/AI analytics

Troubleshooting

  • npx wrangler tail shows live logs; pageview failures log as [TinyTrack] pageview tracking failed.
  • No data? Check the route covers the page and TINYTRACK_WEBSITE_ID is set.
  • Client events missing? Check the browser console for /_tinytrack/tracker.js (usually CSP or a leftover manual snippet).

Uninstall

Remove the Worker Route and your site instantly serves direct from origin. Then npx wrangler delete when done. Roll back a bad deploy from Workers & Pages → Deployments → Rollback.