Browse Source

Merge pull request #942 from qtchaos/google-analytics

Make Google Analytics configurable with VITE_GA_ID
pull/943/head
William Oldham 1 year ago committed by GitHub
parent
commit
c1731fdbc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      src/setup/constants.ts
  2. 12
      src/setup/ga.ts

2
src/setup/constants.ts

@ -2,5 +2,5 @@ export const APP_VERSION = import.meta.env.PACKAGE_VERSION; @@ -2,5 +2,5 @@ export const APP_VERSION = import.meta.env.PACKAGE_VERSION;
export const DISCORD_LINK = "https://discord.gg/gQYB6fGArX";
export const GITHUB_LINK = "https://github.com/movie-web/movie-web";
export const DONATION_LINK = "https://ko-fi.com/movieweb";
export const GA_ID = "G-44YVXRL61C";
export const GA_ID = import.meta.env.VITE_GA_ID;
export const BACKEND_URL = import.meta.env.VITE_BACKEND_URL;

12
src/setup/ga.ts

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

Loading…
Cancel
Save