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

@zahooz/usage-tracker

v3.1.6

Published

## Installation

Readme

usage-tracker

Installation

Using npm:

$ npm install --save @zahooz/usage-tracker

How to Initialize

Initialization of the tracker should be done once per page load, when your app is initialized. Please contact Nicholas Day to get the domain_id and api_url for your application. If you deploy your app to multiple platforms (e.g. dev, staging, prod) then you will be provided will a unique domain_id to use on each platform. The api_url will be consistent across platforms.

import UsageTracker from '@zahooz/usage-tracker';

UsageTracker.init(domain_id, api_url, {
  sessionTimeOut: 30 // defaults to 15 minutes if not provided
});
UsageTracker.listenRoutes();

The sessionTimeOut property in the config refers to the time of inactivity before a new tracking session is created. This will not effect sessions within your application, it is internal to the tracker.

Login Event

The tracker will only start tracking user activity once a user has logged in. To perform the login operation, you'll need to add the below script to the point in your code that a user logs in.
If a user is already logged in when they hit your site, you can just call this function once when the page loads.

Note that values for id, displayName and email are all required. If they are not provided, then a session will not be created, and no tracking will happen.

UsageTracker.login({
  id: '{external id of the user, e.g. DAYN02}',
  displayName: 'John Doe',
  email: '[email protected]'
});

Logout Event

When the user logs out of your application, you should call the following to tell the tracker to end the user's session.

UsageTracker.logout();

Pause Tracking

For situations where you want to temporarily pause tracking, you can call the below function.

UsageTracker.pauseTracking();

Resume Tracking

If you're previously paused tracking, you can resume it again by calling the following function.

UsageTracker.resumeTracking();

Updating the Domain ID after initialization

If you need to update the domain ID after you've already initialized the Usage Tracker, for instance if you're serving multiple projects from the same single-page app, then you can just do the following.

UsageTracker.setDomain(domain_id);

Behind the scenes, this will start a new session for the user with the new domain.

Custom Events

You can create your own events to track whatever you want within your application. You just need to call the dispatch function, with an arbitrary string for your event name, and any JSON for the event payload, as shown below.

UsageTracker.dispatch('myCustomEvent', {
  test: '123',
});