Remove extra pageView hit
This commit is contained in:
parent
8519b56c5a
commit
4c95ad58ac
|
|
@ -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');
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue