# leek

> GA tracking

Latest version **0.0.24** (published 2016-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install leek
pnpm add leek
yarn add leek
bun add leek
```

## 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.0.24 |
| Published | 2016-10-31 |
| First published | 2014-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Alex Navasardyan |
| Maintainers | twokul |
| Keywords | stats, google, analytics, track, metrics |

## Links

- npm: https://www.npmjs.com/package/leek
- Repository: https://github.com/twokul/leek
- Homepage: https://github.com/twokul/leek#readme
- Issues: https://github.com/twokul/leek/issues
- npm.io page: https://npm.io/package/leek

## Dependencies (3)

- [rsvp](https://npm.io/package/rsvp.md) ^3.0.21
- [debug](https://npm.io/package/debug.md) ^2.1.0
- [lodash.assign](https://npm.io/package/lodash.assign.md) ^3.2.0

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.0.24 (latest) — 2016-10-31
- 0.0.23 — 2016-08-04
- 0.0.22 — 2016-07-14
- 0.0.21 — 2015-12-11
- 0.0.20 — 2015-12-10
- 0.0.19 — 2015-08-11
- 0.0.18 — 2015-03-09
- 0.0.17 — 2014-12-22
- 0.0.16 — 2014-11-09
- 0.0.15 — 2014-10-27
- 0.0.14 — 2014-10-27
- 0.0.13 — 2014-10-27
- 0.0.12 — 2014-08-27
- 0.0.11 — 2014-08-27
- 0.0.10 — 2014-08-27
- … 9 more at https://npm.io/package/leek/versions

## README

## Leek

[![Build Status](https://travis-ci.org/twokul/leek.svg)](https://travis-ci.org/twokul/leek)

Initial implementation was based on [Insight](https://github.com/yeoman/insight).

### Track Events:

```javascript
var Leek = require('./lib/leek'),
    leek = new Leek({
      trackingCode: 'xx-xxxxxxxx-x',
      globalName:   'my-nifty-package',
      version:      '1.0.1'
    });

leek.trackEvent({
  name:     'my-nifty-package',
  category: 'pony show',
  label:    'white',
  value:    'jumps'
});
```

### Track Errors:

```javascript
var Leek = require('./lib/leek'),
    leek = new Leek({
      trackingCode: 'xx-xxxxxxxx-x',
      name:         'my-nifty-package',
      version:      '1.0.1'
    });

try {
  throw new Error('ZOMG FIX ME')
} catch(e) {
  leek.trackError({
    description: e.message + ' ' + e.stack,
    isFatal: true
  });
}
```

### Track command hits:

```javascript
var Leek = require('./lib/leek'),
    leek = new Leek({
      trackingCode: 'xx-xxxxxxxx-x',
      name:         'my-nifty-package',
      version:      '1.0.1'
    });

leek.track({
  name:    'my-nifty-package show pony',
  message: 'pony is here'
});
```

### Disable Tracking:

#### Environment Variable

Setting the `DISABLE_LEEK` environment variable will disable tracking.

#### Alternative Tracking Endpoints

Passing in an object of adapter URLs will send the data to alternative tracking service.

```javascript
var Leek = require('./lib/leek');
var leek = new Leek({
  trackingCode: 'xx-xxxxxxxx-x',
  name:         'my-nifty-package',
  version:      '1.0.1',
  adapterUrls: {
    appview: 'http://example.com/collect-app',
    exception: 'http://example.com/collect-exception',
    timing: 'http://example.com/collect-timing',
    event: 'http://example.com/collect-event'
  }
});
```

#### Constructor Options

```javascript
var Leek = require('./lib/leek');
var leek = new Leek({
  trackingCode: 'xx-xxxxxxxx-x',
  name:         'my-nifty-package',
  version:      '1.0.1',
  silent:       true
});
```

### GA Setup
You are now able to set up alternative tracking services but to set up GA follow these steps:

* Set your new property up as a Mobile App
* Add the Tracking ID in your leek initialisation as seen above.
* To add the NodeJS as well as OS Version tracking go to the Admin -> Custom Definitions -> Custom Metrics
* Add a new Custom Dimenstion with the Name `OS` and Scope `Session`
* Add a second Custom Dimenstion with the Name `Node Version` and Scope `Session` as well
* Make sure they are both active and you have everything you need to get the tracking running properly

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