track follow/unfollow clicks

This commit is contained in:
Ansh Nanda
2023-06-15 13:42:12 -07:00
parent 67ab018340
commit 26728f7d6a
2 changed files with 8 additions and 1 deletions
+2
View File
@@ -46,6 +46,8 @@ interface TrackPropertiesMap {
'ProfileHeader:AddToListsButtonClicked': {}
'ProfileHeader:BlockAccountButtonClicked': {}
'ProfileHeader:UnblockAccountButtonClicked': {}
'ProfileHeader:FollowButtonClicked': {}
'ProfileHeader:UnfollowButtonClicked': {}
'ViewHeader:MenuButtonClicked': {}
// SETTINGS events
'Settings:SwitchAccountButtonClicked': {}
+6 -1
View File
@@ -117,6 +117,11 @@ const ProfileHeaderLoaded = observer(
}, [store, view])
const onPressToggleFollow = React.useCallback(() => {
track(
view.viewer.following
? 'ProfileHeader:FollowButtonClicked'
: 'ProfileHeader:UnfollowButtonClicked',
)
view?.toggleFollowing().then(
() => {
Toast.show(
@@ -127,7 +132,7 @@ const ProfileHeaderLoaded = observer(
},
err => store.log.error('Failed to toggle follow', err),
)
}, [view, store])
}, [track, view, store.log])
const onPressEditProfile = React.useCallback(() => {
track('ProfileHeader:EditProfileButtonClicked')