From 73c305d7598519f914cc2c387343cf228752628a Mon Sep 17 00:00:00 2001 From: "Vitor A. Batista" Date: Thu, 14 Mar 2024 12:49:34 -0300 Subject: [PATCH] google analytics --- package-lock.json | 10 ++++++++++ package.json | 1 + src/pages/about-us.tsx | 3 +++ src/pages/add-blog.tsx | 3 +++ src/pages/details-page.tsx | 4 +++- src/pages/home-page.tsx | 4 ++++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 5043071..a325f9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "react-bootstrap": "^2.10.1", "react-dom": "^18.2.0", "react-dropdown-select": "^4.11.2", + "react-ga": "^3.3.1", "react-icons": "^5.0.1", "react-router-dom": "^6.18.0", "react-scripts": "5.0.1", @@ -16796,6 +16797,15 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "node_modules/react-ga": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/react-ga/-/react-ga-3.3.1.tgz", + "integrity": "sha512-4Vc0W5EvXAXUN/wWyxvsAKDLLgtJ3oLmhYYssx+YzphJpejtOst6cbIHCIyF50Fdxuf5DDKqRYny24yJ2y7GFQ==", + "peerDependencies": { + "prop-types": "^15.6.0", + "react": "^15.6.2 || ^16.0 || ^17 || ^18" + } + }, "node_modules/react-icons": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.0.1.tgz", diff --git a/package.json b/package.json index c0495cf..ea2631b 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "react-bootstrap": "^2.10.1", "react-dom": "^18.2.0", "react-dropdown-select": "^4.11.2", + "react-ga": "^3.3.1", "react-icons": "^5.0.1", "react-router-dom": "^6.18.0", "react-scripts": "5.0.1", diff --git a/src/pages/about-us.tsx b/src/pages/about-us.tsx index 58670f7..bf6e0bb 100644 --- a/src/pages/about-us.tsx +++ b/src/pages/about-us.tsx @@ -6,6 +6,9 @@ import AddIcon from '../assets/svg/add-icon-white.svg'; import logo from '../assets/logo_viva_viajando_transparente.jpeg' import React from 'react'; +import ReactGA from 'react-ga'; +ReactGA.initialize('G-YYECSC1FEY'); +ReactGA.pageview(window.location.pathname + window.location.search); export default function AboutUs() { const navigate = useNavigate(); diff --git a/src/pages/add-blog.tsx b/src/pages/add-blog.tsx index 04205cb..9d6f430 100644 --- a/src/pages/add-blog.tsx +++ b/src/pages/add-blog.tsx @@ -11,6 +11,9 @@ import { categories } from '../utils/category-colors'; import MDEditor from '@uiw/react-md-editor'; import style from '../assets/markdown.styles.module.css'; import React from 'react'; +import ReactGA from 'react-ga'; +ReactGA.initialize('G-YYECSC1FEY'); +ReactGA.pageview(window.location.pathname + window.location.search); type FormData = { title: string; diff --git a/src/pages/details-page.tsx b/src/pages/details-page.tsx index 94757a7..c427580 100644 --- a/src/pages/details-page.tsx +++ b/src/pages/details-page.tsx @@ -9,7 +9,9 @@ import Footer from '../components/footer'; import ThemeToggle from '../components/theme-toggle-button'; import mdstyles from '../assets/markdown.styles.module.css' - +import ReactGA from 'react-ga'; +ReactGA.initialize('G-YYECSC1FEY'); +ReactGA.pageview(window.location.pathname + window.location.search); export default function DetailsPage() { const { state } = useLocation(); diff --git a/src/pages/home-page.tsx b/src/pages/home-page.tsx index bd71ece..c74a65b 100644 --- a/src/pages/home-page.tsx +++ b/src/pages/home-page.tsx @@ -13,6 +13,10 @@ import Footer from '../components/footer'; import logo from '../assets/logo_viva_viajando_transparente.jpeg' import React from 'react'; +import ReactGA from 'react-ga'; +ReactGA.initialize('G-YYECSC1FEY'); +ReactGA.pageview(window.location.pathname + window.location.search); + function HomePage() { const navigate = useNavigate(); const [posts, setPosts] = useState([]);