Skip to content

Commit

Permalink
feat: Add provider type to the log in success (#135)
Browse files Browse the repository at this point in the history
* feat: Add provider type to the log in success

* fix: Add connection type to success
  • Loading branch information
LautaroPetaccio authored Feb 4, 2025
1 parent 1f75024 commit dc78e44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Pages/CallbackPage/CallbackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useAfterLoginRedirection } from '../../../hooks/redirection'
import { useTargetConfig } from '../../../hooks/targetConfig'
import usePageTracking from '../../../hooks/usePageTracking'
import { getAnalytics } from '../../../modules/analytics/segment'
import { TrackingEvents } from '../../../modules/analytics/types'
import { ConnectionType, TrackingEvents } from '../../../modules/analytics/types'
import { fetchProfile } from '../../../modules/profile'
import { isErrorWithMessage } from '../../../shared/errors'
import { locations } from '../../../shared/locations'
Expand Down Expand Up @@ -42,7 +42,7 @@ export const CallbackPage = () => {
const ethAddress = connectionData.account?.toLowerCase() ?? ''
getAnalytics().identify({ ethAddress })
// eslint-disable-next-line @typescript-eslint/naming-convention
getAnalytics().track(TrackingEvents.LOGIN_SUCCESS, { eth_address: ethAddress })
getAnalytics().track(TrackingEvents.LOGIN_SUCCESS, { eth_address: ethAddress, type: ConnectionType.WEB2 })
// Wait 800 ms for the tracking to be completed
await wait(800)

Expand Down
10 changes: 7 additions & 3 deletions src/components/Pages/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ export const LoginPage = () => {
const handleOnConnect = useCallback(
async (connectionType: ConnectionOptionType) => {
const isLoggingInThroughSocial = isSocialLogin(connectionType)
const providerType = isLoggingInThroughSocial ? ConnectionType.WEB2 : ConnectionType.WEB3
setCurrentConnectionType(connectionType)
getAnalytics().track(TrackingEvents.LOGIN_CLICK, {
method: connectionType,
type: isLoggingInThroughSocial ? ConnectionType.WEB2 : ConnectionType.WEB3
type: providerType
})
if (isLoggingInThroughSocial) {
setConnectionModalState(ConnectionModalState.LOADING_MAGIC)
Expand All @@ -119,8 +120,11 @@ export const LoginPage = () => {
setConnectionModalState(ConnectionModalState.WAITING_FOR_SIGNATURE)
await getIdentitySignature(connectionData.account?.toLowerCase() ?? '', connectionData.provider)

// eslint-disable-next-line @typescript-eslint/naming-convention
getAnalytics().track(TrackingEvents.LOGIN_SUCCESS, { eth_address: connectionData.account })
getAnalytics().track(TrackingEvents.LOGIN_SUCCESS, {
// eslint-disable-next-line @typescript-eslint/naming-convention
eth_address: connectionData.account,
type: providerType
})
getAnalytics().identify({ ethAddress: connectionData.account })
// Wait 800 ms for the tracking to be completed
await wait(800)
Expand Down

0 comments on commit dc78e44

Please sign in to comment.