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

@faina/phantom

v1.0.0

Published

Persistent user session tracker that survives cache clearing, incognito mode, and storage deletion

Readme

Phantom - Tracker

Stable visitor identification with comprehensive tracking and security detection.

Features

| Category | Feature | Default | |----------|---------|---------| | Fingerprinting | Tier 1: Hardware (cores, screen, timezone) | ✅ | | | Tier 2: Stable (GPU, WebGPU, CSS features) | ✅ | | | Tier 3: Variable (canvas, fonts, audio) | ✅ | | | Server-side progressive matching | ✅ | | Security | Bot detection (webdriver, automation, headless) | ✅ On | | | Incognito detection (storage quota, filesystem) | ✅ On | | | Tampering detection (canvas noise, spoofing) | ✅ On | | | Confidence scoring | ✅ | | Auto-Tracking | Page views | ✅ On | | | Scroll depth (25%, 50%, 75%, 90%, 100%) | ✅ On | | | Clicks (with coordinates) | ✅ On | | | Form interactions (focus, blur, change, submit) | ✅ On | | | Page visibility (tab hidden/visible) | ✅ On | | | Performance metrics (TTFB, FCP, load) | ✅ On | | | SPA route changes | ✅ On | | | Session end | ✅ On | | | Mouse movement (heatmaps) | ⚪ Off | | | Drag and drop | ⚪ Off | | Storage | localStorage, sessionStorage, cookies, IndexedDB | ✅ |

Quick Start

<script type="module">
import { Phantom } from './phantom.esm.js';

const phantom = new Phantom({
  endpoint: 'http://localhost:8080',
  apiKey: 'your-api-key'
});

const result = await phantom.init();
console.log('Visitor:', result.visitorId);
console.log('Confidence:', result.confidence);
console.log('Is Bot:', result.security.bot.isBot);
console.log('Is Tampered:', result.security.tampering.isTampered);
</script>

Security Detection

Bot Detection

  • webdriver - navigator.webdriver flag
  • __webdriver_evaluate - Selenium globals
  • callPhantom - PhantomJS
  • headless_ua - HeadlessChrome UA
  • no_plugins - Missing plugins
  • fake_chrome - Chrome UA without chrome object

Incognito Detection

  • storage_quota - Limited storage (<120MB)
  • filesystem - FileSystem API fails

Tampering Detection

  • canvas_noise - Inconsistent canvas renders
  • navigator_spoofed - Modified navigator properties
  • prototype_polluted - Modified prototypes
  • function_tampered - Modified Function.toString
  • screen_spoofed - Inconsistent screen dimensions
  • webgl_spoofed - GPU vendor/renderer mismatch

Confidence Scoring

Confidence (0.0-1.0) based on match method, bot score, and tampering score.

Auto-Tracked Events

| Event | Data | |-------|------| | $pageview | url, path, title, referrer | | $scroll | threshold, percent | | $click | tag, id, cls, text, href, x, y | | $form_focus | tag, type, name, id | | $form_blur | tag, type, name, filled | | $input_change | tag, type, len | | $form_submit | id, name, action, method | | $page_hidden | - | | $page_visible | duration | | $performance | dns, tcp, ttfb, domReady, load, fcp | | $route_change | trigger, url, path | | $session_end | duration, pageViews, events |

API

// Initialize
const result = await phantom.init();

// Track
phantom.track('event', { data });
phantom.trackPageView();
await phantom.setUserId('user123', { traits });
await phantom.flush();

// Getters
phantom.getVisitorId();   // string | null
phantom.getConfidence();  // number (0-1)
phantom.getSecurity();    // { bot, incognito, tampering, confidence }
phantom.isBot();          // boolean
phantom.isIncognito();    // boolean
phantom.isTampered();     // boolean

// Cleanup
phantom.reset();   // Clear data
phantom.destroy(); // Flush and cleanup

Tiered Matching

  1. Exact (1.0) - All tiers match
  2. Stored ID (0.95) - localStorage ID + Tier1 match
  3. Tier 1+2 (0.90) - Hardware + Stable match
  4. Fuzzy (0.85+) - Component similarity
  5. New (1.0) - Create new visitor

Files

src/phantom.ts      # Client (982 lines)
dist/phantom.esm.js # ES Module (17.8KB)
dist/phantom.js     # UMD (18.3KB)
server/main.go      # Server
demo/v3-test.html      # Test page