Skip to content

Commit

Permalink
install react-ga4
Browse files Browse the repository at this point in the history
  • Loading branch information
nasubi-dev committed Sep 28, 2024
1 parent 874f447 commit 974e6cc
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 17 deletions.
Binary file modified bun.lockb
Binary file not shown.
8 changes: 0 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<!doctype html>
<html lang="ja">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8KV8Z5BX8M"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-8KV8Z5BX8M');
</script>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-ga4": "^2.1.0",
"react-hook-form": "^7.52.0",
"react-router-dom": "^6.23.1",
"styled-components": "^6.1.11",
Expand All @@ -42,7 +43,6 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240614.0",
"@types/gtag.js": "^0.0.20",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
Expand Down
4 changes: 0 additions & 4 deletions src/components/achievements/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Avatar, Flex, Text } from "@radix-ui/themes";
import { type ReactElement } from "react";
import { useLocation } from "react-router-dom";
import styled from "styled-components";
import { sendAnalytics } from "@/lib/utils/analytics";
import { useNavigate } from "@/router";
import { type Achievement } from "@/types/post-data/achievements";

Expand Down Expand Up @@ -58,13 +56,11 @@ export function AchievementCard({
achievement: Achievement;
}): ReactElement {
const navigate = useNavigate();
const url = useLocation().pathname;

return (
<CardStyle
align="center"
onClick={() => {
sendAnalytics("achievementDetail", url);
navigate("/achievements/:id", {
params: {
id: achievement.id.toString(),
Expand Down
4 changes: 0 additions & 4 deletions src/components/member/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Avatar, Flex, Text } from "@radix-ui/themes";
import { type ReactElement } from "react";
import { useLocation } from "react-router-dom";
import styled from "styled-components";
import { sendAnalytics } from "@/lib/utils/analytics";
import { useNavigate } from "@/router";
import { type Member } from "@/types/member";

Expand Down Expand Up @@ -50,7 +48,6 @@ export function MemberCard({
point?: number;
}): ReactElement {
const navigate = useNavigate();
const url = useLocation().pathname;

return (
<CardStyle
Expand All @@ -59,7 +56,6 @@ export function MemberCard({
if (member.email == null) {
throw new Error("Member email is undefined");
}
sendAnalytics("memberDetail", url);
navigate("/members/:id", {
params: {
id: member.email,
Expand Down

0 comments on commit 974e6cc

Please sign in to comment.