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

@ffanalytics/sdk

v2.2.0

Published

Browser SDK for AnalyticsFF: autocaptures pageviews, clicks and errors, plus custom events.

Downloads

458

Readme

@ffanalytics/sdk

Browser SDK for AnalyticsFF. One call captures pageviews (including SPA navigation), clicks and uncaught errors; add your own events on top.

npm install @ffanalytics/sdk

Usage

import { init, identify, track, register, unregister, reset } from "@ffanalytics/sdk";

init({ key: "pk_..." });

identify(user.id, { plan: "pro" }); // after login
track("report_exported", { format: "csv" });
reset(); // on logout

register(properties) adds properties to every event after it, autocaptured ones included, until unregister(key) removes one. They live in memory only, so a reload or a closed tab clears them:

register({ replay_id: "r_81f2", instrument: "NQZ6" }); // when the replay opens
unregister("replay_id"); // when it closes

The pk_ key is a publishable project key: it can only send events, so it is safe to ship in client code.

Feature flags

import { getFlag, onFlags } from "@ffanalytics/sdk";

onFlags(() => {
  if (getFlag("new-onboarding") === "test") showNewOnboarding();
});

On load the SDK asks which variant of each flag this browser gets, and keeps the answer for the next page load. getFlag(key) returns the variant, or undefined when the flag is off for this browser or nothing has arrived yet; on a first visit that is the first moment after load, which is why onFlags exists. The first answer per flag on a page is recorded as a $feature_flag_called event, and every event carries $feature/<key> for each flag that is on.

Variants are assigned per browser, so logging in doesn't change them. reset() starts a new browser id and asks again.

Options

| Option | Default | | |---|---|---| | key | required | Publishable project key | | host | https://us.i.analyticsff.com | Ingest address, e.g. your own subdomain | | release | "" | Commit SHA of the running build; ties events to code changes | | autocapture | true | false, or { pageviews, clicks, errors } to pick | | flushIntervalMs | 5000 | How often queued events are sent | | maxBatchSize | 20 | Send early once this many events are queued | | replay | off | { sampleRate, canvasFps, maskInputs } records sessions to watch back; see below | | flags | true | false stops the request for feature flag variants on load | | debug | false | Log every event to the console |

Controlling autocapture in markup

<button data-ff-event="signup_cta">Sign up</button>      <!-- named event instead of $click -->
<a data-ff-plan="pro" href="/pricing">Pricing</a>        <!-- adds { plan: "pro" } -->
<div data-ff-ignore>...</div>                             <!-- nothing inside is captured -->

Session recording

init({ key: "pk_...", replay: { sampleRate: 0.25 } }); // 0.25 records a quarter of sessions; 1 records all

The recorder loads only when replay is set, so pages without it stay small. It captures the page and every change to it, not video, and pauses while the tab is hidden or the session has gone idle.

Every form field plays back as asterisks. To see what people type, keep only password fields masked:

init({ key: "pk_...", replay: { sampleRate: 1, maskInputs: "passwords" } }); // "all" (default) or "passwords"
<div class="ff-mask">Account balance: $4,210</div>   <!-- text replaced with asterisks -->
<div class="ff-block">...</div>                       <!-- recorded as an empty box of the same size -->

Canvas content (charts drawn on <canvas>) plays back blank unless you set canvasFps, which records each canvas that many times a second:

init({ key: "pk_...", replay: { sampleRate: 1, canvasFps: 1 } });

It is off by default because ff-mask can't reach inside a canvas: anything drawn there is recorded as it looks. ff-block on a canvas still leaves it out.

Privacy

  • Input values are never read; only the visible text of buttons and links. Session recordings mask every input.
  • Ids live in localStorage (no cookies). reset() clears them.
  • Safe to import in server-rendered code; call init from client code only.

License

MIT