# @lunrdigital/react-tracker

> Component level tracking using context

Latest version **1.0.1** (published 2019-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lunrdigital/react-tracker
pnpm add @lunrdigital/react-tracker
yarn add @lunrdigital/react-tracker
bun add @lunrdigital/react-tracker
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-09-02 |
| First published | 2019-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lunr Digital |
| Maintainers | alexmeah |
| Keywords | tracking, react, hooks |

## Links

- npm: https://www.npmjs.com/package/@lunrdigital/react-tracker
- Repository: https://github.com/lunr-digital/react-tracker
- Homepage: https://github.com/lunr-digital/react-tracker#readme
- Issues: https://github.com/lunr-digital/react-tracker/issues
- npm.io page: https://npm.io/package/@lunrdigital/react-tracker

## Dependencies (3)

- [react-ga](https://npm.io/package/react-ga.md) ^2.6.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [react-display-name](https://npm.io/package/react-display-name.md) ^0.2.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-09-02
- 1.0.0 — 2019-09-02

## README

# react-tracker
Component level tracking using context

## Examples

```jsx
import {withTracker, useTracker} from '@lunrdigital/react-tracker';

const Component = () => {
    const { track } = useTracker();

    return (
        <button onClick={() => track('Button click')}>Track</button>
    );
};

const TrackedComponent = withTracker(Component, 'Default Category');

<TrackedComponent />

<TrackedComponent tracking-category="Overidden Category" />
```

```jsx
import {withTracker, useTracker} from '@lunrdigital/react-tracker';

const Nested = () => {
    const { track } = useTracker();

    return (
        <button onClick={() => track('Nested button click')}>Track</button>
    );
};

const Component = () => {
    const { track } = useTracker();

    return (
        <button onClick={() => track('Button click')}>Track</button>
    );
};

const TrackedComponent = withTracker(Component, 'Default Category');

<TrackedComponent />

<TrackedComponent tracking-category="Overidden Category" />
```

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