Skip to content

Commit

Permalink
chore: Refactor analytics.js to initialize GA with measurement ID fro…
Browse files Browse the repository at this point in the history
…m environment variable
  • Loading branch information
ppokrovskii committed May 25, 2024
1 parent 0f786aa commit efef6f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion landing/src/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const initGA = () => {
// if process.env.REACT_APP_GA_MEASUREMENT_ID variable is there then init reactga
if (process.env.REACT_APP_GA_MEASUREMENT_ID) {
ReactGA.initialize(process.env.REACT_APP_GA_MEASUREMENT_ID);
console.log('GA initialized');
} else {
console.log('GA not initialized as no measurement id');
}
Expand All @@ -22,5 +21,7 @@ export const initGA = () => {
export const logPageView = () => {
if (process.env.NODE_ENV === 'prod') {
ReactGA.send({ hitType: 'pageview', page: window.location.pathname + window.location.search });
} else {
console.log('GA page view not logged as not in prod');
}
};

0 comments on commit efef6f3

Please sign in to comment.