Skip to content

Commit

Permalink
feat: add amplitude trackings in review page
Browse files Browse the repository at this point in the history
  • Loading branch information
SeojinSeojin committed Sep 25, 2023
1 parent c8dda1e commit 2b2ae2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/views/ReviewPage/components/Content/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { track } from '@amplitude/analytics-browser';
import { useState } from 'react';
import { ExtraPart, PartExtraType } from '@src/lib/types/universal';
import Reviews from '../Reviews';
Expand All @@ -6,9 +7,14 @@ import TabBar from '../TabBar';
const Content = () => {
const [selectedTab, setSelectedTab] = useState<ExtraPart>(PartExtraType.ALL);

const onTabClick = (tab: ExtraPart) => {
track('click_review_part', { part: tab });
setSelectedTab(tab);
};

return (
<>
<TabBar onTabClick={setSelectedTab} selectedTab={selectedTab} />
<TabBar onTabClick={onTabClick} selectedTab={selectedTab} />
<Reviews selectedTab={selectedTab} />
</>
);
Expand Down
8 changes: 7 additions & 1 deletion src/views/ReviewPage/components/Reviews/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { track } from '@amplitude/analytics-browser';
import { useMemo } from 'react';
import { useIsMobile } from '@src/hooks/useDevice';
import { ExtraPart } from '@src/lib/types/universal';
Expand All @@ -21,7 +22,12 @@ const Reviews = ({ selectedTab }: ReviewsProps) => {
<>
<S.Wrapper>
{reviews.data.map((review, idx) => (
<S.Card key={`${review.id}-${idx}`} href={review.link} target="_blank">
<S.Card
key={`${review.id}-${idx}`}
href={review.link}
target="_blank"
onClick={() => track('click_review_detail')}
>
<S.Section>
<S.ThumbnailWrapper>
<S.Thumbnail
Expand Down

0 comments on commit 2b2ae2b

Please sign in to comment.