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

@pixby-analytics/analytics-sdk

v0.1.5

Published

Lightweight browser SDK for Pixby product analytics

Readme

@pixby-analytics/analytics-sdk

Browser SDK for sending product analytics events to Pixby.

Install

Published package:

pnpm add @pixby-analytics/analytics-sdk

Local workspace package during development:

pnpm add /Users/aryankhan/Desktop/Work/pixby/sdk

Usage

import analytics from "@pixby-analytics/analytics-sdk";

analytics.init("demo_project_key", {
  apiUrl: "http://localhost:8080"
});

analytics.identify("user_1", {
  name: "Ava Patel",
  email: "[email protected]",
  orgId: "org_1",
  role: "admin",
  plan: "pro"
});

analytics.track("project_created", {
  project_id: "123"
});

Web Script

For website installs without bundling the package into app code:

<script
  defer
  src="https://cdn.jsdelivr.net/npm/@pixby-analytics/analytics-sdk/dist/web.global.js"
  data-project-key="demo_project_key"
  data-api-url="https://pixby-analytics.onrender.com"
></script>

The web bundle automatically:

  • initializes the SDK from data-* attributes
  • tracks the initial page_viewed
  • tracks SPA route changes through pushState, replaceState, popstate, and hashchange
  • tracks Core Web Vitals: LCP, INP, CLS, FCP, and TTFB
  • loads project-level autocapture settings from Pixby
  • tracks outbound links, file downloads, form submits, and JavaScript errors when enabled
  • optionally tracks marked clicks when an element has data-pixby-capture
  • exposes window.pixbyAnalytics for optional manual tracking

Web Vitals are sent as web_vital_measured events with metric, value, rating, unit, path, url, and title properties. The dashboard aggregates these into p75 field metrics for each web analytics project.

Autocapture events are intentionally privacy-limited. form_submitted records form metadata only, not field values. Marked click capture is opt-in and sends element_clicked only for elements explicitly tagged with data-pixby-capture.

<button data-pixby-capture="pricing_cta">Start trial</button>

You can disable specific autocapture types from the Pixby setup screen without changing the script URL. Script attributes can also override settings in emergencies:

<script
  defer
  src="https://cdn.jsdelivr.net/npm/@pixby-analytics/analytics-sdk/dist/web.global.js"
  data-project-key="demo_project_key"
  data-api-url="https://pixby-analytics.onrender.com"
  data-autocapture-errors="false"
></script>

The script URL intentionally does not pin an npm version. Customers can install it once, and future SDK releases are picked up after the package is published and the CDN cache refreshes. If a customer needs strict stability, they can pin a specific version manually.

Web user profiles

Pixby creates visitor profiles from the stable anonymous id automatically. If your site has a logged-in user, call identify() after login or account hydration:

<script>
  window.pixbyAnalytics?.identify("user_123", {
    name: "Ava Patel",
    email: "[email protected]",
    orgId: "org_1",
    plan: "pro"
  });
</script>

If name and email are missing, the dashboard assigns a deterministic Faker-generated pseudonym to the actor. The same project and actor id will always resolve to the same generated name.

API

init(projectKey, options?)

Initializes the client and starts the background flush loop.

Options:

  • apiUrl
  • flushIntervalMs
  • flushAt
  • storageKey
  • headers

identify(userId, traits?)

Associates future events with a known user and event-time traits.

Traits with name, email, and orgId are used by user profiles. Anonymous visitors still get profiles from anonymousId, with a labelled generated pseudonym when no real name is provided.

track(event, properties?, context?)

Queues an event for delivery.

flush()

Immediately attempts to send queued events.

Build

pnpm --filter @pixby-analytics/analytics-sdk build

The package outputs:

  • dist/index.js for ESM consumers
  • dist/index.cjs for CommonJS consumers
  • dist/index.d.ts for TypeScript

Versioning and publish flow

Create a changeset:

pnpm changeset

Review version updates:

pnpm version:sdk

Publish:

pnpm release:sdk

Dry-run the package before publishing:

pnpm --filter @pixby-analytics/analytics-sdk pack:check
pnpm --filter @pixby-analytics/analytics-sdk publish:dry-run

The dry-run script uses a temporary npm cache under /tmp so it can succeed even if your local ~/.npm cache has permission issues.

Real npm publish checklist

  1. Log into npm:
npm login
  1. Confirm the package name you want is available:
npm view @pixby-analytics/analytics-sdk
  1. Build and inspect the tarball:
pnpm --filter @pixby-analytics/analytics-sdk pack:check
  1. Run a publish dry run:
pnpm --filter @pixby-analytics/analytics-sdk publish:dry-run
  1. Publish for real:
cd sdk
npm publish --access public

Notes before public publish

  • The SDK is licensed under MIT.
  • If you want richer npm metadata later, add repository, homepage, and bugs fields once the public repo URL is final.

Next.js example

App Router client bootstrap:

"use client";

import { useEffect } from "react";
import analytics from "@pixby-analytics/analytics-sdk";

export function PixbyProvider() {
  useEffect(() => {
    analytics.init(process.env.NEXT_PUBLIC_PIXBY_PROJECT_KEY!, {
      apiUrl: process.env.NEXT_PUBLIC_PIXBY_API_URL
    });
  }, []);

  return null;
}

Mount the provider near the root layout and call identify() and track() from client components after user or feature actions are known.