Skip to content

Commit 54522d5

Browse files
committed
feat: add user delete tracking to analytics and update DeleteAccount component
1 parent 0683466 commit 54522d5

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/features/settings/components/UserSettings/DeleteAccount.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import toast from 'react-simple-toasts'
33
import { Button, ConfirmModal } from 'src/components/Elements'
44
import { useAuth } from 'src/features/auth'
55
import { useDeleteAccount } from 'src/features/auth/api/deleteAccount'
6+
import { trackUserDelete } from 'src/lib/analytics'
67

78
export const DeleteAccount = () => {
89
const deleteAccountMutation = useDeleteAccount()
@@ -20,6 +21,7 @@ export const DeleteAccount = () => {
2021
})
2122
.then(() => {
2223
logout()
24+
trackUserDelete()
2325
toast('Account deleted successfully', { theme: 'successToast' })
2426
})
2527
.catch(() => {

src/lib/analytics.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ enum Verbs {
4646
COPY = 'Copy',
4747
CONNECT = 'Connect',
4848
DISCONNECT = 'Disconnect',
49+
DELETE = 'Delete',
4950
}
5051

5152
export enum Attributes {
@@ -394,6 +395,13 @@ export const trackUserDisconnect = () => {
394395
})
395396
}
396397

398+
export const trackUserDelete = () => {
399+
trackEvent({
400+
object: Objects.USER,
401+
verb: Verbs.DELETE,
402+
})
403+
}
404+
397405
// Identification
398406

399407
export const identifyUserLanguages = (languages: string[]) => {

0 commit comments

Comments
 (0)