# redux-appinsights

> Application Insights middleware for Redux

Latest version **1.0.3** (published 2016-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-appinsights
pnpm add redux-appinsights
yarn add redux-appinsights
bun add redux-appinsights
```

## 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.3 |
| Published | 2016-06-17 |
| First published | 2016-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | William Buchwalter |
| Maintainers | wbuchwalter |
| Keywords | redux, application, insights |

## Links

- npm: https://www.npmjs.com/package/redux-appinsights
- Repository: https://github.com/wbuchwalter/redux-appinsights
- Homepage: https://github.com/wbuchwalter/redux-appinsights#readme
- Issues: https://github.com/wbuchwalter/redux-appinsights/issues
- npm.io page: https://npm.io/package/redux-appinsights

## Dependencies (2)

- [lodash.assign](https://npm.io/package/lodash.assign.md) ^4.0.9
- [lodash.foreach](https://npm.io/package/lodash.foreach.md) ^4.3.0

## Recent versions

- 1.0.3 (latest) — 2016-06-17
- 1.0.2 — 2016-06-17
- 1.0.1 — 2016-06-16
- 1.0.0 — 2016-06-16

## README

[Redux](https://github.com/reactjs/redux) middleware for Application Insights on Azure

### Installation
**Prerequisite:** You need to have Application Insights correctly configured in your application.

`npm i redux-appinsights`

Then simply apply the middleware to your store:

``` JavaScript
import { insightsMonitor } from 'redux-appinsights' 

const store = createStore(rootReducer,  applyMiddleware(
  insightsMonitor() //or insightsMonitor(params), see Configuration
));
```


### Usage

You need to opt-in the actions you want to log. To do so, simply append your action like so:

``` JavaScript
{
  type: 'ADD_TODO',
  payload: 'Hello World!',
  meta: {
    appInsights: { trackPayload: true}
  }
}
```

If you only want to track an action, but don't need it's payload, set `trackPayload: false`.
If you omit to set `trackPayload` it will be set to `true` by default.

Your actions will now show up in Application Insights:  
  
![Application Insights](https://raw.githubusercontent.com/wbuchwalter/redux-appinsights/master/insights.png)

### Configuration
You can pass a configuration object to the middleware:

``` JavaScript
const params = {
  globals: {
    env: 'dev'
  },
  exclude: ['meta']
};

const store = createStore(rootReducer,  applyMiddleware(
  insightsMonitor(params)
));

```

#### Globals  

These are properties that you want to be added on every action that you track, for example, the environment on which the action occured.

#### Exclude

Your actions might contains things that you don't want to track, such as `meta`. Simply add them to the `exclude` array in the configuration object (this only applies to top-level member of your actions).

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