From c4cccac632b93e343c547939b6e04dee0d62dd9b Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 11 Dec 2017 22:18:25 -0800 Subject: [PATCH] Changed navigation analytic location --- src/renderer/redux/actions/navigation.js | 3 +++ src/renderer/redux/reducers/navigation.js | 9 +-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/renderer/redux/actions/navigation.js b/src/renderer/redux/actions/navigation.js index b718936aa..a4cbca615 100644 --- a/src/renderer/redux/actions/navigation.js +++ b/src/renderer/redux/actions/navigation.js @@ -9,6 +9,7 @@ import { } from "redux/selectors/navigation"; import { doSearch } from "redux/actions/search"; import { toQueryString } from "util/query_params"; +import amplitude from "amplitude-js"; export function doNavigate(path, params = {}, options = {}) { return function(dispatch, getState) { @@ -23,6 +24,8 @@ export function doNavigate(path, params = {}, options = {}) { const scrollY = options.scrollY; + amplitude.getInstance().logEvent("NAVIGATION", { destination: url }); + dispatch({ type: types.HISTORY_NAVIGATE, data: { url, index: options.index, scrollY }, diff --git a/src/renderer/redux/reducers/navigation.js b/src/renderer/redux/reducers/navigation.js index e32658b76..2a4fbabdd 100644 --- a/src/renderer/redux/reducers/navigation.js +++ b/src/renderer/redux/reducers/navigation.js @@ -1,6 +1,5 @@ import * as types from "constants/action_types"; import { parseQueryParams } from "util/query_params"; -import amplitude from "amplitude-js"; const currentPath = () => { const hash = document.location.hash; @@ -71,13 +70,7 @@ reducers[types.WINDOW_SCROLLED] = (state, action) => { export default function reducer(state = defaultState, action) { const handler = reducers[action.type]; if (handler) { - let nextState = handler(state, action); - if (nextState.currentPath !== state.currentPath) { - amplitude - .getInstance() - .logEvent("NAVIGATION", { destination: nextState.currentPath }); - } - return nextState; + return handler(state, action); } return state; }