Changed navigation analytic location
This commit is contained in:
parent
ca16c1d375
commit
c4cccac632
2 changed files with 4 additions and 8 deletions
|
@ -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 },
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue