Remove extra pageView hit

This commit is contained in:
Seth Call 2025-03-24 23:06:45 -05:00
parent a525082f26
commit cfe0129a6d
4 changed files with 2 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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