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

@codeankitanime/eventlogger

v1.2.0

Published

A lightweight JavaScript event tracker that logs user interactions (clicks, inputs, scrolls, etc.) along with browser, OS, and optional geolocation/IP metadata. Ideal for building custom front-end analytics.

Readme

event-logger

A lightweight front-end event tracking utility with system and location metadata.

Features

  • Tracks: click, scroll, input, keydown, mousemove, focus, blur
  • Collects metadata: OS, browser, device type, geolocation (if permitted)
  • Optionally adds geolocation (HTML5) and IP-based location (via backend)

Installation

npm install event-logger

Tech Stack

  • MongoDB: Document-oriented NoSQL database for storing user interaction data.
  • Express: Web application framework for Node.js, designed for building APIs and handling requests.
  • React: Front-end library for building user interfaces, used to create interactive components for capturing events.
  • Node.js: JavaScript runtime for executing server-side code.

Usage

  • The Front End Logger captures various user events such as clicks, scrolls, and navigation.
  • Simply integrate the logger component into your React application and configure it according to your needs.
  • You can view the captured events from the MongoDB database or create a dashboard to visualize the data.
import { initEventLogger } from 'event-logger';

initEventLogger({
  events: ['click', 'input'],
  flushInterval: 5000,
  onFlush: (data) => {
    console.log(data); // contains meta and events
  }
});

Note

-For full IP/location info, use a backend API and append the result to the meta field. Backend Example (/api/get-meta-info)

// Express backend route
app.get('/api/get-ip-info', (req, res) => {
  const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
  const geo = geoip.lookup(ip);

  res.json({
    ip,
    location: geo
      ? `${geo.city || 'Unknown'}, ${geo.region || ''}, ${geo.country || ''}`
      : 'Unknown'
  });
});

Than Intigration

import { initEventLogger } from 'event-logger';

async function setupLogger() {
  const res = await fetch('/api/get-meta-info');
  const backendMeta = await res.json();

  initEventLogger({
    events: ['click', 'input', 'scroll'],
    flushInterval: 5000,
    onFlush: (data) => {
      const fullMeta = {
        ...data.meta,
        ...backendMeta
      };

      const payload = {
        meta: fullMeta,
        events: data.events
      };

      console.log('Flushed Payload:', payload);

      // Optional: send to your logging service
      // fetch('/api/log', {
      //   method: 'POST',
      //   headers: { 'Content-Type': 'application/json' },
      //   body: JSON.stringify(payload)
      // });
    }
  });
}

setupLogger();

Author

Ankit - Your GitHub Profile

License

This project is licensed under the MIT License. See the LICENSE file for details.