diff --git a/package-lock.json b/package-lock.json index c0c6d69..f176e9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "nookies": "^2.5.2", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-ga": "^3.3.1", + "react-ga4": "^2.1.0", "sass": "^1.77.8", "skeleton-css": "^2.0.4", "socket.io": "^4.7.5", @@ -1582,17 +1582,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "peer": true, - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -1670,20 +1659,11 @@ "react": "^18.3.1" } }, - "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-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "peer": true + "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==", + "license": "MIT" }, "node_modules/readdirp": { "version": "3.6.0", diff --git a/package.json b/package.json index 274f40f..a25576d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "nookies": "^2.5.2", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-ga": "^3.3.1", + "react-ga4": "^2.1.0", "sass": "^1.77.8", "skeleton-css": "^2.0.4", "socket.io": "^4.7.5", diff --git a/utils/analytics.js b/utils/analytics.js index 0175099..d4ea8d2 100644 --- a/utils/analytics.js +++ b/utils/analytics.js @@ -1,12 +1,14 @@ -import ReactGA from "react-ga"; +import ReactGA from "react-ga4"; export const initGA = () => { - ReactGA.initialize("UA-82444397-11"); + ReactGA.initialize("G-1VH05G01VY"); }; export const logPageView = () => { ReactGA.set({ page: window.location.pathname }); - ReactGA.pageview(window.location.pathname); + ReactGA.send({ + hitType: "pageview", + }); }; export const logEvent = (category = "", action = "") => { @@ -17,6 +19,7 @@ export const logEvent = (category = "", action = "") => { export const logException = (description = "", fatal = false) => { if (description) { - ReactGA.exception({ description, fatal }); + // https://github.com/codler/react-ga4/issues/40 + // ReactGA.exception({ description, fatal }); } };