Remove extra pageView hit

This commit is contained in:
Seth Call 2025-03-24 23:06:45 -05:00 committed by Nuwan
parent 8519b56c5a
commit 4c95ad58ac
4 changed files with 2 additions and 5 deletions

View File

@ -25,7 +25,7 @@ const ArtistTemplatePage = ({ original_artist_slug, artist, songs}) => {
useEffect(() => {
initGA();
logPageView(window.location.pathname + window.location.search);
//logPageView(window.location.pathname + window.location.search);
//see if there is affiliate in query string and save it as cookie
const urlParams = new URLSearchParams(window.location.search);
const affiliate = urlParams.get('affiliate');

View File

@ -27,7 +27,7 @@ const TemplatePage = ({ id, plan_code, slug, artist, song, location}) => {
useEffect(() => {
initGA();
logPageView( window.location.pathname + window.location.search);
//logPageView( window.location.pathname + window.location.search);
//see if there is affiliate in query string and save it as cookie
const urlParams = new URLSearchParams(window.location.search);

View File

@ -10,7 +10,6 @@ const AnalyticsTracker = () => {
initGA();
}, []);
useEffect(() => {
console.log("Logging page view for", location.pathname + location.search);
logPageView(location.pathname + location.search);
}, [location]);

View File

@ -3,9 +3,7 @@ import ReactGA from "react-ga4";
var initialized = false;
export const initGA = () => {
console.log("init GA");
if(process.env.REACT_APP_GOOGLE_ANALYTICS_ID) {
console.log("initialized GA with ", process.env.REACT_APP_GOOGLE_ANALYTICS_ID);
ReactGA.initialize(process.env.REACT_APP_GOOGLE_ANALYTICS_ID);
initialized = true;
}