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

@pmeweb/analytics

v2.0.0

Published

PmeWeb first-party analytics: beacon component + forwarding shim. Counting rules live in the central pmeweb-analytics worker, NOT here.

Readme

@pmeweb/analytics

First-party, cookie-free analytics for PmeWeb sites. Two exports:

  • Analytics.astro — rendered once by Base.astro; inlines the beacon (pageviews, visits, events, LCP) as one inline script, no extra request. Pass notFound on the 404 route only.
  • forwardCollect(request, env.ANALYTICS, ctx) — route POST /api/pmw-collect to it in the site worker. Forwards to the central pmeweb-analytics worker over a service binding; always returns 204.

Site wrangler.jsonc needs the service binding:

"services": [{ "binding": "ANALYTICS", "service": "pmeweb-analytics" }]

Counting a conversion

Pageviews, visits, outbound/tel/mailto/CTA clicks and LCP need no wiring. Two things do, because the beacon cannot observe them for itself:

  • form_start — put data-pmw-form on the <form>. Declarative; it fires on first focus.

  • the conversion — call it from your submit handler, on success:

    window.pmw?.event('form');        // a contact/lead form
    window.pmw?.event('newsletter');  // a newsletter signup

    The ?. is required, not defensive style. window.pmw is assigned only after the beacon's opt-outs (excluded host, pmw_ignore, webdriver), so on those the object does not exist and the call correctly vanishes.

Valid types are whatever the central worker's EVENT_TYPES accepts. An unknown one is dropped there, never thrown here — a beacon that throws on a typo breaks the page it is measuring.

2.0.0 — the #intake-success contract is gone

v1 counted a conversion by observing the hidden attribute of an element with the hardcoded id #intake-success. It is removed. It fitted exactly one conversion type, and its failure mode was silence: an id that matches nothing looks identical to a form nobody submitted, which is how three sites reported zero conversions for weeks with working forms. Replace each sentinel reveal with the window.pmw?.event(...) call above; the site's own success panel keeps doing whatever it already did.

Counting rules (bot filtering, visit definition, caps) live in the central worker — a site being one version behind this package is harmless. Breaking changes to the beacon payload require a MAJOR version and a coordinated central-worker deploy.

Design: websites/docs/superpowers/specs/2026-08-21-first-party-analytics-design.md