Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e24c89d
feat: mbti 테스트 관련 페이지, 대화 tips 관련 페이지trackedView에 추가
junjeeong Apr 24, 2025
bc90ce4
feat: mbti-test-progress 페이지 useEffect로 페이지 컴포넌트에서 pageView 관리
junjeeong Apr 24, 2025
fa83330
Mbti intro 페이지 시작하기 버튼, Mbti 결과 페이지 돌아가기 버튼+공유하기 버튼 Click 이벤트 추가
junjeeong Apr 24, 2025
b85940f
카카오 로그인 버튼 Click 이벤트 할당
junjeeong Apr 24, 2025
c9c9fc6
chat 페이지의 Chat tips 메뉴바 Click 이벤트 할당
junjeeong Apr 24, 2025
9bb58bf
홈 화면 로그인 버튼 click 이벤트 할당
junjeeong Apr 24, 2025
269cc35
홈 화면, 내 정보 버튼 click 이벤트 할당
junjeeong Apr 24, 2025
5530b4b
Merge branch 'dev' into feature/Ga4-trackedpage-추가-및-click-이벤트-할당-정준영
junjeeong Apr 24, 2025
2dba05c
feat: 홈화면 친구 추가, 친구 삭제, 대화 시작하기 버튼 click 이벤트 할당
junjeeong Apr 24, 2025
72a66df
fix: App.tsx에 trackedPaths 수정
junjeeong Apr 24, 2025
434ffc7
fix: 바이럴 콘텐츠 질문 페이지 매개변수값 수정
junjeeong Apr 24, 2025
b20fe56
fix: 로그인버튼, 내정보 버튼 click 이벤트 매개변수 수정
junjeeong Apr 24, 2025
950832a
fix: 친구 추가, 친구 삭제 매개변수 수정
junjeeong Apr 24, 2025
1730734
fix: 바이럴 콘텐츠 결과 페이지 view, click 이벤트 매개변수 변경
junjeeong Apr 24, 2025
0f7c186
fix: 데이터 태깅 기획에 맞게 page element 수정
junjeeong Apr 24, 2025
de086e4
fix: 데이터 태깅기획과 맞지 않은 element 들 삭제'
junjeeong Apr 27, 2025
1b317cf
chore: 바로 대화하기 버튼 -> 바로 대화하기 오타 수정
junjeeong Apr 27, 2025
46e208e
Merge branch 'dev' into feature/Ga4-trackedpage-추가-및-click-이벤트-할당-정준영
junjeeong Apr 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ const PageTracker = () => {
{ path: "/my-info", page: "내 정보" },
{ path: "/chat", page: "채팅방" },
{ path: "/select-info", page: "빠른 대화 설정" },
{ path: "/select-info", page: "친구 저장" }
{ path: "/mbti-test", page: "바이럴 콘텐츠 소개" },
{ path: "/mbti-result", page: "바이럴 콘텐츠 결과" },
{ path: "/chat-recommend", page: "대화주제추천" },
{ path: "/chat-tips", page: "대화 꿀팁" },
{ path: "/chat-temporature", page: "대화 온도" }
];

useEffect(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/components/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SetStateAction } from "react";
import { useNavigate } from "react-router-dom";
import { authInstance } from "@/api/axios";
import { VirtualFriend } from "@/types/virtualFreind";
import trackClickEvent from "@/utils/trackClickEvent";

interface ProfileProps {
info: VirtualFriend;
Expand All @@ -12,6 +13,7 @@ const Profile = ({ info, deleteIndex, setVirtualFriendList }: ProfileProps) => {
const navigate = useNavigate();

const handleDelete = async () => {
trackClickEvent("홈", "친구 - 삭제");
const res = await authInstance.delete(
`/api/virtual-friend/${info.virtualFriendId}`
);
Expand All @@ -23,6 +25,7 @@ const Profile = ({ info, deleteIndex, setVirtualFriendList }: ProfileProps) => {
};

const handleNavigate = () => {
trackClickEvent("홈", "친구 - 바로 대화하기");
navigate("/chat", {
state: {
mode: "virtualFriend",
Expand Down
2 changes: 2 additions & 0 deletions src/components/SubTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import trackClickEvent from "@/utils/trackClickEvent";
import ActionConfirmModal from "@/components/modal/ActionConfirmModal";
import useAuthStore from "@/store/useAuthStore";

Expand All @@ -20,6 +21,7 @@ const SubTitle = ({ mode }: { mode: "빠른대화" | "친구목록" }) => {
};

const handleNavigate = () => {
trackClickEvent("홈", "친구 - 추가");
if (isLoggedIn) {
const type = mode === "빠른대화" ? "fastFriend" : "virtualFriend";
navigate("/select-info", { state: { type: type } });
Expand Down
10 changes: 7 additions & 3 deletions src/components/button/ChatStartButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigate } from "react-router-dom";
import { useLocation, useNavigate } from "react-router-dom";
import { trackEvent } from "@/libs/analytics";

type ChatStartButtonProps = {
Expand All @@ -8,13 +8,17 @@ type ChatStartButtonProps = {

const ChatStartButton = ({ mode, mbti }: ChatStartButtonProps) => {
const navigate = useNavigate();
const pathname = useLocation().pathname;

const handleNavigate = () => {
switch (mode) {
case "go-fast":
trackEvent("Click", {
page: "홈",
element: "빠른 대화 시작"
page: pathname === "/mbti-test-result" ? "바이럴 콘텐츠 결과" : "홈",
element:
pathname === "/mbti-test-result"
? "대화 시작하기"
: "빠른 대화 시작"
});
navigate("/select-info", { state: { type: "fastFriend", mbti } });
break;
Expand Down
3 changes: 3 additions & 0 deletions src/components/button/KakaoLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import trackClickEvent from "@/utils/trackClickEvent";

const KakaoLoginButton = () => {
const kakaoRestApiKey = import.meta.env.VITE_KAKAO_REST_API_KEY;
const kakaoRedirectUrl =
Expand All @@ -8,6 +10,7 @@ const KakaoLoginButton = () => {
const kakaoURL = `https://kauth.kakao.com/oauth/authorize?client_id=${kakaoRestApiKey}&redirect_uri=${kakaoRedirectUrl}&response_type=code`;

const handleClick = () => {
trackClickEvent("로그인/회원가입", "로그인");
window.location.href = kakaoURL;
};

Expand Down
12 changes: 9 additions & 3 deletions src/components/button/LoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import trackClickEvent from "@/utils/trackClickEvent";

const LoginButton = () => {
const handleClick = () => {
trackClickEvent("홈", "로그인");
};

return (
<a href="/login">
<button className="w-[69px] h-[36px] border-[0.8px] border-gray-300 rounded-lg font-bold text-gray-600 text-md">
로그인
<a href="/login" onClick={handleClick}>
<button className="h-[36px] w-[69px] rounded-lg border-[0.8px] border-gray-300 text-md font-bold text-gray-600">
로그인
</button>
</a>
);
Expand Down
25 changes: 14 additions & 11 deletions src/components/button/RestartButton.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { useNavigate } from "react-router-dom";

const RestartButton = () => {
const navigate = useNavigate();
const navigate = useNavigate();

const goFirstStep = () => {
navigate("/mbti-test");
}
const goFirstStep = () => {
navigate("/mbti-test");
};

return (
<button className="flex justify-center items-center bg-gray-100 rounded-lg w-[72px] h-[60px]" onClick={goFirstStep}>
<img src="/icon/restart.svg" alt="다시하기 버튼" width={24} height={24} />
</button>
)
}
return (
<button
className="flex h-[60px] w-[72px] items-center justify-center rounded-lg bg-gray-100"
onClick={goFirstStep}
>
<img src="/icon/restart.svg" alt="다시하기 버튼" width={24} height={24} />
</button>
);
};

export default RestartButton;
export default RestartButton;
8 changes: 7 additions & 1 deletion src/components/button/ShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import ShareModal from "@/components/modal/ShareModal";
const ShareButton = () => {
const [shareModalIsOpen, setShareModalIsOpen] = useState(false);

const handleClick = () => {
setShareModalIsOpen(true);
};
return (
<>
<button onClick={()=>setShareModalIsOpen(true)} className="flex h-[60px] w-full items-center justify-center rounded-lg border border-primary-light bg-primary-pale font-bold text-primary-normal">
<button
onClick={handleClick}
className="flex h-[60px] w-full items-center justify-center rounded-lg border border-primary-light bg-primary-pale font-bold text-primary-normal"
>
공유하기
</button>
{shareModalIsOpen && (
Expand Down
2 changes: 2 additions & 0 deletions src/components/header/MainHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Link, useNavigate } from "react-router-dom";
import LoginButton from "@/components/button/LoginButton";
import trackClickEvent from "@/utils/trackClickEvent";

const MainHeader = ({ isLoggedIn }: { isLoggedIn: boolean }) => {
const navigate = useNavigate();

const handleNavigate = () => {
trackClickEvent("홈", "내정보");
navigate("/my-info");
};

Expand Down
11 changes: 10 additions & 1 deletion src/components/tips/TipsMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import trackClickEvent from "@/utils/trackClickEvent";
import { Link } from "react-router-dom";

const TipsMenu = ({
Expand All @@ -6,31 +7,39 @@ const TipsMenu = ({
mode: "topic" | "conversation" | "temporature";
}) => {
let text = "";
let tagElement = "";
let imageUrl = "";
let href = "";

switch (mode) {
case "topic":
text = "대화 주제 추천";
tagElement = "대화 주제 추천";
imageUrl = "/icon/starbubble.svg";
href = "/chat-recommend";
break;
case "conversation":
text = "대화 꿀팁";
tagElement = "대화 꿀팁";
imageUrl = "/icon/lightbulb.svg";
href = "/chat-tips";
break;
case "temporature":
text = "현재 대화의 온도 측정하기";
tagElement = "대화의 온도";
imageUrl = "/icon/thermometer.svg";
href = "/chat-temporature";
break;
default:
return;
}

const handleClick = () => {
trackClickEvent("채팅방", tagElement);
};

return (
<Link to={href}>
<Link to={href} onClick={handleClick}>
<div className="flex h-[56px] w-full border-t border-gray-100 bg-white px-4 py-4 hover:bg-primary-pale">
<img src={imageUrl} alt={text} width={20} height={20} />
<h2 className="text-2lg ml-[22px] font-medium text-gray-800">{text}</h2>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/MbtiTestIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ChangeEvent, FormEvent, useState } from "react";
import { useNavigate } from "react-router-dom";
import Header from "@/components/header/Header";
import useLayoutSize from "@/hooks/useLayoutSize";
import trackClickEvent from "@/utils/trackClickEvent";

const MbtiTestIntro = () => {
const [name, setName] = useState("");
const navigate = useNavigate();
Expand Down Expand Up @@ -59,6 +61,7 @@ const MbtiTestIntro = () => {
<button
type="submit"
className="mt-[60px] h-[60px] w-[320px] rounded-lg bg-primary-normal font-bold text-white hover:opacity-80 lg:w-[460px]"
onClick={() => trackClickEvent("바이럴 콘텐츠 소개", "")}
>
시작하기
</button>
Expand Down
43 changes: 25 additions & 18 deletions src/pages/MbtiTestQuestions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useEffect } from "react";
import { trackPageView } from "@/libs/analytics";
import { TEST_QNA } from "@/constants/TEST_QNA";
import MbtiAnswerButtons from "@/components/button/MbtiAnswerButtons";
import useMbtiTestState from "@/store/useMbtiTestState";
import Header from "@/components/header/Header";
import Error from "@/pages/Error";

interface content {
number: number;
Expand All @@ -15,31 +18,35 @@ interface content {
const MbtiTestQuestions = () => {
const { currentPage } = useMbtiTestState();

useEffect(() => {
trackPageView(`바이럴 콘텐츠 (질문 ${currentPage})`, "");
}, [currentPage]);

if (currentPage) {
const content: content = TEST_QNA[Number(currentPage) - 1];

return (
<div className="sm:w-[360px] md:w-[375px] lg:w-[500px] flex flex-col">
<Header title="상대방 MBTI 유추 테스트"/>
<main className="flex flex-col items-center justify-center bg-white whitespace-pre-wrap h-full ">
<span className="text-lg font-medium text-gray-500">
{content.number}/12
</span>
<h1 className="mt-[20px] text-center text-3xl font-medium whitespace-pre-wrap">
{content.question}
</h1>
<img
src={`/icon/mbti_test_${currentPage}.svg`}
alt="mbti 테스트 과정 이미지"
className="mt-10"
/>
<div className="mt-[93px]">
<MbtiAnswerButtons content={content.answers} />
</div>
<div className="flex flex-col sm:w-[360px] md:w-[375px] lg:w-[500px]">
<Header title="상대방 MBTI 유추 테스트" />
<main className="flex h-full flex-col items-center justify-center bg-white whitespace-pre-wrap ">
<span className="text-lg font-medium text-gray-500">
{content.number}/12
</span>
<h1 className="mt-[20px] text-center text-3xl font-medium whitespace-pre-wrap">
{content.question}
</h1>
<img
src={`/icon/mbti_test_${currentPage}.svg`}
alt="mbti 테스트 과정 이미지"
className="mt-10"
/>
<div className="mt-[93px]">
<MbtiAnswerButtons content={content.answers} />
</div>
</main>
</div>
);
} else return <div>404 error</div>;
} else return <Error statusCode="404" />;
};

export default MbtiTestQuestions;
1 change: 0 additions & 1 deletion src/pages/MbtiTestResult.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { MouseEvent } from "react";
import { MBTI_RESULT_INFO } from "@/constants/MBTI_RESULT_INFO";
import ShareButton from "@/components/button/ShareButton";
import RestartButton from "@/components/button/RestartButton";
Expand Down
10 changes: 10 additions & 0 deletions src/utils/trackClickEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { trackEvent } from "@/libs/analytics";

const trackClickEvent = (page: string, element: string) => {
trackEvent("Click", {
page: page,
element: element
});
};

export default trackClickEvent;