diff --git a/src/common/utils/analytics.ts b/src/common/utils/analytics.ts index 40fe0379ef..74c59c2a37 100644 --- a/src/common/utils/analytics.ts +++ b/src/common/utils/analytics.ts @@ -103,6 +103,7 @@ export interface ClickButtonProp { | 'newest' | 'campaign_detail_link' | `campaign_detail_tab_${string}` + | `user_profile_tab_${string}` pageType?: PageType pageComponent?: PageComponent } diff --git a/src/components/Tabs/index.tsx b/src/components/Tabs/index.tsx index c7889e523b..13fc088c21 100644 --- a/src/components/Tabs/index.tsx +++ b/src/components/Tabs/index.tsx @@ -36,7 +36,12 @@ const Tab: React.FC> = ({ if (href) { return ( -
  • +
  • {children} diff --git a/src/views/User/UserTabs/index.tsx b/src/views/User/UserTabs/index.tsx index ff27781ae0..df4bebdba9 100644 --- a/src/views/User/UserTabs/index.tsx +++ b/src/views/User/UserTabs/index.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react' import { FormattedMessage } from 'react-intl' -import { toPath } from '~/common/utils' +import { analytics, toPath } from '~/common/utils' import { Tabs, useRoute, ViewerContext } from '~/components' import { TabsUserFragment } from '~/gql/graphql' @@ -53,6 +53,12 @@ const UserTabs = ({ {...userCollectionsPath} selected={isInPath('USER_COLLECTIONS')} count={collectionCount > 0 ? collectionCount : undefined} + onClick={() => { + analytics.trackEvent('click_button', { + type: `user_profile_tab_collection` as `user_profile_tab_${string}`, + pageType: 'user_profile', + }) + }} >