Last active
February 27, 2018 14:47
-
-
Save mwq27/a17c77ae2a889ed0f64ae8ceed05a303 to your computer and use it in GitHub Desktop.
Revisions
-
mwq27 revised this gist
Feb 27, 2018 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ const trackingMiddleware = (store: Store<any>) => (next: Dispatch<any>) => (action: Action) => { if (action.type === '@@router/LOCATION_CHANGE') { const nextPage = `${action.payload.pathname}${action.payload.search}`; trackPage(nextPage, store.getState()); } return next(action); }; function trackPage(page: string, state: any) { ReactGA.set({ page, ...options, }); ReactGA.pageview(page); }; -
mwq27 created this gist
Feb 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ const trackPage = function(page: string, state: any) { ReactGA.set({ page, ...options, }); ReactGA.pageview(page); }; const trackingMiddleware = (store: Store<any>) => (next: Dispatch<any>) => (action: Action) => { if (action.type === '@@router/LOCATION_CHANGE') { const nextPage = `${action.payload.pathname}${action.payload.search}`; trackPage(nextPage, store.getState()); } return next(action); };