Skip to content

Commit

Permalink
fix: ga tracking id 인식 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
corinthionia committed Aug 9, 2023
1 parent 7648dae commit c220088
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hooks/useGoogleAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ const useGoogleAnalytics = () => {
const location = useLocation();
const [isInitialized, setIsInitialized] = useState<boolean>(false);

const TRACKING_ID = process.env.REACT_APP_GA_TRACKING_ID;

useEffect(() => {
ReactGA.initialize(process.env.REACT_APP_GA_TRACKING_ID as string);
setIsInitialized(true);
if (TRACKING_ID) {
ReactGA.initialize(TRACKING_ID);
setIsInitialized(true);
}
}, []);

useEffect(() => {
Expand Down

0 comments on commit c220088

Please sign in to comment.