From 1881627a89a578aaa26075f554bb8ed0e57e9bc6 Mon Sep 17 00:00:00 2001 From: jessop Date: Thu, 9 Jul 2020 14:22:39 -0400 Subject: [PATCH] only set matomo userid if hasverifiedemail --- ui/component/app/view.jsx | 8 -------- ui/redux/actions/app.js | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index d63301720..f61bded1e 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -104,10 +104,8 @@ function App(props: Props) { const appRef = useRef(); const isEnhancedLayout = useKonamiListener(); const [hasSignedIn, setHasSignedIn] = useState(false); - const userId = user && user.id; const hasVerifiedEmail = user && user.has_verified_email; const isRewardApproved = user && user.is_reward_approved; - const previousUserId = usePrevious(userId); const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail); const previousRewardApproved = usePrevious(isRewardApproved); // @if TARGET='web' @@ -207,12 +205,6 @@ function App(props: Props) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [language, languages]); - useEffect(() => { - if (previousUserId === undefined && userId) { - analytics.setUser(userId); - } - }, [previousUserId, userId]); - useEffect(() => { // Check that previousHasVerifiedEmail was not undefined instead of just not truthy // This ensures we don't fire the emailVerified event on the initial user fetch diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index 39fef1b19..9c7eb6914 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -42,6 +42,7 @@ import { selectModal, selectAllowAnalytics, } from 'redux/selectors/app'; +import { selectUser } from 'redux/selectors/user'; // import { selectDaemonSettings } from 'redux/selectors/settings'; import { doGetSync } from 'lbryinc'; import { doClaimRewardType } from 'redux/actions/rewards'; @@ -504,9 +505,16 @@ export function doAnaltyicsPurchaseEvent(fileInfo) { export function doSignIn() { return (dispatch, getState) => { + const state = getState(); + const user = selectUser(state); + const userId = user.id; + + analytics.setUser(userId); + // @if TARGET='web' dispatch(doBalanceSubscribe()); dispatch(doFetchChannelListMine()); + // @endif }; }