# redux-appinsights-middleware

Latest version **2.0.0** (published 2019-02-28) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-02-28 |
| First published | 2018-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | rand0me |
| Maintainers | zer0latency |

## Links

- npm: https://www.npmjs.com/package/redux-appinsights-middleware
- Repository: https://github.com/rand0me/redux-appinsights-middleware
- Homepage: https://rand0me.github.io/redux-appinsights-middleware
- Issues: https://github.com/rand0me/redux-appinsights-middleware/issues
- npm.io page: https://npm.io/package/redux-appinsights-middleware

## Recent versions

- 2.0.0 (latest) — 2019-02-28
- 1.0.1 — 2018-09-20
- 1.0.0 — 2018-07-06

## README

# Redux AppInsights Middleware ([Docs](https://rand0me.github.io/redux-appinsights-middleware/))


[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Greenkeeper badge](https://badges.greenkeeper.io/rand0me/redux-appinsights-middleware.svg)](https://greenkeeper.io/)
[![Travis](https://img.shields.io/travis/rand0me/redux-appinsights-middleware.svg)](https://travis-ci.org/rand0me/redux-appinsights-middleware)
[![Coveralls](https://img.shields.io/coveralls/rand0me/redux-appinsights-middleware.svg)](https://coveralls.io/github/rand0me/redux-appinsights-middleware)

This middleware provides a more robust AppInsights API for Redux-based applications.

## Installation
At first, install the package:

```
$ npm install redux-appinsights-middleware
```

## Usage

Then use a middleware and reducer in your redux store:
```typescript
import { applyMiddleware, combineReducers, compose, createStore } from "redux";
import { setup, createAppInsightsMiddleware, createAppInsightsReducer } from "redux-appinsights-middleware";
import { AppInsights } from "applicationinsights-js";

import * as reducers from "./reducers/";

const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

export const store = createStore<IState>(
    combineReducers<IState>({ ...reducers, appinsights: createAppInsightsReducer() }),
    composeEnhancers(applyMiddleware(createAppInsightsMiddleware(AppInsights) )),
);

// Now you can track events like this:
store.dispatch({
    type: "app/MY_ACTION",
    payload: { ... },
    appinsights: {
        method: "trackPageView",
        data: [ "Page Title", "http://page.url" ],
    }
});

// If you aren't dispatch this action, nothing will be sent to AppInsights
store.dispatch(setup(AI_KEY));
```

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