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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@leanbase.com/js

v0.1.2

Published

Leanbase browser SDK - event tracking, autocapture, and session replay

Readme

Leanbase SDK

Lightweight browser SDK for Leanbase - event tracking, autocapture, and session replay.

Installation

npm install @leanbase.com/js
# or
pnpm add @leanbase.com/js

Quick Start

import { Leanbase } from '@leanbase.com/js'

// Initialize with your API key
const leanbase = new Leanbase('your-api-key')

// Track events
leanbase.capture('button_clicked', {
  button_name: 'signup',
  page: 'homepage'
})

// Identify users
leanbase.identify('user-123', {
  email: '[email protected]',
  name: 'John Doe'
})

CDN / Script Tag

Include the prebuilt IIFE bundle from a CDN and use the global leanbase object. Call leanbase.init('<apiKey>', options) once, then use leanbase.capture(...) and friends.

<script src="https://unpkg.com/@leanbase.com/js/dist/leanbase.iife.js"></script>
<script>
  // Initialize with your API key
  leanbase.init('your-api-key', { host: 'https://i.leanbase.co' })

  // Track an event
  leanbase.capture('pageview')
</script>

Alternatively via jsDelivr:

<script src="https://cdn.jsdelivr.net/npm/@leanbase.com/js/dist/leanbase.iife.js"></script>

Configuration

const leanbase = new Leanbase('your-api-key', {
  host: 'https://i.leanbase.co', // default
  autocapture: true, // default - automatically capture clicks and form interactions
  preloadFeatureFlags: true, // default - fetch feature flags on initialization
})

API Reference

leanbase.capture(event, properties?, options?)

Track custom events.

leanbase.capture('purchase_completed', {
  amount: 99.99,
  currency: 'USD',
  product_id: 'abc-123'
})

leanbase.identify(distinctId?, properties?, options?)

Identify users and set user properties.

leanbase.identify('user-456', {
  email: '[email protected]',
  plan: 'premium'
})

leanbase.group(groupType, groupKey, properties?)

Associate users with groups (teams, organizations, etc).

leanbase.group('company', 'acme-corp', {
  name: 'Acme Corporation',
  plan: 'enterprise'
})

leanbase.alias(alias)

Create an alias for the current user.

leanbase.alias('user-123')

Publishing

Version Bumping

This monorepo uses Changesets for versioning.

To bump the version:

  1. Create a changeset: pnpm changeset add
    • Select @leanbase.com/js package
    • Choose version bump type (patch, minor, major)
    • Add a description of changes
  2. Commit the changeset file (.changeset/*.md)
  3. Run pnpm changeset version to update versions
  4. Commit the version changes

Example changeset file (.changeset/example-changes.md):

---
"@leanbase.com/js": patch
---

Added IIFE build for script-tag usage and improved documentation.

Publishing to NPM

  1. Ensure you have an NPM token with publish permissions
  2. Set the token: export NPM_TOKEN=your_token
  3. Publish: pnpm [email protected]/js publish
  4. Or test first: pnpm [email protected]/js exec npm publish --dry-run

The package will be published to https://www.npmjs.com/package/@leanbase.com/js

License

Copyrighted by Leanflag Limited