5.7.0 • Published 3 years ago
@asayerio/tracker-redux v5.7.0
Asayer Tracker Redux plugin
A Redux middleware for Asayer Tracker. This middleware allows you to see the application state during session replay.
Installation
npm i @asayerio/tracker-redux --save
Usage
Initialize the @asayerio/tracker
package as usual and load the plugin into it.
Then put the generated middleware into your Redux chain.
import { applyMiddleware, createStore } from 'redux';
import Tracker from '@asayerio/tracker';
import trackerRedux from '@asayerio/tracker-redux';
const tracker = new Tracker({
projectID: PROJECT_ID,
});
const asayerMiddleware = tracker.use(trackerRedux());
const store = createStore(
reducer,
applyMiddleware(asayerMiddleware),
);
You can customize the middleware behaviour with options to sanitize your data.
trackerRedux({
actionFilter: action => action.type !== 'DRAW', // only actions which pass this test will be recorded
actionTransformer: action => action.type === 'LOGIN' ? null : action,
actionType: action => action.type // action type for search, that's the default one
stateTransformer: state => {
const { jwt, ..._state } = state;
return _state;
},
})