# last-click

> Saves the last external website a user clicked before arriving on your website

Latest version **0.1.2** (published 2018-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install last-click
pnpm add last-click
yarn add last-click
bun add last-click
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2018-04-03 |
| First published | 2018-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 38.8 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joachim Loevgaard |
| Maintainers | loevgaard |
| Keywords | last, click |

## Links

- npm: https://www.npmjs.com/package/last-click
- Repository: https://github.com/loevgaard/last-click
- Homepage: https://github.com/loevgaard/last-click#readme
- Issues: https://github.com/loevgaard/last-click/issues
- npm.io page: https://npm.io/package/last-click

## Dependencies (3)

- [cookie](https://npm.io/package/cookie.md) ^0.3.1
- [query-string](https://npm.io/package/query-string.md) ^6.0.0
- [merge-objects](https://npm.io/package/merge-objects.md) ^1.0.5

## Recent versions

- 0.1.2 (latest) — 2018-04-03
- 0.1.1 — 2018-03-27
- 0.1.0 — 2018-03-27

## README

# Last Click - Save the last external website your visitors clicked
[![Software License][ico-license]](LICENSE)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Quality Score][ico-code-quality]][link-code-quality]

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
```bash
$ npm install last-click
```

## Usage
```javascript
// 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
```bash
$ npm test
```

[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/loevgaard/last-click/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/loevgaard/last-click.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/loevgaard/last-click.svg?style=flat-square

[link-travis]: https://travis-ci.org/loevgaard/last-click
[link-scrutinizer]: https://scrutinizer-ci.com/g/loevgaard/last-click/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/loevgaard/last-click

---
_Source: https://npm.io/package/last-click · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
