Skip to content

Commit a8c4489

Browse files
committed
fix: prevent request gtag when mode is dev
1 parent c759c90 commit a8c4489

27 files changed

+122
-112
lines changed

.vscode/settings.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"editor.formatOnSave": true,
3-
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true,
5-
},
6-
"editor.defaultFormatter": "esbenp.prettier-vscode",
7-
}
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": "explicit"
5+
},
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
}

app/components/landing/mobile/Component1Mobile.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@ import Image from "next/image";
33
import { useRouter } from "next/navigation";
44
import { useAnimation } from "framer-motion";
55
import { useInView } from "react-intersection-observer";
6-
import { getAnalytics, logEvent } from "firebase/analytics";
76
import useCheckSignIn from "@/hooks/useCheckSignIn";
87
import { setCookie } from "@/utils/cookie";
98

109
import "@/apis/firebase";
1110

11+
import useAnalytics from "@/hooks/useAnalytics";
1212
import * as S from "./ComponentMobile.styled";
1313

1414
type Props = Record<string, any>;
1515

1616
const 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
});

app/components/landing/mobile/Component2Mobile.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React from "react";
22
// import Image from "next/image";
33
import { useAnimation } from "framer-motion";
44
import { useInView } from "react-intersection-observer";
5-
import { getAnalytics, logEvent } from "firebase/analytics";
65
import "@/apis/firebase";
76

7+
import useAnalytics from "@/hooks/useAnalytics";
88
import * as S from "./ComponentMobile.styled";
99

1010
export default function Component2Mobile() {
11-
const analytics = getAnalytics();
12-
logEvent(analytics, "screen_view", {
11+
const { logEvent } = useAnalytics();
12+
logEvent("screen_view", {
1313
firebase_screen: "homepage_carrer",
1414
firebase_screen_class: "homepage_carrer",
1515
});

app/components/landing/mobile/Component8Mobile.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from "react";
22
import { useAnimation } from "framer-motion";
33
import { useInView } from "react-intersection-observer";
4-
import { getAnalytics, logEvent } from "firebase/analytics";
54
import "@/apis/firebase";
65

6+
import useAnalytics from "@/hooks/useAnalytics";
77
import * as S from "./ComponentMobile.styled";
88

99
export default function Component8Mobile() {
10-
const analytics = getAnalytics();
11-
logEvent(analytics, "screen_view", {
10+
const { logEvent } = useAnalytics();
11+
logEvent("screen_view", {
1212
firebase_screen: "homepage_plan",
1313
firebase_screen_class: "homepage_plan",
1414
});

app/components/landing/mobile/Component9Mobile.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import Image from "next/image";
33
import { useRouter } from "next/navigation";
44
import { useAnimation } from "framer-motion";
55
import { useInView } from "react-intersection-observer";
6-
import { getAnalytics, logEvent } from "firebase/analytics";
76
import useCheckSignIn from "@/hooks/useCheckSignIn";
87
import "@/apis/firebase";
98
import { setCookie } from "@/utils/cookie";
109

10+
import useAnalytics from "@/hooks/useAnalytics";
1111
import * as S from "./ComponentMobile.styled";
1212

1313
type Props = Record<string, any>;
@@ -17,19 +17,18 @@ const Component9Mobile = forwardRef<HTMLDivElement, Props>((props, ref) => {
1717
const router = useRouter();
1818
const isSignIn = useCheckSignIn();
1919

20-
const analytics = getAnalytics();
21-
logEvent(analytics, "screen_view", {
20+
const { logEvent } = useAnalytics();
21+
22+
logEvent("screen_view", {
2223
firebase_screen: "homepage_bottom",
2324
firebase_screen_class: "homepage_bottom",
2425
});
2526

2627
const navigateToTrial = () => {
27-
const url = isSignIn
28-
? "/admin"
29-
: "/signup";
28+
const url = isSignIn ? "/admin" : "/signup";
3029
setCookie("/");
3130
router.push(url);
32-
logEvent(analytics, "btn_click", {
31+
logEvent("btn_click", {
3332
btn_name: "homepage_start_free_trial_click",
3433
btn_position: "bottom",
3534
});

app/components/landing/mobile/MobileBtn.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
import { useEffect, useState } from "react";
2-
import { getAnalytics, logEvent } from "firebase/analytics";
32
import "@/apis/firebase";
43
import { useRouter } from "next/navigation";
54
import useCheckSignIn from "@/hooks/useCheckSignIn";
65
import { setCookie } from "@/utils/cookie";
6+
import useAnalytics from "@/hooks/useAnalytics";
77
import * as S from "./ComponentMobile.styled";
88

99
export default function Inputbar(): JSX.Element | null {
1010
const [isVisible, setIsVisible] = useState(false);
11-
const analytics = getAnalytics();
1211
const router = useRouter();
1312
const isSignIn = useCheckSignIn();
13+
const { logEvent } = useAnalytics();
1414

1515
const navigateToTrial = () => {
16-
const url = isSignIn
17-
? "/admin"
18-
: "/signup";
16+
const url = isSignIn ? "/admin" : "/signup";
1917
setCookie("/");
2018
router.push(url);
21-
logEvent(analytics, "btn_click", {
19+
logEvent("btn_click", {
2220
btn_name: "homepage_start_free_trial_click",
2321
btn_position: "floating",
2422
});

app/components/landing/mobile/Phone.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React, { useRef } from "react";
22
import { useScroll, useTransform } from "framer-motion";
33

44
import Image from "next/image";
5-
import { getAnalytics, logEvent } from "firebase/analytics";
65
import "@/apis/firebase";
76

87
import * as S from "@/components/landing/mobile/ComponentMobile.styled";
8+
import useAnalytics from "@/hooks/useAnalytics";
99

1010
export default function Phone() {
11-
const analytics = getAnalytics();
12-
logEvent(analytics, "screen_view", {
11+
const { logEvent } = useAnalytics();
12+
logEvent("screen_view", {
1313
firebase_screen: "homepage_function_1",
1414
firebase_screen_class: "homepage_function_1",
1515
});

app/components/landing/mobile/Phone2.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React, { forwardRef, useEffect } from "react";
22
import { useAnimation } from "framer-motion";
33
import Image from "next/image";
4-
import { getAnalytics, logEvent } from "firebase/analytics";
54
import "@/apis/firebase";
65

76
import * as S from "@/components/landing/mobile/ComponentMobile.styled";
7+
import useAnalytics from "@/hooks/useAnalytics";
88

99
const Phone2 = forwardRef<HTMLDivElement>((props, ref) => {
10-
const analytics = getAnalytics();
11-
logEvent(analytics, "screen_view", {
10+
const { logEvent } = useAnalytics();
11+
logEvent("screen_view", {
1212
firebase_screen: "homepage_function_2",
1313
firebase_screen_class: "homepage_function_2",
1414
});

app/components/landing/mobile/Phone3.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React, { forwardRef, useEffect } from "react";
22
import { useAnimation } from "framer-motion";
33
import Image from "next/image";
4-
import { getAnalytics, logEvent } from "firebase/analytics";
54
import "@/apis/firebase";
65

76
import * as S from "@/components/landing/mobile/ComponentMobile.styled";
7+
import useAnalytics from "@/hooks/useAnalytics";
88

99
const Phone3 = forwardRef<HTMLDivElement>((props, ref) => {
10-
const analytics = getAnalytics();
11-
logEvent(analytics, "screen_view", {
10+
const { logEvent } = useAnalytics();
11+
logEvent("screen_view", {
1212
firebase_screen: "homepage_function_3",
1313
firebase_screen_class: "homepage_function_3",
1414
});

app/components/landing/mobile/Phone4.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React, { forwardRef, useEffect } from "react";
22
import { useAnimation } from "framer-motion";
33
import Image from "next/image";
4-
import { getAnalytics, logEvent } from "firebase/analytics";
54
import "@/apis/firebase";
65

76
import * as S from "@/components/landing/mobile/ComponentMobile.styled";
7+
import useAnalytics from "@/hooks/useAnalytics";
88

99
const Phone4 = forwardRef<HTMLDivElement>((props, ref) => {
10-
const analytics = getAnalytics();
11-
logEvent(analytics, "screen_view", {
10+
const { logEvent } = useAnalytics();
11+
logEvent("screen_view", {
1212
firebase_screen: "homepage_function_4",
1313
firebase_screen_class: "homepage_function_4",
1414
});

0 commit comments

Comments
 (0)