Skip to content

Commit

Permalink
Merge pull request #196 from DevKor-github/upgrade/ga
Browse files Browse the repository at this point in the history
upgrade: ADD GA Events
  • Loading branch information
halionaz authored Sep 9, 2024
2 parents 9018049 + 7cab2bc commit f4cadc3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/CopyInviteCode/CopyInviteCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ActionButton from '../ActionButton';
import { Icon } from '@/libs/design-system/icons';
import { useProfileStore } from '@/libs/store/Providers/ProfileStoreProvider';
import { useToast } from '@/components/Toast';
import { sendGAEvent } from '@next/third-parties/google';

export function CopyInviteCode() {
const [copiedText, copy] = useCopyToClipboard();
Expand All @@ -17,6 +18,7 @@ export function CopyInviteCode() {

const handleCopy = usePreservedCallback(() => {
if (inviteCode) {
sendGAEvent('event', 'invite_friend', { inviteCode });
copy(generateInviteCode(inviteCode))
.then((isCopied) => {
if (isCopied) {
Expand Down
2 changes: 2 additions & 0 deletions components/DailyAttendanceQuiz/DailyAttendanceQuiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { usePostAttendance } from '@/libs/apis/attendance';
import { useLoginModal } from '@/components/LoginModal/useLoginModal';
import { useToast } from '@/components/Toast';
import { useTicketStore } from '@/libs/store/Providers/TicketStoreProvider';
import { sendGAEvent } from '@next/third-parties/google';

interface DailyAttendanceQuizProps {
question: string;
Expand Down Expand Up @@ -52,6 +53,7 @@ export function DailyAttendanceQuiz({
}, [data, refetchAttendance, openToast, addTickets]);

const handleAnswer = (answer: boolean) => {
sendGAEvent('event', 'attendance', { answer, date: new Date().toISOString() });
postAttendance(
{ answer: answer },
{
Expand Down
3 changes: 2 additions & 1 deletion components/MainTopBar/MainTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Flex } from '@/libs/design-system/flex';
import { TicketInfo } from './TicketInfo';
import { KakaoLogin } from '../KakaoLogin';
import { useAuthStore } from '@/libs/store/Providers/AuthStoreProvider';
import { sendGAEvent } from '@next/third-parties/google';

export function MainTopBar() {
const pathname = usePathname();
Expand Down Expand Up @@ -39,7 +40,7 @@ export function MainTopBar() {
animate={navControls}
transition={{ duration: 1.2, ease: easeInOut }}
>
<Link href={'/'}>
<Link href={'/'} onClick={() => sendGAEvent('event', 'click_home_logo')}>
<Icon.TokyLogo />
</Link>
<Flex $gap={12} $align="center">
Expand Down
2 changes: 2 additions & 0 deletions components/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SideBarBody from './SideBarBody';
import { useOverlay } from '@/libs/design-system/overlay';
import { OutsideClick } from '../OutsideClick/OutsideClick';
import styled from 'styled-components';
import { sendGAEvent } from '@next/third-parties/google';

export function SideBar() {
const overlay = useOverlay();
Expand All @@ -27,6 +28,7 @@ export function SideBar() {

async function openBar() {
await openSideBar();
sendGAEvent('event', 'open_sidebar');
}

return (
Expand Down
2 changes: 2 additions & 0 deletions components/SideBar/SideBarBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useAuthStore } from '@/libs/store/Providers/AuthStoreProvider';
import { useTicketStore } from '@/libs/store/Providers/TicketStoreProvider';
import { onClickKakaoLogin } from '@/libs/utils/kakaoLogin';
import { usePostLogout } from '@/libs/apis/auth';
import { sendGAEvent } from '@next/third-parties/google';

function SideBarBody({ isBarOpen = true }) {
const nowPage = usePathname();
Expand All @@ -24,6 +25,7 @@ function SideBarBody({ isBarOpen = true }) {
const router = useRouter();

function openTokyInstagram() {
sendGAEvent('event', 'contact');
window.open('https://instagram.com/official.toky?igshid=NjIwNzIyMDk2Mg==');
}

Expand Down

0 comments on commit f4cadc3

Please sign in to comment.