1.0.7 • Published 8 years ago

link-tracker v1.0.7

Weekly downloads
8
License
ISC
Repository
-
Last release
8 years ago

link-tracker

A simple library for tracking link clicks.

Installation

npm install link-tracker

Usage

Link-tracker creates encoded links with a timestamp.

var linkTracker = require('link-tracker');

var trackedLink = linkTracker.encodeUrl('http://www.github.com');
var trackedLinkWithParams = linkTracker.encodeUrl('http://www.github.com', 'param1=value1&param2=value2');

Link-tracker will then validate these links when clicked and respond with 302 redirect, a 400 if the link has been modified or 410 if the link has expired.

var linkTracker = require('link-tracker');
router.get('/url/*', function(req, res) {
	linkTracker.url(req, res);
});

The error handler may also be customized with an error handler

var linkTracker = require('link-tracker');
router.get('/url/*', function(req, res) {
	linkTracker.url(req, res, function(statusCode, originalLink) {
      // handle the error here
    });
});
1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago