function _init(reducers, getRoutes, callback) { const store = getStore(reducers, browserHistory); const routes = getRoutes(store); const history = syncHistoryWithStore(browserHistory, store); ReactDOM.render( <Provider store={store}> <Router history={history}> {routes} </Router> </Provider> , document.getElementById('root')); // listen for location changes and use that as a trigger for page view tracking history.listen(location => { MetabaseAnalytics.trackPageView(location.pathname); }); registerAnalyticsClickListener(); store.dispatch(refreshSiteSettings()); // enable / disable GA based on opt-out of anonymous tracking MetabaseSettings.on("anon_tracking_enabled", () => { window['ga-disable-' + MetabaseSettings.get('ga_code')] = MetabaseSettings.isTrackingEnabled() ? null : true; }); if (callback) { callback(store); } }
.run(["AppState", function(AppState) { // initialize app state AppState.init(); // start our analytics click listener registerAnalyticsClickListener(); }])