@@ -3,21 +3,22 @@ import Image from "next/image";
33import { useRouter } from "next/navigation" ;
44import { useAnimation } from "framer-motion" ;
55import { useInView } from "react-intersection-observer" ;
6- import { getAnalytics , logEvent } from "firebase/analytics" ;
76import useCheckSignIn from "@/hooks/useCheckSignIn" ;
87import { setCookie } from "@/utils/cookie" ;
98
109import "@/apis/firebase" ;
1110
11+ import useAnalytics from "@/hooks/useAnalytics" ;
1212import * as S from "./ComponentMobile.styled" ;
1313
1414type Props = Record < string , any > ;
1515
1616const Component1Mobile = forwardRef < HTMLDivElement , Props > ( ( props , ref ) => {
17- const analytics = getAnalytics ( ) ;
1817 const isSignIn = useCheckSignIn ( ) ;
1918
20- logEvent ( analytics , "screen_view" , {
19+ const { logEvent } = useAnalytics ( ) ;
20+
21+ logEvent ( "screen_view" , {
2122 firebase_screen : "homepage_top" ,
2223 firebase_screen_class : "homepage_top" ,
2324 } ) ;
@@ -41,13 +42,11 @@ const Component1Mobile = forwardRef<HTMLDivElement, Props>((props, ref) => {
4142 } , [ controls , inView ] ) ;
4243
4344 const navigateToTrial = ( ) => {
44- const url = isSignIn
45- ? "/admin"
46- : "/signup" ;
45+ const url = isSignIn ? "/admin" : "/signup" ;
4746 setCookie ( "/" ) ;
4847
4948 router . push ( url ) ;
50- logEvent ( analytics , "btn_click" , {
49+ logEvent ( "btn_click" , {
5150 btn_name : "homepage_start_free_trial_click" ,
5251 btn_position : "top" ,
5352 } ) ;
0 commit comments