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

@convertmax/js

v0.1.7

Published

Isomorphic Convertmax analytics client for browser and Node.js event tracking

Readme

@convertmax/js

Isomorphic Convertmax analytics client for browser and Node.js applications.

Browser delivery is asynchronous and background-friendly via fetch(..., { keepalive: true }). sendBeacon support is intentionally disabled until the Convertmax browser endpoint is deployed for it. keepalive is best-effort browser behavior, not a configurable timeout or guaranteed delivery mechanism.

autoPage

When autoPage: true is enabled in the browser, the client automatically emits page_view:

  • on the initial page load after initialization
  • after history.pushState and history.replaceState
  • on back/forward navigation via popstate
  • when only the query string changes

Hash-only changes are ignored by default.

Automatic browser behaviors

When initialized in the browser, the SDK can automatically:

  • emit page_view events when autoPage: true
  • detect ad click IDs like gclid, msclkid, ttclid, fbclid, scclid, epik, twclid, li_fat_id, tag, yclid, rdt_cid, and qaid, then emit a cpc event
  • classify organic referrers and emit organic
  • classify social referrers and emit social
  • classify search-engine referrers and emit search when a search term is available
  • populate hidden form inputs named cm_visitor and cm_session
  • optionally capture Clickfunnels cf_uvid from browser storage when captureCfUvid: true
  • detect mobile browsers and include that state in automatic browser events
  • respect local opt-out state

Install

npm install @convertmax/js

Usage

import { createConvertmax } from "@convertmax/js";

const convertmax = createConvertmax({
  host: "https://event.convertmax.io",
  apiKey: "public-XXXX"
});

await convertmax.identify("user_123", {
  email: "[email protected]"
});

await convertmax.page("Pricing");
await convertmax.track("click", {
  target: "hero_cta",
  page: "https://example.com/pricing"
});

Node.js

import { createConvertmax } from "@convertmax/js";

const convertmax = createConvertmax({
  host: "https://event.convertmax.io",
  apiKey: process.env.CONVERTMAX_API_KEY,
  runtime: "node"
});

await convertmax.track("page_view", {
  product: "shop",
  event_type: "checkout"
});

await convertmax.track("convert", {
  event_name: "order_checkout_completed",
  source: "api",
  page: "https://shop.example.com/checkout/success",
  order_id: "ord_12345",
  checkout_id: "chk_456",
  currency: "USD",
  value: 149.99,
  revenue: 149.99,
  items: [
    {
      product_id: "sku_1",
      name: "Widget Pro",
      quantity: 1,
      price: 99.99
    }
  ]
});

If your Node.js runtime does not expose fetch, pass one with the fetch option.

writeKey is also supported as a legacy alias, but apiKey is the preferred option name. In browsers, tracking currently uses fetch with keepalive for background-friendly delivery. sendBeacon will be enabled in a future release once the compatible endpoint is deployed.

Opt-out helpers:

  • optoutTracking()
  • optinTracking()
  • optoutStatus()

Legacy-style browser lifecycle helper:

  • config(options?)

Browser lifecycle events:

  • convertmaxLoaded when the browser client is created
  • convertmaxReady after browser auto behaviors have been initialized

API

  • createConvertmax(options)
  • track(event, properties?)
  • identify(userId?, traits?)
  • page(name?, properties?)
  • group(groupId, traits?)
  • alias(userId)
  • config(options?)
  • reset()

Supported track() events

  • page_view
  • click
  • add_cart
  • convert
  • custom
  • search

Supported event examples

await convertmax.track("page_view", {
  product: "shop",
  event_type: "category"
});

await convertmax.track("click", {
  target: "hero_cta",
  page: "https://example.com/pricing"
});

await convertmax.track("add_cart", {
  id: "PRODUCT_ID",
  quantity: 1,
  recommendation: true
});

await convertmax.track("convert", {
  event_name: "order_checkout_completed",
  source: "api",
  page: "https://shop.example.com/checkout/success",
  order_id: "ord_12345",
  checkout_id: "chk_456",
  currency: "USD",
  value: 149.99,
  revenue: 149.99
});

await convertmax.track("custom", {
  event_name: "newsletter_signup",
  source: "api",
  page: "https://shop.example.com/blog/spring-launch",
  email: "[email protected]",
  signup_location: "footer_form",
  list_id: "weekly_updates"
});

await convertmax.track("search", {
  query: "running shoes",
  hits: 42
});

Event schemas

Use convert for measurable conversions such as completed checkouts or qualified leads. Use custom for arbitrary business events such as newsletter signups.

Default source for native JSON API events:

{ "source": "api" }

Canonical convert payload for an order conversion:

{
  "event_type": "convert",
  "visitor": "user_123",
  "session_id": "sess_checkout_789",
  "data": {
    "event_name": "order_checkout_completed",
    "source": "api",
    "page": "https://shop.example.com/checkout/success",
    "order_id": "ord_12345",
    "checkout_id": "chk_456",
    "currency": "USD",
    "value": 149.99,
    "revenue": 149.99,
    "items": [
      {
        "product_id": "sku_1",
        "name": "Widget Pro",
        "quantity": 1,
        "price": 99.99
      },
      {
        "product_id": "sku_2",
        "name": "Widget Case",
        "quantity": 1,
        "price": 50
      }
    ]
  }
}

Canonical custom payload for a newsletter signup:

{
  "event_type": "custom",
  "visitor": "user_123",
  "session_id": "sess_abc123",
  "data": {
    "event_name": "newsletter_signup",
    "source": "api",
    "page": "https://shop.example.com/blog/spring-launch",
    "email": "[email protected]",
    "signup_location": "footer_form",
    "list_id": "weekly_updates"
  }
}

When using the SDK, pass the contents of data to track():

await convertmax.track("convert", {
  event_name: "order_checkout_completed",
  source: "api",
  page: "https://shop.example.com/checkout/success",
  order_id: "ord_12345",
  checkout_id: "chk_456",
  currency: "USD",
  value: 149.99,
  revenue: 149.99
});

await convertmax.track("custom", {
  event_name: "newsletter_signup",
  source: "api",
  page: "https://shop.example.com/blog/spring-launch",
  email: "[email protected]",
  signup_location: "footer_form",
  list_id: "weekly_updates"
});

Links