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

@bountain/attribution-kit

v1.0.3

Published

Drop-in helpers to capture and verify Bountain click attribution (click_id + click_token) in Next.js.

Readme

@bountain/attribution-kit

Drop-in helpers to capture and verify Bountain click attribution (click_id + signed click_token) in Next.js App Router.

What it solves

  • Visitors arrive at your site with:
    • click_id (UUID)
    • click_token (HMAC-signed short-lived eligibility token)
  • You want to persist that token as a first-party HttpOnly cookie and later verify it on the server when recording a conversion.

Install

This repo is a pnpm workspace. From the root:

  • pnpm add @bountain/attribution-kit

(When published, this will work the same from any repo.)

1) Add a persist route (server)

Create src/app/api/attribution/persist/route.ts:

import { createPersistAttributionRoute } from '@bountain/attribution-kit/server';

export const { GET, POST } = createPersistAttributionRoute();

This route sets cookies:

  • yd_click_id (non-HttpOnly)
  • yd_click_token (HttpOnly)

2) Capture on your landing page (client)

In any page.tsx that receives traffic, add a tiny client component:

'use client';

import { useAttributionCapture } from '@bountain/attribution-kit/client';

export function AttributionCapture() {
  useAttributionCapture({ endpoint: '/api/attribution/persist' });
  return null;
}

Then render it in your page:

import { AttributionCapture } from './AttributionCapture';

export default function Page() {
  return (
    <main>
      <AttributionCapture />
      {/* ... */}
    </main>
  );
}

3) Verify on conversion (server)

Example in a route handler or server action:

import { verifyAttributionFromRequest } from '@bountain/attribution-kit/server';

export async function POST(req: Request) {
  const secret = process.env.APP_SECRET;
  if (!secret) return new Response('missing APP_SECRET', { status: 500 });

  const verified = verifyAttributionFromRequest(req, { secret });
  if (!verified.ok) {
    // analytics-only conversion
    return new Response(JSON.stringify({ ok: true, eligible: false, error: verified.error }), {
      status: 200,
      headers: { 'content-type': 'application/json' },
    });
  }

  // eligible conversion; verified.clickId binds lineage to a real click
  return new Response(JSON.stringify({ ok: true, eligible: true, clickId: verified.clickId }), {
    status: 200,
    headers: { 'content-type': 'application/json' },
  });
}

Notes

  • A browser cannot set an HttpOnly cookie, so capture must call a server endpoint.
  • Token verification uses Node crypto (HMAC SHA-256).
  • If verification fails (expired, bad_signature, etc.), record the conversion as analytics-only.