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

@cityflo/truesight-web-sdk

v0.2.2

Published

TrueSight Web Analytics SDK

Readme

@cityflo/truesight-web-sdk

Lightweight, privacy-first analytics SDK for browser-based applications. Events are encrypted at rest in IndexedDB and flushed in batches to your TrueSight ingestion API.

Installation

npm install @cityflo/truesight-web-sdk
# or
pnpm add @cityflo/truesight-web-sdk

Quick Start

ES Module

import { init, track, identify, screen, reset } from '@cityflo/truesight-web-sdk';

// Initialize
await init({
  apiKey: 'ts_live_...',
  endpoint: 'https://your-ingestion-api.com',
});

// Track custom events
track('Button Clicked', { button_id: 'checkout', value: 42.99 });

// Identify user
identify('user-123', {
  email: '[email protected]',
  mobile_number: '9876543210',
  plan: 'premium',
});

// Manual screen view (auto-tracked by default — see below)
screen('/checkout', { referrer: 'cart' });

// Reset on logout
reset();

Script Tag (UMD)

<script src="https://unpkg.com/@cityflo/truesight-web-sdk/dist/truesight.umd.js"></script>
<script>
  TrueSight.init({ apiKey: 'ts_live_...', endpoint: '...' });
  TrueSight.track('Page Viewed');
</script>

Auto-Tracking

All auto-tracking is enabled by default. The SDK automatically captures:

| Event | Type | Description | |-------|------|-------------| | $screen | screen | Page/screen views on navigation (pushState, popstate, hashchange). Includes screen_name, page_url, page_title, page_referrer, and query_params. | | $click | track | Click interactions (with element selector, text, href) | | $rage_click | track | Rapid repeated clicks on the same element | | $dead_click | track | Clicks that produce no DOM change | | $form_submit | track | Form submissions (with form id/name/action) | | $scroll_depth | track | Maximum scroll depth per page (25%, 50%, 75%, 100%) | | $time_on_page | track | Time spent on each page before navigation | | $page_load | track | Page load performance timing (TTFB, DOM ready, load) | | $session_start | track | New session detected (after 30min inactivity) | | $session_end | track | Session ended |

Disable individual trackers via autoTrack:

await init({
  apiKey: 'ts_live_...',
  endpoint: 'https://your-ingestion-api.com',
  options: {
    autoTrack: {
      pageViews: false,    // disable auto screen tracking
      clicks: false,
      rageClicks: false,
      deadClicks: false,
      formSubmits: false,
      scrollDepth: false,
      timeOnPage: false,
      pageLoadTiming: false,
    },
  },
});

Exclude any element from click/form tracking with data-ts-ignore:

<button data-ts-ignore>Not tracked</button>

Configuration

await init({
  apiKey: 'ts_live_...',
  endpoint: 'https://your-ingestion-api.com',
  options: {
    flushInterval: 30000,     // flush every 30s (default)
    maxBatchSize: 20,         // events per batch (default)
    maxQueueSize: 1000,       // soft limit — triggers flush (default)
    maxEventSize: 32768,      // max single event size in bytes (default)
    sessionTimeout: 1800000,  // 30min session inactivity timeout (default)
    debug: false,             // enable console debug logging
  },
});

API Reference

| Method | Description | |--------|-------------| | init(config) | Initialize the SDK. Must be called first. Returns a Promise. | | track(event, properties?) | Track a custom event | | identify(userId, traits?) | Set user identity. Auto-promotes email and mobile_number from traits. | | screen(name, properties?) | Track a screen/page view. Auto-tracked by default on navigation. | | flush() | Manually flush the event queue | | reset() | Clear user state and generate a new anonymous ID (call on logout) | | setMobileNumber(number) | Set 10-digit mobile number | | setEmail(email) | Set user email |

Features

  • Encrypted at rest — Events stored in IndexedDB are encrypted with AES-256-GCM via Web Crypto API
  • Automatic batching — Events are flushed periodically, on tab hide, and before page unload (via sendBeacon)
  • Retry with backoff — Failed flushes retry with exponential backoff (up to 10 attempts)
  • Session tracking — Automatic session detection with configurable inactivity timeout
  • Anonymous ID — Persistent anonymous ID generated and encrypted in localStorage
  • Tiny footprint — Zero heavy dependencies, tree-shakeable ESM output

License

Private — Cityflo Technologies Pvt. Ltd.