Guest User

Untitled

a guest
Nov 19th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import { client } from '../analytics';
  2.  
  3. const handleAction = (store, next, action, options) => {
  4. if (!action.meta || !action.meta.analytics) {
  5. return next(action);
  6. }
  7.  
  8. const { eventType, eventPayload } = action.meta.analytics;
  9.  
  10. client(options).track(eventType, eventPayload);
  11.  
  12. return next(action);
  13. };
  14.  
  15. export function createAnalytics(options = {}) {
  16. return store => next => action => handleAction(store, next, action, options);
  17. }
Add Comment
Please, Sign In to add comment