Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment