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

@simpleanalytics/nuxt

v2.0.0

Published

Simple Analytics Nuxt

Readme

Simple Analytics Nuxt Module

A Nuxt module for integrating Simple Analytics with server-side tracking capabilities.

Quick Setup

Install the module to your Nuxt application:

npm install @simpleanalytics/nuxt

Add the module to your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ["@simpleanalytics/nuxt"],
  simpleAnalytics: {
    hostname: "your-domain.com",
    enabled: true,
  },
});

Usage

Adding the module will automatically enable client-side page view collection though the Simple Analytics script.

Server-side Pageview Tracking

Track pageviews automatically on the server:

<script setup>
// This will run on the server and track the pageview
if (import.meta.server) {
  await trackPageview({
    some_extra_metadata: "homepage"
  });
}
</script>

Server-side Event Tracking

Track custom events from API routes or server-side code:

// In a (Nitro) server API route
export default defineEventHandler(async (event) => {
  await trackEvent(event, "user_signup", {
    source: "registration_form",
    user_type: "new",
  });

  return { success: true };
});

Configuration

Module Options

export default defineNuxtConfig({
  simpleAnalytics: {
    // Your Simple Analytics hostname
    hostname: "your-domain.com",

    // Enable/disable the module
    enabled: true,

    // Auto-collect events
    autoCollect: true,

    // Collect data even when DNT is enabled
    collectDnt: false,

    // Dashboard mode
    mode: "dash",

    // Ignore specific metrics
    ignoreMetrics: {
      referrer: false,
      utm: false,
      country: false,
      session: false,
      timeonpage: false,
      scrolled: false,
      useragent: false,
      screensize: false,
      viewportsize: false,
      language: false,

      // Use vendor specific timezone headers to the determine the visitors location (server only)
      timezone: false
    },

    // Ignore specific pages
    ignorePages: ["/admin", "/private"],

    // Allow specific URL parameters
    allowParams: ["ref", "source"],

    // Non-unique parameters
    nonUniqueParams: ["utm_source"],

    // Strict UTM parameter parsing
    strictUtm: true,

    // Enable enhanced bot detection during server tracking (server only)
    enhancedBotDetection: false
  },
});

Environment Variables

# Required: Your Simple Analytics hostname
SIMPLE_ANALYTICS_HOSTNAME=your-domain.com

API Reference (Nuxt)

trackPageview(options)

Track a pageview on the server.

Parameters:

  • metadata (object): Additional metadata to track (optional)

trackEvent(eventName, options)

Track a custom event on the server.

Parameters:

  • eventName (string): Name of the event to track
  • metadata (object): Additional metadata to track (optional)

API Reference (Nitro)

trackPageview(event, options)

Track a pageview on the server.

Parameters:

  • event (H3Event): Nitro request event
  • metadata (object): Additional metadata to track (optional)

trackEvent(event, eventName, options)

Track a custom event on the server.

Parameters:

  • event (H3Event): Nitro request event
  • eventName (string): Name of the event to track
  • metadata (object): Additional metadata to track (optional)

License

MIT License - see the LICENSE file for details.