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

@mifistix-cloud/analytics

v2.0.5

Published

Event Analytics SDK for Mifistix Cloud - Track user events and analytics data

Readme

@mifistix-cloud/analytics

Event Analytics SDK for Mifistix Cloud - Track user events and analytics data.

License

This module is licensed for internal use within Mifistix only. See LICENSE for details.

Installation

npm install @mifistix-cloud/analytics

Quick Start

const { initializeApp } = require('@mifistix-cloud/app');
const { getAnalytics, logEvent } = require('@mifistix-cloud/analytics');

// Initialize app first
const app = initializeApp({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});

// Get analytics instance
const analytics = getAnalytics(app);

// Log an event
logEvent(analytics, 'button_click', {
  button_name: 'signup',
  screen: 'home'
});

// Set user properties
analytics.setUserProperties({
  plan: 'premium',
  region: 'eu'
});

// Set user ID
analytics.setUserId('user-123');

API Reference

getAnalytics(app)

Get analytics instance for an app.

Parameters:

  • app (Object, required): Initialized app instance

Returns: Analytics client instance

Example:

const analytics = getAnalytics(app);

logEvent(analytics, eventName, params)

Log an analytics event.

Parameters:

  • analytics (Object): Analytics instance
  • eventName (string, required): Event name (validated)
  • params (Object, optional): Event parameters

Example:

logEvent(analytics, 'purchase', {
  item_id: 'prod-123',
  price: 99.99,
  currency: 'USD'
});

setUserProperties(analytics, properties)

Set user properties that will be sent with all events.

Parameters:

  • analytics (Object): Analytics instance
  • properties (Object, required): User properties object

Example:

analytics.setUserProperties({
  subscription: 'premium',
  tier: 'gold'
});

setUserId(analytics, id)

Set user ID for event attribution.

Parameters:

  • analytics (Object): Analytics instance
  • id (string, required): User ID

Example:

analytics.setUserId('user-abc-123');

flushEvents(analytics)

Manually flush all queued events to server.

Parameters:

  • analytics (Object): Analytics instance

Returns: Promise

Example:

await analytics.flushEvents();

stopAutoFlush()

Stop automatic event flushing (for testing).

Example:

analytics.stopAutoFlush();

Security Features

  • Event Name Validation: Ensures event names are valid strings
  • User ID Validation: Validates user ID before setting
  • Error Handling: Logs warnings for invalid inputs without crashing
  • Auto-flush: Automatically flushes events every 10 seconds
  • Batch Processing: Sends events in batches of 50

Architecture

analytics/
├── src/
│   ├── core/
│   │   └── AnalyticsClient.js   # Main analytics client
│   ├── services/
│   │   └── EventQueue.js        # Event queue management
│   ├── utils/
│   │   └── helpers.js          # Helper functions
│   ├── types/
│   │   └── index.js            # Type definitions
│   └── config/
│       └── constants.js        # Configuration constants
└── index.js

Event Queue

Events are automatically queued and flushed in batches:

  • Batch size: 50 events
  • Auto-flush interval: 10 seconds
  • Flush on page unload (browser)

License

MIT