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

wisetrack

v2.0.9

Published

WiseTrack Web SDK

Readme

WiseTrack Web SDK

A lightweight JavaScript SDK for tracking user behavior and events in your web applications.

npm version npm downloads bundle size license


🚀 Features

  • Lightweight and easy to integrate
  • Supports custom and revenue events
  • Environment-based configuration (Sandbox & Production)
  • Automatic or manual tracking control
  • Customizable logging level
  • TypeScript support with full type definitions
  • Tree-shakable ESM and CommonJS builds
  • Zero dependencies (except ua-parser-js)

📦 Installation

Via npm, yarn or pnpm

npm install wisetrack
yarn add wisetrack
pnpm add wisetrack

Via CDN (Direct Browser Usage)

<!-- Latest version -->
<script src="https://cdn.jsdelivr.net/npm/wisetrack/dist/cdn/sdk.bundle.min.js"></script>

<!-- Specific version -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/sdk.bundle.min.js"></script>

Alternative CDNs

<!-- unpkg -->
<script src="https://unpkg.com/wisetrack/dist/cdn/sdk.bundle.min.js"></script>

✅ Basic Usage

For npm/yarn installations (ES6 Modules)

1. Initialize the SDK

import { WiseTrack, WTUserEnvironment, WTLogLevel } from "wisetrack";

await WiseTrack.instance.init({
  appToken: "YOUR_APP_TOKEN",
  appVersion: "1.0.0",
  appFrameWork: "Next.js",
  userEnvironment: WTUserEnvironment.SANDBOX,
  logLevel: WTLogLevel.DEBUG,
});

2. Start Tracking (Optional)

// Starts automatically if `startTrackerAutomatically` is true.
// Otherwise, you can start manually:
await WiseTrack.instance.startTracking();

3. Track Event

import { WTEvent } from "wisetrack";

// Default Event
const signupEvent = WTEvent.defaultEvent("signup", {
  method: "Google",
});
signupEvent.addParam("method", "Google");
await WiseTrack.instance.trackEvent(signupEvent);

// Revenue Event
const purchase = WTEvent.revenueEvent(
  "order_completed",
  99.99,
  RevenueCurrency.USD,
  {
    item_id: "SKU-123",
  }
);
await WiseTrack.instance.trackEvent(purchase);

Note: Event parameter keys and values have a maximum limit of 50 characters.

For CDN usage (Direct Browser)

<!DOCTYPE html>
<html>
  <head>
    <script src="https://cdn.jsdelivr.net/npm/wisetrack/dist/cdn/sdk.bundle.min.js"></script>
  </head>
  <body>
    <script>
      // Initialize
      WiseTrackSDK.WiseTrack.instance.init({
        appToken: "YOUR_APP_TOKEN",
        appVersion: "1.0.0",
        appFrameWork: "Vanilla JS",
        userEnvironment: WiseTrackSDK.WTUserEnvironment.SANDBOX,
        logLevel: WiseTrackSDK.WTLogLevel.DEBUG,
      });

      // Track event
      const signupEvent = WiseTrackSDK.WTEvent.defaultEvent("signup", {
        method: "Google",
      });
      WiseTrackSDK.WiseTrack.instance.trackEvent(signupEvent);

      // Track revenue event
      const purchaseEvent = WiseTrackSDK.WTEvent.revenueEvent(
        "buy-plan-one",
        100.0,
        "USD",
        {
          user: "some user id",
        }
      );
      WiseTrackSDK.WiseTrack.instance.trackEvent(purchaseEvent);
    </script>
  </body>
</html>

For CommonJS (Node.js)

const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");

// Same usage as ES6 modules

Using in Progressive Web Apps (PWA)

WiseTrack is fully compatible with Progressive Web Apps (PWAs). However, to ensure accurate tracking and data delivery, please note:

Exclude WiseTrack API requests from Service Worker caching If you are using workbox or a custom service-worker.js, add this rule to avoid caching:

workbox.routing.registerRoute(
  ({ url }) => url.origin.includes("wisetrack.io"),
  new workbox.strategies.NetworkOnly()
);

⚙️ Configuration Options

| Key | Required | Default | Description | | --------------------------- | -------- | ------------ | -------------------------------------------------------------- | | appToken | ✅ | - | Your unique WiseTrack app token | | appVersion | ✅ | - | Your app version | | appFrameWork | ✅ | - | The framework/platform name | | userEnvironment | ❌ | PRODUCTION | WTUserEnvironment.SANDBOX or WTUserEnvironment.PRODUCTION | | trackingWaitingTime | ❌ | 0 | Time in seconds to wait before tracking starts automatically | | startTrackerAutomatically | ❌ | true | Whether to start tracking automatically | | customDeviceId | ❌ | auto | Provide your own device ID | | defaultTracker | ❌ | - | Optional tracker name | | logLevel | ❌ | INFO | Logging level (WTLogLevel.DEBUG / INFO / WARN / ERROR) |


🧹 Flush / Stop Tracking

// Stop tracking and clear stored data
WiseTrack.instance.flush();

🔍 Log Level

Set the SDK log level for debugging:

WiseTrack.instance.setLogLevel(WTLogLevel.DEBUG);

🏗️ Framework Examples

React/Next.js

import { useEffect } from "react";
import { WiseTrack, WTUserEnvironment } from "wisetrack";

export default function App() {
  useEffect(() => {
    WiseTrack.instance.init({
      appToken: "YOUR_APP_TOKEN",
      appVersion: "1.0.0",
      appFrameWork: "React",
      userEnvironment: WTUserEnvironment.PRODUCTION,
    });
  }, []);

  return <div>Your App</div>;
}

Vue.js

<script setup>
import { onMounted } from "vue";
import { WiseTrack, WTUserEnvironment } from "wisetrack";

onMounted(() => {
  WiseTrack.instance.init({
    appToken: "YOUR_APP_TOKEN",
    appVersion: "1.0.0",
    appFrameWork: "Vue.js",
    userEnvironment: WTUserEnvironment.PRODUCTION,
  });
});
</script>

Angular

import { Component, OnInit } from "@angular/core";
import { WiseTrack, WTUserEnvironment } from "wisetrack";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
})
export class AppComponent implements OnInit {
  async ngOnInit() {
    await WiseTrack.instance.init({
      appToken: "YOUR_APP_TOKEN",
      appVersion: "1.0.0",
      appFrameWork: "Angular",
      userEnvironment: WTUserEnvironment.PRODUCTION,
    });
  }
}

📊 Bundle Size & Performance

| Build Type | Size (Minified) | Size (Gzipped) | Use Case | | ---------- | --------------- | -------------- | ------------------------------- | | ESM | ~45KB | ~12KB | Modern bundlers (Webpack, Vite) | | CommonJS | ~45KB | ~12KB | Node.js, older bundlers | | CDN Bundle | ~25KB | ~8KB | Direct browser usage |


🔧 TypeScript Support

This package includes TypeScript definitions out of the box. No need to install additional @types packages.

import type { WTConfig, WTEventData } from "wisetrack";

const config: WTConfig = {
  appToken: "YOUR_APP_TOKEN",
  appVersion: "1.0.0",
  appFrameWork: "TypeScript App",
};

🧪 Browser Compatibility

| Browser | Version | | ------- | ------- | | Chrome | ≥ 60 | | Firefox | ≥ 60 | | Safari | ≥ 12 | | Edge | ≥ 79 |


📚 API Reference & Support


📄 Changelog

See CHANGELOG.md for a list of changes.


📝 License

MIT © WiseTrack