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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pulsora/core

v0.1.0

Published

Privacy-first analytics tracking library - Core package

Readme

@pulsora/core

Privacy-first, cookieless analytics tracking library. Core package for Pulsora Analytics.

Features

  • 🔒 Privacy-First: No cookies, no localStorage (by default)
  • 🎯 Lightweight: <1KB gzipped
  • 🚀 High Performance: Uses sendBeacon API, async processing
  • 🔧 Extensible: Plugin system for additional features
  • 📊 Browser Fingerprinting: Stable, anonymous visitor identification
  • 🔄 Retry Logic: Automatic retry with exponential backoff
  • 📱 SPA Support: Automatic pageview tracking on route changes
  • 💪 TypeScript: Full type definitions included

Installation

NPM

npm install @pulsora/core

CDN

<script
  async
  src="https://cdn.pulsora.co/v1/pulsora.min.js"
  data-token="YOUR_API_TOKEN"
></script>

Usage

For NPM Users (Recommended for Apps)

Create and manage your own tracker instances:

import { Pulsora } from '@pulsora/core';

// Create a tracker instance
const tracker = new Pulsora();

// Initialize
tracker.init({
  apiToken: 'your-api-token',
  endpoint: 'https://api.pulsora.co/ingest', // optional
  autoPageviews: true, // optional, default: true
  debug: false, // optional, default: false
});

// Track pageview
tracker.pageview();

// Track custom event
tracker.event('button_click', {
  button: 'signup',
  location: 'header',
});

// Identify user
tracker.identify('user_123');

// Get visitor fingerprint (useful for server-side attribution)
const fingerprint = await tracker.getVisitorFingerprint();
const sessionId = tracker.getSessionId();

Multiple Tracker Instances

Perfect for tracking multiple websites or separating different types of analytics:

import { Pulsora } from '@pulsora/core';

const mainSiteTracker = new Pulsora();
mainSiteTracker.init({ apiToken: 'token-1' });

const blogTracker = new Pulsora();
blogTracker.init({ apiToken: 'token-2' });

// Each tracker operates independently
mainSiteTracker.pageview();
blogTracker.pageview();

For CDN Users (Recommended for Websites)

Add the script tag with your API token:

<!-- Auto-initializes and tracks pageviews -->
<script
  async
  src="https://cdn.pulsora.co/v1/pulsora.min.js"
  data-token="YOUR_API_TOKEN"
  data-debug="false"
></script>

<script>
  // Track custom event
  window.pulsora.event('purchase', {
    amount: 99.99,
    currency: 'USD',
  });

  // Identify user
  window.pulsora.identify('user_123');
</script>

API Reference

init(config: PulsoraConfig)

Initialize the tracker.

interface PulsoraConfig {
  apiToken: string; // Required: Your Pulsora API token
  endpoint?: string; // Optional: API endpoint (default: https://api.pulsora.co/ingest)
  autoPageviews?: boolean; // Optional: Auto-track pageviews (default: true)
  debug?: boolean; // Optional: Enable debug logging (default: false)
  maxRetries?: number; // Optional: Max retry attempts (default: 10)
  retryBackoff?: number; // Optional: Initial retry backoff in ms (default: 1000)
}

pageview(options?: PageviewOptions)

Track a pageview.

tracker.pageview(); // Current page

tracker.pageview({
  url: 'https://example.com/page',
  referrer: 'https://google.com',
  title: 'Page Title',
});

event(eventName: string, eventData?: object)

Track a custom event.

tracker.event('button_click');

tracker.event('purchase', {
  product: 'Premium Plan',
  amount: 99,
  currency: 'USD',
});

identify(customerId: string)

Identify a user. Links all previous anonymous activity to this user.

tracker.identify('user_123');

reset()

Reset the session and clear user identification.

tracker.reset();

getVisitorFingerprint(): Promise<string>

Get the current visitor's fingerprint. Useful for server-side revenue attribution.

const fingerprint = await tracker.getVisitorFingerprint();
// Send to your backend for revenue tracking

getSessionId(): string

Get the current session ID.

const sessionId = tracker.getSessionId();

isIdentified(): boolean

Check if the current visitor is identified.

if (tracker.isIdentified()) {
  console.log('User is logged in');
}

use(extension: PulsoraExtension)

Register an extension/plugin.

import { Pulsora } from '@pulsora/core';
import revenue from '@pulsora/revenue';

const tracker = new Pulsora();
tracker.use(revenue);
tracker.init({ apiToken: 'token' });

TypeScript

Full TypeScript support with type definitions included:

import { Pulsora, PulsoraConfig, PageviewOptions } from '@pulsora/core';

const config: PulsoraConfig = {
  apiToken: 'token',
  debug: true,
};

const tracker = new Pulsora();
tracker.init(config);

Privacy & GDPR Compliance

  • No cookies: Pulsora doesn't use cookies
  • No localStorage: All data is in-memory by default
  • Browser fingerprinting: Uses non-PII technical characteristics
  • Anonymous by default: Identification is opt-in via identify()
  • Transparent: Open source and auditable

SPA Support

Automatic pageview tracking for Single Page Applications:

// Automatically tracks pageviews on:
// - history.pushState()
// - history.replaceState()
// - popstate events (back/forward buttons)

const tracker = new Pulsora();
tracker.init({
  apiToken: 'token',
  autoPageviews: true, // ← Enables SPA tracking
});

Error Handling

Pulsora handles errors gracefully with automatic retry:

  • Network failures: Exponential backoff retry
  • Rate limiting: Respects Retry-After headers
  • Max retries: Events dropped after max attempts
  • Debug mode: Console warnings for troubleshooting

Browser Support

  • Chrome/Edge (latest 2 versions)
  • Firefox (latest 2 versions)
  • Safari (latest 2 versions)
  • Mobile browsers (iOS Safari, Chrome Mobile)

License

MIT

Links