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

@rivtor/analytics

v1.1.0

Published

Production-ready privacy-first analytics for B2B SaaS

Downloads

11

Readme

@rivtor/analytics

Production-ready privacy-first analytics for B2B SaaS

Features

  • Privacy-First Metrics: Server-side analytics without cookies (GDPR compliant)
  • Event Tracking: Simple function to track custom events
  • Funnel Analysis: Visualize conversion funnels
  • Real-time Dashboard: Built-in dashboard components
  • Cookieless Tracking: No cookies required, uses session storage

Installation

npm install @rivtor/analytics
# or
yarn add @rivtor/analytics
# or
pnpm add @rivtor/analytics

Quick Start

1. Initialize Analytics

Wrap your app with the provider:

import { VocoAnalyticsProvider } from '@rivtor/analytics/react';

export default function RootLayout({ children }) {
    return (
        <VocoAnalyticsProvider
            config={{
                trackPageViews: true,
                respectDoNotTrack: true,
                enableCookieless: true,
            }}
        >
            {children}
        </VocoAnalyticsProvider>
    );
}

2. Track Events

'use client';
import { analytics } from '@rivtor/analytics';

export function BuyButton() {
    const handleClick = () => {
        // Track conversion event
        analytics.track('clicked_buy_button', {
            plan: 'pro',
            price: 29,
        });

        // Continue with purchase flow
    };

    return <button onClick={handleClick}>Buy Now</button>;
}

3. View Analytics Dashboard

import { VocoAnalytics } from '@rivtor/analytics/react';
import { analytics } from '@rivtor/analytics/server';

export default async function AnalyticsPage() {
    const data = await analytics.getDashboardData(30);

    return <VocoAnalytics data={data} />;
}

API Reference

Client Methods

import { analytics } from '@rivtor/analytics';

// Initialize (called automatically by provider)
analytics.init({
    trackPageViews: true,
    trackOutboundLinks: true,
    trackScrollDepth: true,
    respectDoNotTrack: true,
    enableCookieless: true,
});

// Set user ID
analytics.setUserId('user_123');

// Track custom event
analytics.track('button_clicked', {
    buttonId: 'cta-button',
    location: 'homepage',
});

// Track page view (automatic if enabled)
analytics.trackPageView({
    path: '/pricing',
    title: 'Pricing Page',
});

Server Methods

import { analytics } from '@rivtor/analytics/server';

// Track event server-side
await analytics.trackEvent('user_registered', { plan: 'pro' }, 'user_123');

// Get dashboard data
const data = await analytics.getDashboardData(30);
// Returns: { overview, timeSeries, topPages, topEvents }

// Analyze conversion funnel
const funnel = await analytics.analyzeFunnel({
    name: 'Sign Up Funnel',
    steps: [
        { name: 'Visit', event: 'page_view' },
        { name: 'Sign Up Click', event: 'clicked_signup' },
        { name: 'Completed', event: 'user_registered' },
    ],
});

// Get event analytics
const eventData = await analytics.getEventAnalytics('clicked_buy_button', 30);

// Get top pages
const topPages = await analytics.getTopPages(30, 10);

Funnel Analysis

The built-in funnel analysis helps you understand conversion rates:

import { analytics } from '@rivtor/analytics/server';

const signupFunnel = await analytics.analyzeFunnel({
    name: 'User Registration',
    steps: [
        { name: 'Landing Page', event: 'page_view' },
        { name: 'Click Sign Up', event: 'clicked_signup' },
        { name: 'Submit Form', event: 'submitted_form' },
        { name: 'Verified Email', event: 'email_verified' },
    ],
});

console.log(signupFunnel);
// {
//   name: 'User Registration',
//   totalUsers: 10000,
//   overallConversionRate: 0.15,
//   steps: [
//     { name: 'Landing Page', count: 10000, conversionRate: 1.0 },
//     { name: 'Click Sign Up', count: 5000, conversionRate: 0.5 },
//     { name: 'Submit Form', count: 2000, conversionRate: 0.2 },
//     { name: 'Verified Email', count: 1500, conversionRate: 0.15 }
//   ]
// }

Configuration

interface AnalyticsConfig {
    // Enable cookieless tracking (uses sessionStorage)
    enableCookieless?: boolean;

    // Respect browser Do Not Track setting
    respectDoNotTrack?: boolean;

    // Automatically track page views
    trackPageViews?: boolean;

    // Track outbound link clicks
    trackOutboundLinks?: boolean;

    // Track scroll depth milestones
    trackScrollDepth?: boolean;

    // Track time on page
    trackTimeOnPage?: boolean;

    // Sample rate (0-1)
    sampleRate?: number;

    // Exclude certain paths from tracking
    excludedPaths?: string[];

    // Exclude certain referrers from tracking
    excludedReferrers?: string[];
}

License

MIT


Made with ❤️ by Rivtor