diff --git a/.env.template b/.env.template index 786dc76..79173a7 100644 --- a/.env.template +++ b/.env.template @@ -4,4 +4,5 @@ VITE_REMOTE_HEADER_MENU_ID=23 VITE_REMOTE_FOOTER_MENU_ID=24 VITE_REMOTE_SOCIAL_LINKS_ID=26 VITE_LOCATION_API_URL=https://www.ucf.edu/wp-json/wp/v2/locations/ -VITE_BASEURL= /map/ +VITE_BASEURL=/map/ +VITE_REACTGA_MEASUREMENT_ID=G-DFCVBKX579 diff --git a/index.html b/index.html index 37b0c49..fd42c4f 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,6 @@ - - - diff --git a/package-lock.json b/package-lock.json index e09e9b7..e262151 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", + "react-ga4": "^2.1.0", "togeojson": "^0.16.0", "typescript": "^5.2.2", "vite": "^5.2.0" @@ -3434,6 +3435,12 @@ "react": "^18.3.1" } }, + "node_modules/react-ga4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-ga4/-/react-ga4-2.1.0.tgz", + "integrity": "sha512-ZKS7PGNFqqMd3PJ6+C2Jtz/o1iU9ggiy8Y8nUeksgVuvNISbmrQtJiZNvC/TjDsqD0QlU5Wkgs7i+w9+OjHhhQ==", + "dev": true + }, "node_modules/react-map-gl": { "version": "7.1.7", "resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-7.1.7.tgz", diff --git a/package.json b/package.json index 020a21a..c8b6ec4 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", + "react-ga4": "^2.1.0", "togeojson": "^0.16.0", "typescript": "^5.2.2", "vite": "^5.2.0" diff --git a/public/favicon.png b/public/favicon.png new file mode 100755 index 0000000..65c1402 Binary files /dev/null and b/public/favicon.png differ diff --git a/public/vite.svg b/public/vite.svg new file mode 100755 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 8e300be..4147424 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,5 @@ import './App.scss' +import ReactGA from "react-ga4" // React Imports import { useEffect, useMemo, useRef, useState } from 'react' @@ -71,8 +72,15 @@ import campusData from './assets/campuses.json'; const TOKEN = import.meta.env.VITE_MAPBOX_TOKEN; const FOOTER_MENU_ID = import.meta.env.VITE_REMOTE_FOOTER_MENU_ID; const FOOTER_SOCIAL_ID = import.meta.env.VITE_REMOTE_SOCIAL_LINKS_ID; +const REACT_MEASUREMENT_ID = import.meta.env.VITE_REACTGA_MEASUREMENT_ID; function App() { + ReactGA.initialize(REACT_MEASUREMENT_ID); + + // Send pageview with a custom path + ReactGA.send({ hitType: "pageview", page: "/", title: "UCF Campus Map" }); + + const initialLng = -81.200142; const intitalLat = 28.602368; const initialZoom = 15;