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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hummingbird-next

v0.3.0

Published

A node.js statistics server

Downloads

5

Readme

HUMMINGBIRD

Site tracking and analytics storage

Description

Hummingbird serves a 1x1 tracking pixel to users. In the browser's GET request it sends back tracking data generated by javascript.

Requirements

  • node.js v0.8.0 or higher

Installation

git clone git://github.com/mnutt/hummingbird.git
cd hummingbird

# Use npm to install the dependencies
npm install

# To use the map, download MaxMind's GeoIP database and extract to the root directory:
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz

Running Hummingbird

To start the analytics server, run the following:

node server.js

By default a dashboard will be run on port 8080. You can disable it for production use in config/config.js. The dashboard is just html served out of public/; you can serve it using any webserver.

Deployment

Make sure to properly secure the dashboard if you don't want outside people to see it. This typically means putting the dashboard behind nginx or apache using basic auth. The dashboard's 'listen' function takes a second argument that is the interface to bind; typically you would choose "127.0.0.1" to only allow access from localhost, or "0.0.0.0" to listen on all interfaces. You should then run the tracking pixel on a different port so that it is accessible to the outside world.

Setting Up Tracking

The file client/hummingbird.js contains a small script to trigger a hummingbird event. You can either paste the contents of the file into the body of your webpage or you can upload it to your server as a .js file and reference it with a <script> tag. Once you have done so, in the footer of your page you can call

HummingbirdTracker.track();

Called with no arguments, it will send over some standard parameters such as the page URL. You can also pass arbitrary data with the event:

HummingbirdTracker.track({logged_in: true});

The data can be used within Hummingbird's metrics to filter events on the backend.

Architecture Overview

Hummingbird is organized into two parts: a node.js-based tracking server that records user activity via a tracking pixel, and a collection of javascript-based widgets that display that activity. The server broadcasts all activity to the clients using Websockets if possible, and falls back to Flash sockets or long polling if necessary.

The Hummingbird.WebSocket object receives websocket events from the server in the form of JSON objects. Individual widgets subscribe to a metric and register handler functions to be called whenever that metric is present.

Logging Customization

Metrics are stored in lib/metrics and auto-loaded. Each metric contains a handler function that is called every time a new user event occurs. Metrics store data in the data object property which gets emitted to clients in intervals specified by the metric. A basic example can be found in lib/metrics/total_views.js. An example of how a metric can filter based on query params is in lib/metric/cart_adds.js.

Display Customization

Hummingbird comes with some stock widgets (Counter, Logger, Graph) that demonstrate how to hook into the data provided by the node.js server. For the minimum amount required to create a widget, see public/js/widgets/logger.js. A widget is an object whose prototype extends Hummingbird.Base and implements onMessage.

Tips

  • To run the UI locally but stream data from your production server, use the url http://localhost:8080/?ws_server=your-host.com&ws_port=12345

Contributors

License

Hummingbird is licensed under the MIT License. (See LICENSE)