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

@anested/analytics

v1.2.0

Published

Lightweight analytics & SEO intelligence tracking for websites — pageviews, sessions, scroll depth, click tracking, SEO audits, Web Vitals, social referrer detection, device intelligence, lead-capture forms, and optional visitor consent popup

Readme

@anested/analytics

Lightweight analytics & SEO intelligence library — under 8KB. Drop one script tag and get:

  • Auto pageview & session tracking
  • Scroll depth, click intelligence (rage clicks, dead clicks)
  • Social referrer detection (Google, Facebook, Instagram, Twitter/X, LinkedIn, YouTube, TikTok, Reddit, and 20+ more)
  • Extended device detection (brand, model, OS, browser)
  • SEO audits (titles, meta, OG tags, structured data, heading structure)
  • Web Vitals (LCP, FID, CLS)
  • Optional visitor consent popup (collects name + location permission)
  • SPA / Next.js / React Router support

Quick Start

Script tag (simplest)

<script
  defer
  src="https://api.analytics.anested.com/a.js"
  data-key="YOUR_TRACKING_KEY"
  data-host="https://api.analytics.anested.com"
></script>

NPM (React / Next.js)

npm install @anested/analytics
import { init } from "@anested/analytics";

init({
  key: "YOUR_TRACKING_KEY",
  host: "https://api.analytics.anested.com",
});

Configuration

All options are set via data-* attributes on the script tag, or as properties passed to init().

| Attribute / Option | Default | Description | |--------------------|---------|-------------| | data-key | — | Required. Your tracking key from the Anested Analytics dashboard | | data-host | https://api.analytics.anested.com | Analytics server URL | | data-clicks | true | Track click events (rage clicks, dead clicks, outbound links) | | data-scroll | true | Track scroll depth | | data-seo | true | Run client-side SEO audit on every page | | data-performance | true | Measure Web Vitals (LCP, FID, CLS) | | data-consent | false | Show visitor consent popup (name + optional location) | | data-debug | false | Log all events to the browser console |


Consent Popup (data-consent="true")

When data-consent="true", on the visitor's first visit a compact bottom sheet appears:

  • Asks for the visitor's name (optional free-text field)
  • A pre-ticked checkbox: "Allow location access (for analytics only, never shared)"
  • A Continue button

On submit:

  • The name is stored in localStorage and attached to every event as visitor_name
  • If location was allowed, the browser requests geolocation permission and attaches coordinates to the pageview
  • The popup is never shown again on the same device (stored in localStorage._ac)
<script
  defer
  src="https://api.analytics.anested.com/a.js"
  data-key="YOUR_KEY"
  data-host="https://api.analytics.anested.com"
  data-consent="true"
></script>

Social Referrer Detection

The library automatically detects which platform sent the visitor:

google · facebook · instagram · twitter · linkedin · youtube · reddit · tiktok · pinterest · whatsapp · telegram · snapchat · discord · github · medium · substack · duckduckgo · bing · yahoo · producthunt · hackernews · slack · direct · referral

If UTM source is present (utm_source=google), it takes priority.


Device Detection

Each pageview includes:

  • device"mobile" | "tablet" | "desktop"
  • device_brand — e.g. "Apple", "Samsung", "Google", "Xiaomi"
  • device_model — e.g. "iPhone", "Galaxy S24", "Pixel 8"
  • os / os_version"iOS 17.4", "Android 14", "Windows 10/11"
  • browser / browser_version"Chrome 125", "Safari 17"

Public API

// Custom event
window.analytica.track("button_clicked", { label: "Get Started", page: "/" });

// Set visitor name programmatically (if not using the consent popup)
window.analytica.identify("Jane Doe");

// Request browser location after user interaction
window.analytica.requestLocation((granted) => {
  console.log("Location granted:", granted);
});

// Get the anonymous visitor ID for the current device
const vid = window.analytica.getVisitorId();

// Opt out of all tracking
window.analytica.optOut();

SPA Support

Works automatically with React Router, Next.js App Router, Vue Router, etc. The library intercepts history.pushState / replaceState and re-fires pageviews on navigation.


Subdomain Support

Each subdomain is tracked as a separate site. Register each one independently:

anested.com          → one site
blog.anested.com     → separate site (own analytics stream)
shop.anested.com     → separate site (own analytics stream)

License

MIT © Anested