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

@louisglen1/citc

v1.0.1

Published

Client Input Telemetry Collection - A privacy-first browser telemetry SDK for collecting user interaction events with zero dependencies

Readme

CITC (Client Input Telemetry Collection)

A minimal browser telemetry SDK for collecting user input events. Built for research — captures interaction patterns (timing, focus, keystrokes) without capturing raw input values.

Installation

npm install @louisglen1/citc

Usage

import { CITC } from '@louisglen1/citc';

const telemetry = CITC({
    endpoint: 'https://api.example.com/telemetry',
    fields: {
        mode: 'attribute',
        attribute: 'data-citc',
    },
});

telemetry.start();

telemetry.setContext({ userId: '12345' });

await telemetry.stop(); // flushes remaining events

Mark fields in HTML:

<input type="text" data-citc="username" />
<input type="email" data-citc="email" />

Configuration

CITC({
    endpoint?:  string,           // if omitted, uses ConsoleTransport
    transport?: Transport,
    fields?:    FieldSelection,
    privacy?:   PrivacyOptions,
    queue?:     QueueOptions,
    lifecycle?: LifecycleOptions,
    context?:   Partial<Context>,
    defaults?:  DefaultsOptions,
    dom?:       DOMOptions,
    debug?:     boolean,
})

Field Discovery

Attribute mode — discovers all elements with a given data attribute at start() time.

fields: {
    mode: 'attribute',
    attribute: 'data-citc',
    capture: {
        focus:     true,   // default
        keystroke: true,   // default
        caret:     false,  // default
        selection: false,  // default
        clipboard: false,  // default
    },
}

Explicit mode — specify fields by CSS selector with per-field capture config.

fields: [
    { id: 'email',    selector: '#email',    capture: { focus: true, keystroke: true } },
    { id: 'password', selector: '#password', capture: { focus: true, clipboard: false } },
]

Default capture config — applied to all fields before per-field overrides.

defaults: {
    capture: { focus: true, keystroke: true, caret: false },
}

Privacy

privacy: {
    redactText?:      boolean,  // default: true  — nulls keystroke.key, keystroke.code, selection.text
    redactClipboard?: boolean,  // default: true  — nulls clipboard.content
}

Queue

queue: {
    batchSize?:     number,  // default: 10    — flush after N events
    flushInterval?: number,  // default: 5000  — flush N ms after last enqueue (0 to disable)
    maxQueueSize?:  number,  // default: 1000  — drops oldest when exceeded
}

Lifecycle

lifecycle: {
    enabled?:                boolean,  // default: true
    autoFlushIntervalMs?:    number,   // default: 5000  — repeating flush interval
    flushOnVisibilityChange?: boolean, // default: true  — flush when tab is hidden
    flushOnBeforeUnload?:    boolean,  // default: true  — flush before page unload
    flushOnFormSubmit?:      boolean,  // default: false — flush on data-citc-submit forms
}

flushOnBeforeUnload works most reliably with BeaconTransport — HTTP requests may not complete before the page closes.

Context

Attached to every event. Can be updated at any time with setContext().

context: {
    userId?:      string,
    environment?: string,
    metadata?:    Record<string, unknown>,
    // sessionId is generated automatically
}

Transports

When endpoint is provided, CITC uses BeaconTransport if sendBeacon is available, otherwise HttpTransport. With no endpoint, it falls back to ConsoleTransport.

import { CITC, HttpTransport, BeaconTransport, ConsoleTransport } from '@louisglen1/citc';

CITC({ transport: new BeaconTransport('https://api.example.com/telemetry') });

Custom transport:

import { Transport, TelemetryEvent } from '@louisglen1/citc';

class MyTransport implements Transport {
    async send(events: TelemetryEvent[]): Promise<void> {
        // send anywhere
    }
}

Privacy Model

| Event | Always captured | Redacted by default | |-------|----------------|---------------------| | focus / blur | field ID, timestamp | — | | keystroke | field ID, timestamp, modifier keys | key, code | | caret | field ID, timestamp, cursor position | — | | selection | field ID, timestamp, range (start, end, length) | selected text | | clipboard | field ID, timestamp, content length | clipboard content |

Full input values and password fields are never captured regardless of settings. Redaction happens in the browser before events are queued.

API

CITC(options?: CITCOptions): TelemetryEngine

| Method | Description | |--------|-------------| | start(): void | Discover fields and begin collecting | | stop(): Promise<void> | Stop collecting and flush remaining events | | flush(): Promise<void> | Flush pending events without stopping | | setContext(ctx: Partial<Context>): void | Merge new values into the session context |

License

MIT