Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

pixel-ping

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixel-ping

A minimalist pixel tracker.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
8
166.67%
Maintainers
0
Weekly downloads
 
Created
Source

=

| _ () | | | _ () _ __ _ | / \ \ / -) | | / | ' / ` | || |/___|| || ||||_, | |/

o . _______ _______ _ 0 ////| @o /_, /_//__/ /
| \ | || | / |

Pixel Ping is a minimalist pixel tracker, written in CoffeeScript for Node.js. It's useful when you want to keep track of page hits, but don't want to inject something heavy like Google Analytics. It has no dependencies other than Node.

To use Pixel Ping, you insert an image tag that records the hit, along with a unique key that is used to distinguish the hits. For example:

The key can be any string -- a document id, the url of the page, etc. You'll probably use a snippet of inline JavaScript to generate the key based on the URL of the page, and other relevant information. For an example of some JavaScript that generates the key, see the "with-tracking-js" branch.

Pixel ping will store all of the keys and hits in memory, and periodically flush them to your application by making an HTTP request. You should make an endpoint on your application that can save results from JSON like this:

{ "/pages/about.html": 276, "/articles/policy.html": 324 }

The key being the key you passed to the image tag, and the value being the number of hits since the previous flush.

To configure Pixel Ping, add a "config.json" file in its directory, or supply a path to the configuration file when starting it up. An example of the configuration looks like this:

{ "host": "127.0.0.1", "port": "9187", "interval": 600, "endpoint": "http://www.example.com/internal/save_hits" }

Running "node lib/pixel-ping.js path/to/config.json" will start up the pixel server on 127.0.0.1:9187, and every ten minutes (600 seconds), it will flush the hits to the provided endpoint.

Keywords

javascript

FAQs

Package last updated on 10 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts