Merge pull request #166 from movie-web/feature-react-ga

setup GA properly
This commit is contained in:
James Hawkins 2023-02-21 20:49:23 +00:00 committed by GitHub
commit 0625719a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2002 additions and 2001 deletions

View File

@ -1,21 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-44YVXRL61C"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-44YVXRL61C");
</script>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />

View File

@ -20,6 +20,7 @@
"pako": "^2.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-ga4": "^2.0.0",
"react-helmet": "^6.1.0",
"react-i18next": "^12.1.1",
"react-router-dom": "^5.2.0",

View File

@ -5,6 +5,7 @@ import { ErrorBoundary } from "@/components/layout/ErrorBoundary";
import { conf } from "@/setup/config";
import App from "@/setup/App";
import "@/setup/ga";
import "@/setup/i18n";
import "@/setup/index.css";
import "@/backend";

View File

@ -1,3 +1,4 @@
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb";
export const GITHUB_LINK = "https://github.com/movie-web/movie-web";
export const APP_VERSION = "3.0.2";
export const GA_ID = "G-44YVXRL61C";

8
src/setup/ga.ts Normal file
View File

@ -0,0 +1,8 @@
import ReactGA from "react-ga4";
import { GA_ID } from "@/setup/constants";
ReactGA.initialize([
{
trackingId: GA_ID,
},
]);

3975
yarn.lock

File diff suppressed because it is too large Load Diff