Skip to content

Commit

Permalink
chore: add event label to google login button (#2786)
Browse files Browse the repository at this point in the history
* chore: add event label to google login button

* fix: additional requested analytics changes
  • Loading branch information
schmanu authored Nov 9, 2023
1 parent 06f78a1 commit 33e9826
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/common/SocialSigner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export const SocialSigner = ({
const userInfo = socialWalletService?.getUserInfo()
const isDisabled = loginPending || !isMPCLoginEnabled

const isWelcomePage = !!onLogin

const recoverPassword = useCallback(
async (password: string, storeDeviceFactor: boolean) => {
if (!socialWalletService) return
Expand Down Expand Up @@ -143,7 +145,7 @@ export const SocialSigner = ({
</Button>
</Track>
) : (
<Track {...MPC_WALLET_EVENTS.CONNECT_GOOGLE}>
<Track {...MPC_WALLET_EVENTS.CONNECT_GOOGLE} label={isWelcomePage ? 'welcomePage' : 'navBar'}>
<Button
variant="outlined"
onClick={login}
Expand Down
7 changes: 6 additions & 1 deletion src/services/analytics/events/mpcWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ export const MPC_WALLET_EVENTS = {
},
MANUAL_RECOVERY: {
event: EventType.META,
action: 'Account recovery started',
action: 'MFA login started',
category: MPC_WALLET_CATEGORY,
},
RECOVER_PASSWORD: {
event: EventType.CLICK,
action: 'Recover account using password',
category: MPC_WALLET_CATEGORY,
},
RECOVERED_SOCIAL_SIGNER: {
event: EventType.META,
action: 'Recovered social signer',
category: MPC_WALLET_CATEGORY,
},
UPSERT_PASSWORD: {
event: EventType.CLICK,
action: 'Set or change password',
Expand Down
6 changes: 5 additions & 1 deletion src/services/mpc/SocialWalletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SocialWalletService implements ISocialWalletService {
}

if (!this.isMFAEnabled()) {
trackEvent(MPC_WALLET_EVENTS.ENABLE_MFA)
trackEvent({ ...MPC_WALLET_EVENTS.ENABLE_MFA, label: 'password' })
// 2. enable MFA in mpcCoreKit
await this.mpcCoreKit.enableMFA({}, false)
}
Expand Down Expand Up @@ -128,6 +128,10 @@ class SocialWalletService implements ISocialWalletService {
await this.finalizeLogin()
}

if (this.mpcCoreKit.status === COREKIT_STATUS.LOGGED_IN) {
trackEvent({ ...MPC_WALLET_EVENTS.RECOVERED_SOCIAL_SIGNER, label: 'password' })
}

return this.mpcCoreKit.status === COREKIT_STATUS.LOGGED_IN
}

Expand Down

0 comments on commit 33e9826

Please sign in to comment.