diff --git a/src/analytics/analytics.js b/src/analytics/analytics.js index 7e1b874..be5cfe3 100755 --- a/src/analytics/analytics.js +++ b/src/analytics/analytics.js @@ -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 }; diff --git a/src/analytics/segment.js b/src/analytics/segment.js index fd42f02..73d6509 100644 --- a/src/analytics/segment.js +++ b/src/analytics/segment.js @@ -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(); - })(); diff --git a/src/index.jsx b/src/index.jsx index 93e192f..d5c6174 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -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(, document.getElementById('root')); - // identify user for future analytics calls - // TODO: Call before each page call. - identifyUser(); + sendPageEvent(); }