[APP-511] metrics overhaul: frontend work (#506)

* WIP

* fix types and update imports

* wip

* tagged events that should be server side

* remove server-side analytics

* remove useless import

* add additional profile header events

* remove useless import

* track follow/unfollow clicks

* add missing types
This commit is contained in:
Ansh 2023-06-15 14:45:14 -07:00 committed by GitHub
parent 1695ae34db
commit 17e7590bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 156 additions and 41 deletions

View file

@ -29,7 +29,7 @@ import {UserAvatar} from '../util/UserAvatar'
import {UserBanner} from '../util/UserBanner'
import {ProfileHeaderWarnings} from '../util/moderation/ProfileHeaderWarnings'
import {usePalette} from 'lib/hooks/usePalette'
import {useAnalytics} from 'lib/analytics'
import {useAnalytics} from 'lib/analytics/analytics'
import {NavigationProp} from 'lib/routes/types'
import {listUriToHref} from 'lib/strings/url-helpers'
import {isDesktopWeb, isNative} from 'platform/detection'
@ -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')