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

@miisite/analytics

v0.2.2

Published

Cookieless page views and Core Web Vitals for miisite client sites.

Readme

@miisite/analytics

Cookieless page views and Core Web Vitals for miisite client sites.

Sends a path — or a metric name and a number — to an endpoint. Nothing else. No cookie, no localStorage, no sessionStorage, no fingerprint, no visitor identifier. Nothing is stored on the visitor's device, which is why the sites that use it carry no consent banner: the ePrivacy consent requirement is triggered by storing or accessing information on terminal equipment, and this does neither.

That is a constraint on what may be added here, not a description of what is here today. A change that stores anything on the device silently makes every site using this package non-compliant.

Use

// src/routes/+layout.svelte, in the <script>
import { afterNavigate } from '$app/navigation';
import { trackPageviews } from '@miisite/analytics/svelte';

trackPageviews({ afterNavigate });

Must be called during component initialisation — afterNavigate registers a lifecycle callback and throws outside init.

Why you pass afterNavigate in. $app/navigation is a virtual module that exists only inside your SvelteKit build. A published package that imports it emits that specifier into its dist, and Vite externalises node_modules for SSR — so the prerender loads it in plain Node and fails with Cannot find package '$app', on every route, at build time. The app owns the import; the package owns the logic.

Without SvelteKit:

import { createTracker } from '@miisite/analytics';

const tracker = createTracker({ endpoint: '/_px' });
tracker.pageview(location.pathname);
tracker.vitals();

What it reports, and what it deliberately does not

| | | | --- | --- | | Client-side navigations | Every one. This is the reason the package exists | | The first page view | No. See below | | LCP, INP, CLS | Once per document, when each settles |

The first page view is skipped on purpose. Behind the miisite router it is recorded server-side from the HTML response, which also counts visitors with JavaScript disabled or a blocker installed. Reporting it here as well would double every session's first page. On other infrastructure, call tracker.pageview(location.pathname) yourself at startup.

Why this exists

SvelteKit navigates by history.pushState without reloading, so after the first page nothing server-side sees a page view. Cloudflare Web Analytics does not fill that gap: its beacon is one-shot, so it reports the entry page and the exit page and loses everything in between. That was measured, twice, on a live site — including with the documented "spa": true set, which changes nothing.

Endpoint contract

GET {endpoint}?p={path} — one page view.

GET {endpoint}?p={path}&m={metric}&v={value}&r={rating} — one vital.

The receiver replies 204 with no body. sendBeacon ignores the response.

Everything else — host, country, device, bot classification — is filled in by the receiver from the request it already has. The client sends the minimum it alone knows.

Notes for whoever changes this

  • web-vitals is imported dynamically and only in a browser. It touches document at module scope, so a static import breaks server rendering — on a prerendered SvelteKit site that is every route, at build time.
  • Vitals register once per document, never per navigation. Each metric reports a single time for the life of the document; re-registering on a route change either double-reports or is silently ignored, depending on the metric.
  • Never import a virtual module here. $app/*, $env/* and friends only resolve inside a consumer's bundler. See the note at the top of svelte.ts.
  • Failure is always silent. A blocked beacon, a missing API, a chunk that will not load — none of it is worth an exception on a page someone is reading.