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

@refkitnet/sdk

v0.1.0

Published

RefKit browser and server SDK for click capture, customer identification, and API-reported payments

Downloads

31

Readme

@refkitnet/sdk

Browser and server helpers for RefKit affiliate click capture, customer identification, and API-reported payments.

Install

npm install @refkitnet/sdk

Consent (required where applicable)

Before recording RefKit tracking, you must obtain end-user consent where your jurisdiction or CMP requires it (e.g. GDPR/ePrivacy). Server-side capture does not remove that responsibility; only capture after any required consent is granted.

Browser fallback example:

if (userHasAnalyticsConsent()) {
  refkit.capture();
}

RefKit is a data processor; you (the app owner) are the data controller and are responsible for lawful basis, privacy notices, and consent UI.

Server capture (recommended)

Capture on the backend that receives the landing request so RefKit receives the original visitor metadata and the returned click id can live in secure first-party storage.

import { captureClick } from "@refkitnet/sdk";

const landingUrl = new URL(request.url);
const via = landingUrl.searchParams.get("via");

if (via) {
  const result = await captureClick({
    apiKey: process.env.REFKIT_API_KEY!,
    via,
    page: landingUrl.toString(),
    referrer: request.headers.get("referer") ?? undefined,
    visitorIp: trustedClientIp(request),
    visitorUserAgent: request.headers.get("user-agent") ?? undefined,
  });

  secureSession.refkitClickId = result.click_id;
}

The app API key is server-side only. Never expose it in browser code. When your app is behind a proxy, use your framework or platform's trusted-proxy client IP helper instead of accepting an arbitrary X-Forwarded-For value.

Browser fallback

import { init, capture, getClickId, getStripeMetadata } from "@refkitnet/sdk/browser";

init();

// After consent — reads ?via= from URL, records click, and persists click_id
await capture();

const clickId = getClickId();

// Stripe apps: pass to Stripe Checkout metadata on your server
const metadata = getStripeMetadata();

Browser capture uses the public capture mode without an API key. RefKit derives visitor metadata from the request and ignores body-supplied visitor metadata.

The unique via code identifies the affiliate link and its Program. Do not add a Program identifier to the public URL.

Customer identification and API revenue

import {
  identifyCustomer,
  reportPayment,
  reportRefund,
} from "@refkitnet/sdk";

const result = await identifyCustomer({
  apiKey: process.env.REFKIT_API_KEY!,
  baseUrl: "https://app.refkit.net",
  externalCustomerId: "user_123",
  email: "[email protected]",
  clickId: clickIdFromSecureSession,
});

// API-reported revenue apps only
await reportPayment({
  apiKey: process.env.REFKIT_API_KEY!,
  paymentId: invoice.id,
  customerId: result.customer_id,
  programId: result.program_id,
  amount: 2900,
  currency: "usd",
});

await reportRefund({
  apiKey: process.env.REFKIT_API_KEY!,
  refundId: refund.id,
  paymentId: invoice.id,
  amount: 2900,
});

If payment reporting happens after signup, persist result.customer_id and result.program_id with your customer or billing record.

Attribution window

Clicks are attributed for 30 days. Keep the server-captured click id in secure first-party storage and call identifyCustomer as soon as possible after signup. Browser storage limits are another reason to treat browser capture as the fallback.

License

MIT