Feature/social login analytics - #6822
Conversation
theck13
left a comment
There was a problem hiding this comment.
Adding analytics was a lot more complicated than I expected. I left a few questions and suggestions. Everything else looks good!
| @Override | ||
| public void loggedInViaSocialAccount(ArrayList<Integer> oldSitesIds) { | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_GOOGLE_SUCCEEDED); | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_SUCCESS); |
There was a problem hiding this comment.
Having both LOGIN_GOOGLE_SUCCEEDED and LOGIN_SOCIAL_SUCCESS seems unnecessary if Google is the only social login. Should we remove LOGIN_GOOGLE_SUCCEEDED until other social login types are added since both of these stats are triggered at the same time and LOGIN_SOCIAL_SUCCESS corresponds to Calypso?
There was a problem hiding this comment.
Yeah, I waffled a bit on removing it, but I agree. I'll remove it.
| AnalyticsUtils.trackAnalyticsSignIn(mAccountStore, mSiteStore, true); | ||
|
|
||
| if (isSocialLogin) { | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_SUCCESS); |
There was a problem hiding this comment.
The LOGIN_SOCIAL_SUCCESS stat is being tracked in LoginActivity.loggedInViaSocialAccount, which is being called just below this line. That will cause double-counting LOGIN_SOCIAL_SUCCESS. I think we can remove this line.
| AnalyticsUtils.trackAnalyticsSignIn(mAccountStore, mSiteStore, true); | ||
|
|
||
| if (isSocialLogin) { | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_SUCCESS); |
There was a problem hiding this comment.
This LOGIN_SOCIAL_SUCCESS stat is being double-counted here too since LoginActivity.loggedInViaSocialAccount is called just below. I think we can remove this line.
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_TWO_FACTOR_FORM_VIEWED); | ||
| if (mService != null) { | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_2FA_NEEDED); | ||
| } |
There was a problem hiding this comment.
Is the LOGIN_SOCIAL_2FA_NEEDED stat meant to be tracked when the two-factor authentication screen is shown during a social login? If so, the LoginActivity.needs2faSocial and LoginActivity.needs2faSocialConnect methods would be better locations for that. Those methods are called when the Login2FaFragment is shown from LoginGoogleFragment or LoginEmailPasswordFragment (i.e. the only places two-factor authentication can be shown from social login).
There was a problem hiding this comment.
Ah! Def a much better location. Will do!
| @Override | ||
| public void onClick(View view) { | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); | ||
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_GOOGLE_TAPPED); |
There was a problem hiding this comment.
This seems like another redundant stat. Should we remove LOGIN_GOOGLE_TAPPED in favor of LOGIN_SOCIAL_BUTTON_CLICK?
There was a problem hiding this comment.
Yeah. I'll remove this one too.
| AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_FAILED, event.getClass().getSimpleName(), | ||
| event.error.type.toString(), event.error.message); | ||
|
|
||
| if (event.error.type != AccountStore.AccountSocialErrorType.USER_EXISTS) { |
There was a problem hiding this comment.
The import org.wordpress.android.fluxc.store.AccountStore; statement needs to be added to be able to build with this conditional.
There was a problem hiding this comment.
How this could have been omitted baffles me. Adding back.
|
Thanks @theck13 !! Changes made. Ready for another peek. |
|
It looks like some references to |
Ugh... The embarassment is real.

Refs #6505
Adds social login analytics. These are the same as Calypso except for the following:
To test:
Test social login.
Ensure that each analytic is being bumped correctly.
(Companion iOS version wordpress-mobile/WordPress-iOS#8028)