Send page event when new route is rendered.
This commit is contained in:
@@ -37,7 +37,6 @@ function logEvent(eventType, eventData) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function identifyUser() {
|
||||
const authState = apiClient.getAuthenticationState();
|
||||
if (authState.authentication && authState.authentication.userId) {
|
||||
@@ -46,5 +45,9 @@ function identifyUser() {
|
||||
}
|
||||
}
|
||||
|
||||
function sendPageEvent() {
|
||||
identifyUser();
|
||||
window.analytics.page();
|
||||
}
|
||||
|
||||
export { handleTrackEvents, identifyUser, logEvent };
|
||||
export { handleTrackEvents, identifyUser, logEvent, sendPageEvent };
|
||||
|
||||
@@ -85,11 +85,4 @@ import { configuration } from '../config/environment';
|
||||
// load the tools you've enabled for your account. Boosh!
|
||||
analytics.load(configuration.SEGMENT_KEY);
|
||||
|
||||
// TODO: Move this page call when we have multiple pages.
|
||||
// - during routing.
|
||||
// Make the first page call to load the integrations. If
|
||||
// you'd like to manually name or tag the page, edit or
|
||||
// move this call however you'd like.
|
||||
analytics.page();
|
||||
|
||||
})();
|
||||
|
||||
@@ -5,7 +5,7 @@ import ReactDOM from 'react-dom';
|
||||
|
||||
import configureStore from './config/configureStore';
|
||||
import apiClient from './config/apiClient';
|
||||
import { identifyUser } from './analytics/analytics';
|
||||
import { sendPageEvent } from './analytics/analytics';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
@@ -16,7 +16,5 @@ if (apiClient.ensurePublicOrAuthencationAndCookies(window.location.pathname)) {
|
||||
|
||||
ReactDOM.render(<App store={store} history={history} />, document.getElementById('root'));
|
||||
|
||||
// identify user for future analytics calls
|
||||
// TODO: Call before each page call.
|
||||
identifyUser();
|
||||
sendPageEvent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user