Registry / observability / redux-mixpanel-middleware

redux-mixpanel-middleware

JSON →
library1.0.1jsnpmunverified

A Redux middleware that sends Mixpanel events from dispatched actions. Version 1.0.1 integrates with mixpanel-browser client library and intercepts actions with a `meta.mixpanel` property to track events and properties. No active maintenance, few downloads, and limited flexibility compared to more modern analytics middlewares like redux-beacon.

npm install redux-mixpanel-middleware
INSTALL
IMPORT
SIG · REDUX-MIXPANEL-MID
R
redux-mixpanel-middleware
observabilityjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MixpanelMiddleware
import MixpanelMiddleware from 'redux-mixpanel-middleware';
const MixpanelMiddleware = require('redux-mixpanel-middleware');
Default export; CJS require works but type definitions may be missing.

Initialize Mixpanel browser client, create middleware instance, apply to Redux store, and dispatch action with mixpanel meta to track event.

import mixpanel from 'mixpanel-browser'; import MixpanelMiddleware from 'redux-mixpanel-middleware'; import { createStore, applyMiddleware } from 'redux'; const MIXPANEL_TOKEN = process.env.MIXPANEL_TOKEN ?? 'your-token'; mixpanel.init(MIXPANEL_TOKEN); const mixpanelMiddleware = new MixpanelMiddleware(mixpanel); const reducer = (state = {}, action) => state; const store = createStore(reducer, applyMiddleware(mixpanelMiddleware)); store.dispatch({ type: 'ADD_TO_CART', payload: { id: 1, name: 'Widget' }, meta: { mixpanel: { event: 'Add to cart', props: { id: 1, name: 'Widget', price: 10 } } } });
Debug
Known issues
gotchaMiddleware requires `meta.mixpanel` object; without it no event is sent and no error is thrown.
fix
Ensure every action you want tracked includes `meta: { mixpanel: { event: 'EventName', props: {} } }`.
affects: >=1.0.0
gotchaUses `mixpanel-browser` which may not work in server-side Node.js environments without proper polyfills.
fix
Only use in browser or configure a mock mixpanel client for SSR.
affects: >=1.0.0
deprecatedLibrary is no longer actively maintained; consider migrating to redux-beacon or custom middleware for more flexibility.
fix
Replace with redux-beacon or write a custom Redux middleware using mixpanel's track method directly.
affects: >=1.0.0
Errors
Common errors & fixes
Uncaught TypeError: mixpanel.init is not a function
Missing or incorrect import of mixpanel-browser library.
fix
Ensure mixpanel-browser is installed and imported: import mixpanel from 'mixpanel-browser';
Actions must be plain objects. Use custom middleware for async actions.
Using middleware with async actions that return functions (e.g., redux-thunk) before this middleware in the chain.
fix
Apply async middleware (e.g., redux-thunk) before MixpanelMiddleware in applyMiddleware.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
reduxoptionalPeer dependency for Redux store integration
mixpanel-browserrequiredRequired mixpanel client to initialize and send events
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
redux-mixpanel-middleware — npm install redux-mixpanel-middleware · libregistry