Skip to content

Commit

Permalink
feat: track click event
Browse files Browse the repository at this point in the history
  • Loading branch information
solar3070 committed Sep 22, 2023
1 parent 1f08436 commit 2884624
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { track } from '@amplitude/analytics-browser';
import Image from 'next/image';
import React from 'react';
import { useIsDesktop, useIsMobile, useIsTablet } from '@src/hooks/useDevice';
Expand Down Expand Up @@ -114,7 +115,10 @@ function MobileActivityDescription() {
return (
<li
className={cc([currentTab.type === type && styles.selected])}
onClick={() => handleClick(type)}
onClick={() => {
handleClick(type);
track('click_main_activity', { activity: type });
}}
key={type}
role="presentation"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { track } from '@amplitude/analytics-browser';
import { useIsDesktop, useIsMobile, useIsTablet } from '@src/hooks/useDevice';
import { useTabs } from '@src/hooks/useTabs';
import cc from 'classcat';
Expand Down Expand Up @@ -49,7 +50,10 @@ function MobilePartDescription() {
return (
<li
className={cc([currentTab.type === type && styles.selected])}
onClick={() => handleClick(type)}
onClick={() => {
handleClick(type);
track('click_main_part', { part: type });
}}
key={type}
role="presentation"
>
Expand Down
6 changes: 5 additions & 1 deletion src/views/ReviewPage/components/TabBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { track } from '@amplitude/analytics-browser';
import { extraTabs } from '@src/lib/constants/tabs';
import { ExtraPart, ExtraTabType } from '@src/lib/types/universal';
import * as S from './style';
Expand All @@ -13,7 +14,10 @@ const TabBar = ({ onTabClick, selectedTab }: TabBarProps) => {
{extraTabs.map((tab) => (
<Tab
key={tab.value}
onClick={() => onTabClick(tab.value)}
onClick={() => {
onTabClick(tab.value);
track('click_review_part', { part: tab.value });
}}
tab={tab}
selected={selectedTab === tab.value}
/>
Expand Down

0 comments on commit 2884624

Please sign in to comment.