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

wirelog

v0.4.1

Published

WireLog analytics client for Node.js and browsers — zero runtime dependencies

Readme

wirelog

WireLog analytics client for Node.js and browsers. Zero runtime dependencies — uses native fetch and Web Crypto.

Install

npm install wirelog

Quick Start

import { wl } from "wirelog";

wl.init({ apiKey: "pk_your_public_key" });

// Track an event
wl.track({ event_type: "signup", user_id: "u_123", event_properties: { plan: "free" } });

// Identify a user (bind device → user, set profile)
wl.identify({ user_id: "[email protected]", user_properties: { plan: "pro" } });

// All subsequent track() calls include user_id automatically
wl.track({ event_type: "checkout", event_properties: { amount: 42 } });

In browsers, the singleton automatically manages device_id, session_id, and user_id — matching the same localStorage keys as the wirelog.js script tag (wl_did, wl_uid). If both SDKs are on the page, calling identify() from either one makes the user visible to both.

Browser track() and trackBatch() auto-inject event context into event_properties:

  • url
  • language
  • timezone

Browser events are also marked with clientOriginated: true automatically.

Caller-provided event_properties win on key conflicts.

Browser Delivery (Breaking Change)

In browsers, track() now buffers events locally and flushes them asynchronously in small batches:

  • Flushes on every 10 queued events or every 2 seconds
  • Retries transient failures (429, 5xx, network) with backoff (up to 3 retries)
  • Flushes on visibilitychange (hidden) and pagehide using fetch(..., { keepalive: true })
  • Queue is capped at 500 events (oldest events are dropped first)

trackBatch() is still explicit and sends immediately as one request (up to 2000 events).

Explicit Instances

For server-side Node.js, multiple projects, or test isolation, create instances directly:

import { WireLog } from "wirelog";

const client = new WireLog({ apiKey: "sk_your_secret_key" });

await client.track({ event_type: "invoice.paid", user_id: "u_123" });
const result = await client.query("invoice.paid | last 7d | count by day");

API

wl.init(config)

Initialize the singleton with your API key. Call once at app startup. If you skip this, track()/identify()/query() will console.warn and no-op.

wl.track(event)

Track a single event. Auto-generates insert_id and time if not provided.

In browsers, track() is buffered by default: it enqueues the event and returns { accepted: 1, buffered: true }.

In Node, track() sends immediately and returns the API response.

wl.trackBatch(events)

Track multiple events in one request (up to 2000). In browsers, auto-injects identity and browser context per event, then sends immediately.

wl.flush()

Flush buffered browser track() events immediately.

  • Browser: sends queued events now and returns { accepted: N }
  • Node: no-op, returns { accepted: 0 }

wl.query(q, opts?)

Run a pipe DSL query. Options: format ("llm", "json", "csv"), limit, offset.

wl.identify(params)

Bind a device to a user and/or set profile properties. Supports user_property_ops ($set, $set_once, $add, $unset). In browsers, persists user_id to localStorage.

identify() requires a non-empty user_id. In browser mode, pending URL attribution (utm_*, gclid, fbclid) is merged into one identify call:

  • first touch -> $set_once.initial_*
  • last touch -> $set.last_*

Attribution dedupe is marked only after a successful identify response.

wl.reset()

Clear identity state. In browsers, generates a new device ID and clears the stored user. Matches the behavior of window.wl.reset().

wl.deviceId / wl.userId

Read-only accessors for the current browser identity. Returns null in Node.

Zero Runtime Dependencies

This library uses only the native fetch and Web Crypto APIs. No axios, no node-fetch, no got. Works in Node 18+ and all modern browsers.

Learn More