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

@betterlytics/tracker

v0.2.0

Published

Privacy-focused, cookieless analytics for your website

Readme

@betterlytics/tracker

Privacy-focused, cookieless analytics for your website. Simple integration with just a few lines of code.

Installation

Install the package using your preferred package manager:

# npm
npm install @betterlytics/tracker

# yarn
yarn add @betterlytics/tracker

# pnpm
pnpm add @betterlytics/tracker

# bun
bun add @betterlytics/tracker

Usage

Import and initialize Betterlytics in your application:

import betterlytics from "@betterlytics/tracker";

// Initialize Betterlytics
betterlytics.init("your-site-id");

// Track custom events
betterlytics.event("newsletter-signup");
betterlytics.event("button-click", { button: "cta-header" });

You can also initialize Betterlytics with optional parameters like this:

import betterlytics from "@betterlytics/tracker";

// Initialize Betterlytics with optional configurations
betterlytics.init("your-site-id", {
  dynamicUrls: ["/users/*", "/products/*"], // optional
});

Custom Events

Track user interactions and conversions with custom events. Learn more about custom events in our documentation.

// Track conversions
betterlytics.event("purchase", {
  product: "premium-plan",
  value: 29.99,
  currency: "USD",
});

// Track engagement
betterlytics.event("video-play", {
  video: "onboarding-tutorial",
  duration: 120,
});

Dynamic URLs

Dynamic URLs contain variable segments that change based on user context, making them difficult to analyze collectively. Betterlytics supports single (*) and double (**) wildcards to normalize these URLs. Learn more about dynamic URLs in our documentation.

betterlytics.init("your-site-id", {
  dynamicUrls: ["/users/*", "/products/*/reviews", "/blog/**"],
});

Web Vitals

Web Vitals tracking is disabled by default. Web Vitals in our documentation.

To enable tracking of Core Web Vitals:

betterlytics.init("your-site-id", {
  enableWebVitals: true,
});

Outbound Links

Outbound Links are the external links your users click on on your site.
Only the domain of these links are tracked by default. Outbound Links in our documentation.

To track the full Outbound Links, and not just the domain:

betterlytics.init("your-site-id", {
  outboundLinksMode: "full",
});

To disable Outbound Link tracking:

betterlytics.init("your-site-id", {
  disableOutboundLinks: true,
});

Session Replay

Session Replay is disabled by default. Session Replay in our documentation.

To enable Session Replay:

betterlytics.init("your-site-id", {
  enableSessionReplay: true,
});

You can also configure the replay settings:

betterlytics.init("your-site-id", {
  enableSessionReplay: true,
  replaySample: 20,
  consentReplay: true,
});

Configuration

Required Options

Optional Options

  • dynamicUrls: Array of URL patterns to normalize (e.g., ['/users/*', '/products/*'])
  • serverUrl: Custom tracking server URL (defaults to https://betterlytics.io/event)
  • scriptUrl: Custom analytics script URL (defaults to https://betterlytics.io/analytics.js)
  • enableWebVitals: Boolean value for enabling Web Vitals tracking (defaults to false)
  • disableOutboundLinks: Boolean value for disabling Outbound Link tracking (defaults to false)
  • outboundLinksMode: Mode for what is being tracked for Outbound Links (Options: "domain" | "full" defaults to "domain")
  • enableSessionReplay: Boolean value for enabling Session Replay (defaults to false)
  • consentReplay: Boolean value. Indicates consent is already granted (defaults to false)
  • replaySample: Number (0-100). Percent of eligible sessions to record (defaults to 5)
  • replayMinDuration: Number (seconds). Minimum recording length required to upload/finalize (defaults to 15)
  • replayIdleCutoff: Number (seconds). Auto‑stop after this many seconds of inactivity (defaults to 600)
  • replayMaxDuration: Number (seconds). Hard cap on total recording length (defaults to 1200)
  • disableReplayOnUrls: Array of URL patterns where recording is disabled (defaults to [])
  • debug: Boolean value for console warnings (defaults to false)

Links

License

MIT