From abcfba3d6f9a707b9678e1732eb4d63be1dcabea Mon Sep 17 00:00:00 2001 From: ppapman <48434316+ppapman1@users.noreply.github.com> Date: Sun, 19 Feb 2023 15:11:36 +0900 Subject: [PATCH] chore: migrato UA to GA4, cleanup lib --- .github/workflows/deploy.yml | 2 +- package.json | 6 +----- src/routes/LevelPage.jsx | 9 ++++----- src/usePageTracking.js | 5 ++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 636690f0..e6e9bb89 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,7 +29,7 @@ jobs: - name: Install dependencies run: yarn - name: Build - run: VITE_API_BASE_URL=https://adofai.gg:9200 VITE_UA_NUMBER='UA-181311513-1' yarn build + run: VITE_API_BASE_URL=https://adofai.gg:9200 VITE_UA_NUMBER='UA-181311513-1' VITE_GA_NUMBER='G-3BKXMVNJYQ' yarn build - name: Zip output run: cd dist && zip -r ../dist.zip . && cd .. - name: Upload artifact diff --git a/package.json b/package.json index 5c32bd1c..367d93da 100644 --- a/package.json +++ b/package.json @@ -16,19 +16,15 @@ "framer-motion": "^6.2.8", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-ga": "^3.3.0", + "react-ga4": "^2.0.0", "react-infinite-scroll-component": "^6.1.0", "react-loading-skeleton": "^2.2.0", "react-markdown": "^6.0.3", - "react-meta-tags": "^1.0.1", "react-router-dom": "^5.2.0", "react-scripts": "^5.0.0", "react-select": "^5.2.2", - "react-simple-infinite-loading": "^1.1.0", "react-toastify": "^8.1.1", "react-tooltip": "^4.2.21", - "react-transition-group": "^4.4.2", - "react-virtualized": "^9.22.3", "react-virtuoso": "^2.8.0", "styled-components": "^5.3.3", "sweetalert2": "^11.0.18", diff --git a/src/routes/LevelPage.jsx b/src/routes/LevelPage.jsx index bb2dc2d8..4e1220a5 100644 --- a/src/routes/LevelPage.jsx +++ b/src/routes/LevelPage.jsx @@ -71,8 +71,8 @@ const LevelPage = ({ history }) => { title: 'Photosensitive Content Included', html: ( <> - This level includes flashing imagery and this might - trigger photosensitive epilepsy. + This level includes flashing imagery and this might trigger + photosensitive epilepsy.

To prevent this, play this level in a well-lit room, and don't play @@ -92,8 +92,7 @@ const LevelPage = ({ history }) => { title: 'NSFW Content Included', html: ( <> - This level includes{' '} - NSFW (sexual or gore) content. + This level includes NSFW (sexual or gore) content.

If you don't want to see NSFW content included in this level, @@ -441,7 +440,7 @@ const LevelPage = ({ history }) => { src={`https://www.youtube.com/embed/${state.level.youtubeId}`} title='YouTube video player' frameBorder='0' - // allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen" + allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen;' /> diff --git a/src/usePageTracking.js b/src/usePageTracking.js index 3fcf1571..549588b2 100644 --- a/src/usePageTracking.js +++ b/src/usePageTracking.js @@ -1,20 +1,19 @@ import { useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; -import ReactGA from 'react-ga'; +import ReactGA from 'react-ga4'; const usePageTracking = () => { const location = useLocation(); const [initialized, setInitialized] = useState(false); useEffect(() => { - ReactGA.initialize(`${import.meta.env.VITE_UA_NUMBER}`); + ReactGA.initialize(`${import.meta.env.VITE_GA_NUMBER}`); setInitialized(true); }, []); useEffect(() => { if (initialized) { ReactGA.set({ page: location.pathname }); - ReactGA.pageview(location.pathname); } }, [initialized, location]); };