diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index baca2a72f..44bd2c32f 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -130,6 +130,7 @@ function App(props: Props) { const rawReferrerParam = urlParams.get('r'); const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#'); const shouldHideNag = pathname.startsWith(`/$/${PAGES.EMBED}`) || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`); + const userId = user && user.id; let uri; try { @@ -142,6 +143,11 @@ function App(props: Props) { setShowAnalyticsNag(false); } // @endif + useEffect(() => { + if (userId) { + analytics.setUser(userId); + } + }, [userId]); useEffect(() => { if (!uploadCount) return; diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index 3b5fb29dd..e4d58d21b 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -529,11 +529,8 @@ export function doSignIn() { return (dispatch, getState) => { const state = getState(); const user = selectUser(state); - const userId = user.id; const notificationsEnabled = user.experimental_ui; - analytics.setUser(userId); - if (notificationsEnabled) { dispatch(doSocketConnect()); dispatch(doNotificationList());