Skip to content

Commit

Permalink
Merge pull request #1247 from Vizzuality/hotfix/analytics-events
Browse files Browse the repository at this point in the history
adds some events and fixes others
  • Loading branch information
sorodrigo authored Jan 22, 2020
2 parents ee4b4b0 + 9d58466 commit aaae9b5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/scripts/analytics/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const GA_EVENT_WHITELIST = [
...GA_EXPLORE_EVENTS,
...GA_PROFILE_NODE_EVENTS,
...GA_DASHBOARD_ELEMENT_EVENTS
].reduce((acc, next) => ({ ...acc, [next.type]: next }));
].reduce((acc, next) => ({ ...acc, [next.type]: next }), {});
const TRACK_WITH_QUERY = ['profileNode'];

function createGAEvent(event, action, state) {
Expand Down
21 changes: 21 additions & 0 deletions frontend/scripts/analytics/nodes-panel.events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
NODES_PANEL__SET_ORDER_BY,
NODES_PANEL__SET_EXCLUDING_MODE
} from 'react-components/nodes-panel/nodes-panel.actions';

export default [
{
type: NODES_PANEL__SET_EXCLUDING_MODE,
category: 'Nodes Panel',
action: 'Set excluding mode (select all)'
},
{
type: NODES_PANEL__SET_ORDER_BY,
category: 'Nodes Panel',
action: 'Set order by',
getPayload(action) {
const { orderBy } = action.payload;
return orderBy;
}
}
];
5 changes: 3 additions & 2 deletions frontend/scripts/analytics/tool.events.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default [
category: 'Sankey',
action: 'Switch context',
getPayload: (action, state) => {
const actionContext = state.app.contexts.find(context => context.id === action.payload.id);
const actionContext = state.app.contexts.find(context => context.id === action.payload);
return `${actionContext.countryName} ${actionContext.commodityName}`;
}
},
Expand Down Expand Up @@ -98,7 +98,8 @@ export default [
{
type: SELECT_BASEMAP,
action: 'Select basemap',
category: 'Sankey'
category: 'Sankey',
getPayload: action => action.payload.selectedBasemap
},
{
type: TOGGLE_MAP_LAYERS_MENU,
Expand Down

0 comments on commit aaae9b5

Please sign in to comment.