这是我们为redux-beacon定义事件映射的方式(根据the documentation)。
// Define an event
const pageView = (action: Action): PageView => ({
hitType: 'pageview',
page: action.payload.path,
});
// Map the event to an ngrx/store action
const eventsMap = {
'[Router] Update Location': pageView,
};
// Create the meta Reducer
const analyticsMetaReducer = createMetaReducer(eventsMap, GoogleAnalytics);
我们创建一个meta reducer并传入商店
StoreModule.provideStore({
// Wrap the router reducer in the meta reducer
router: analyticsMetaReducer(routerReducer),
})
是否可以在运行时替换原始事件映射?