0.1.2 • Published 6 years ago
last-click v0.1.2
Last Click - Save the last external website your visitors clicked
The name 'last click' comes from marketing terms where the last click refers to the last external website a user clicked before arriving on your website.
That external website is what we try to figure out and save in this library.
Installation
$ npm install last-click
Usage
// these are the default settings used in the library
// you can add more sources if you want
const defaultSettings = {
sources: [
{referrer: 'google'},
{referrer: 'yahoo'},
{referrer: 'bing'},
{queryParameter: 'gclid', 'value': 'adwords'},
{queryParameter: 'utm_source'}
],
cookie: {
name: 'last_click',
expires: 30 * 24 * 60 * 60 // 30 days in seconds
}
};
const lastClick = require('last-click')(defaultSettings);
console.log(lastClick.getLastClick());
Test
$ npm test