only set matomo userid if hasverifiedemail

This commit is contained in:
jessop 2020-07-09 14:22:39 -04:00
parent 86484eb13f
commit 1881627a89
2 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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
};
}