Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { client } from '../analytics';
- const handleAction = (store, next, action, options) => {
- if (!action.meta || !action.meta.analytics) {
- return next(action);
- }
- const { eventType, eventPayload } = action.meta.analytics;
- client(options).track(eventType, eventPayload);
- return next(action);
- };
- export function createAnalytics(options = {}) {
- return store => next => action => handleAction(store, next, action, options);
- }
Add Comment
Please, Sign In to add comment