Skip to content

Commit b74dffc

Browse files
committed
chore: enhance umami tracking for various user interactions across components
1 parent d5aafe0 commit b74dffc

File tree

8 files changed

+20
-3
lines changed

8 files changed

+20
-3
lines changed

src/components/Composer/NewPost.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const NewPost = ({ feed }: NewPostProps) => {
2121
const [showComposer, setShowComposer] = useState(false);
2222

2323
const handleOpenComposer = () => {
24+
umami.track("open_composer");
2425
setShowComposer(true);
2526
};
2627

src/components/Post/Actions/Comment.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const Comment = ({ post, showCount }: CommentProps) => {
2323
<button
2424
aria-label="Comment"
2525
className="rounded-full p-1.5 outline-offset-2 hover:bg-gray-300/20"
26-
onClick={() => navigate(`/posts/${post.slug}`)}
26+
onClick={() => {
27+
umami.track("open_post");
28+
navigate(`/posts/${post.slug}`);
29+
}}
2730
type="button"
2831
>
2932
<Tooltip

src/components/Post/Actions/Menu/Edit.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const Edit = ({ post }: EditProps) => {
7171
}
7272
onClick={(event) => {
7373
stopEventPropagation(event);
74+
umami.track("open_edit_post");
7475
handleEdit();
7576
}}
7677
>

src/components/Post/Actions/Share/UndoRepost.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const UndoRepost = ({
7474
}
7575

7676
setIsSubmitting(true);
77+
umami.track("undo_repost");
7778

7879
return await undoRepost({
7980
variables: { request: { post: post.id } }

src/components/Shared/LoginButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const LoginButton = ({
1818

1919
const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {
2020
event.stopPropagation();
21+
umami.track("open_login");
2122
return setShowAuthModal(true);
2223
}, []);
2324

src/components/Shared/Navbar/NavItems/Pro.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ const Pro = () => {
66
const { setShow: setShowProModal } = useProModalStore();
77

88
return (
9-
<button onClick={() => setShowProModal(true)} type="button">
9+
<button
10+
onClick={() => {
11+
umami.track("open_pro");
12+
setShowProModal(true);
13+
}}
14+
type="button"
15+
>
1016
<Tooltip content="Pro">
1117
<CheckBadgeIcon className="size-6" />
1218
</Tooltip>

src/components/Shared/Navbar/NavItems/SwitchAccount.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const SwitchAccount = ({ className = "" }: SwitchAccountProps) => {
1515
"flex w-full items-center space-x-1.5 px-2 py-1.5 text-left text-gray-700 text-sm dark:text-gray-200",
1616
className
1717
)}
18-
onClick={() => setShowSwitchAccountModal(true)}
18+
onClick={() => {
19+
umami.track("open_switch_account");
20+
setShowSwitchAccountModal(true);
21+
}}
1922
type="button"
2023
>
2124
<ArrowsRightLeftIcon className="size-4" />

src/components/Shared/Navbar/SignupButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const SignupButton = ({ className }: SignupButtonProps) => {
1414
<Button
1515
className={className}
1616
onClick={() => {
17+
umami.track("open_signup");
1718
setScreen("choose");
1819
setShowAuthModal(true, "signup");
1920
}}

0 commit comments

Comments
 (0)