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

@offstage/browser

v0.0.1

Published

Offstage analytics browser SDK

Readme

@offstage/browser

The browser SDK for Offstage analytics. Lightweight, dependency-free, and works in any modern browser.

Install

pnpm add @offstage/browser

Quick start

import { Offstage } from "@offstage/browser";

const offstage = new Offstage({
  apiKey: "pk_live_...",
});

offstage.track("signup_completed", { plan: "pro" });
offstage.identify("user_123", { email: "[email protected]" });
offstage.pageview();

By default the SDK auto-tracks pageviews on pushState/popstate and posts events in batches.

API

new Offstage(options)

| Option | Type | Default | Description | | --------------- | -------------------------- | --------------------- | --------------------------------------------------------------------------- | | apiKey | string | required | Your Offstage publishable API key. | | host | string | https://offstage.sh | Override the ingest host (self-hosted deployments). | | autoPageviews | boolean | true | Patch history.pushState/replaceState and emit a pageview on navigation. | | consent | boolean | true | Set to false to no-op until consent is granted (see "Consent" below). | | enabled | boolean | true | Hard kill switch. Useful for enabled: import.meta.env.PROD. | | onError | (error: unknown) => void | swallow | Called when the SDK catches an internal error. Tracking never throws. |

Methods

  • track(event: string, properties?: Record<string, unknown>): void
  • identify(userId: string, traits?: Record<string, unknown>): void
  • pageview(path?: string): void — defaults to the current location.pathname.
  • destroy(): void — flushes the queue, restores history, and disables further tracking.

The SDK is SSR-safe: instantiating it during server rendering is a no-op.

Consent

The SDK respects navigator.doNotTrack automatically — when DNT is on, all tracking calls become no-ops.

To gate on your own consent banner, pass consent: false while the user hasn't opted in, then re-instantiate with consent: true once they do:

let offstage: Offstage | null = null;

function start() {
  offstage = new Offstage({ apiKey: "pk_live_...", consent: true });
}

if (userHasConsented()) start();
// On "Accept":
banner.onAccept(() => start());
// On "Reject":
banner.onReject(() => offstage?.destroy());

Storage

@offstage/browser uses localStorage for the visitor ID. It never sets cookies.