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

@chumbaq/sdk

v0.2.0

Published

Chumbaq JavaScript SDK for web integration

Readme

Chumbaq JavaScript SDK

@chumbaq/sdk — the web SDK for Chumbaq: events, identity, deferred deep links, web push, banners and in-app messages.

Installation

npm install @chumbaq/sdk

Getting started

import { Chumbaq } from '@chumbaq/sdk';

const chumbaq = new Chumbaq({
  baseUrl: 'https://api.your-chumbaq-host.com',
  apiKey: 'YOUR_API_KEY',
  projectId: 'YOUR_PROJECT_ID',
  debug: true, // log SDK diagnostics to the console while integrating
});

await chumbaq.init();

init() sets the chumbaq_did cookie and registers an anonymous device identity. Server-side click attribution depends on that cookie, so call init() early on every page.

Events and identity

await chumbaq.track('signed_up', { plan: 'free' });
await chumbaq.trackRevenue(499, 'INR');

await chumbaq.identify({
  deviceFingerprint: chumbaq.deviceFingerprint,
  platform: 'web',
  externalUserId: 'user-123',
  userHash, // from your server: see Identity verification
  firstName: 'Jane',
  traits: { plan: 'free' },
});

chumbaq.reset(); // on logout

identify() merges the anonymous history into the identified user.

Identity verification

An external user id must come with a userHash: HMAC-SHA256 of the id under your project's identity secret (API keys page), made on your server, never in the app. Without it the server refuses the identify, so nobody holding your app's public key can claim to be one of your users.

// On your server
const userHash = crypto.createHmac('sha256', IDENTITY_SECRET).update(userId).digest('hex');

// In the app, with the hash your server returned
await chumbaq.identify({ externalUserId: userId, userHash });

In-app messages and banners

The SDK polls for in-app messages every 60 seconds and whenever the screen changes:

chumbaq.setScreen('checkout');
await chumbaq.showBanner('WIDGET_ID', 'bottom');

Deferred deep links

const match = await chumbaq.matchDeferredDeepLink();

Web push

await chumbaq.registerPushToken({ token, platform: 'web', provider: 'fcm' });

In your service worker, report delivery and clicks with reportPushReceived(data) and reportPushClicked(data).

Privacy: consent, do-not-track, deletion and export

These controls help you comply with India's DPDP Act. Consent travels with identify(); a field you leave out changes nothing on the server.

await chumbaq.identify({
  deviceFingerprint: chumbaq.deviceFingerprint,
  platform: 'web',
  externalUserId: 'user-123',
  pushOptIn: false,  // no push to this device
  emailOptIn: true,
  smsOptIn: false,
  whatsappOptIn: false,
  doNotTrack: true,  // stop storing behavioural data from this device
});
  • pushOptIn: false makes every push send skip this device. Left unset, push is allowed and the browser's notification permission governs.
  • doNotTrack: true stops the server storing events, sessions, location and campaign sources for this device. It still answers 2xx, so nothing retries. It does not block messages; the channel opt-ins decide those. If you don't pass doNotTrack, the SDK sends true when the browser's Do Not Track setting is on (including from init()).
  • It covers this device only. A person-wide objection is an owner action in the dashboard API, and the SDK cannot lift that, or any do-not-track set from the dashboard, by sending doNotTrack: false.
  • Every consent change is recorded with its source.
  • Known gaps: there is no dedicated consent call (a change needs another identify()), and the SDK keeps sending events while do-not-track is on (the server drops them).

There is no SDK call to delete or export a user, on purpose: the API key ships in your web app, so anyone can extract it. Have your backend call the server API with a key created with the server-only privacy permission. Never put that key in client code; SDK routes refuse it.

curl -X POST https://api.your-chumbaq-host.com/api/privacy/erasures \
  -H 'x-api-key: <privacy key>' -H 'content-type: application/json' \
  -d '{"externalUserId": "user-123"}'

POST /api/privacy/exports takes the same body and returns the user's data. For an anonymous device, send {"deviceFingerprint": "..."} (from chumbaq.deviceFingerprint) instead. Records that cannot be tied to one person are kept; the response lists them in notErased (notIncluded for exports). After deleting a user, call chumbaq.reset() in the browser so it stops sending their id.

Development

npm install
npm run lint         # type-check
npm run test:logic   # wire-contract checks
npm run build        # emit dist/

Related SDKs

License

Copyright 2026 The Chumbaq Authors.

Licensed under the Apache License, Version 2.0.