Skip to content

Commit

Permalink
Ensure analytics run only once
Browse files Browse the repository at this point in the history
* We get absurdly high hits on single page
  • Loading branch information
vjspranav committed Apr 9, 2024
1 parent b0a8b1e commit 239ea54
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ function App() {
}
});

if (base_url === "http://stagb.in" || base_url === "https://stagb.in") {
const TRACKING_ID = "UA-195260575-1"; // YOUR_OWN_TRACKING_ID
ReactGA.initialize(TRACKING_ID);
ReactGA.pageview(window.location.pathname + window.location.search);
} else if (base_url === "http://test.stagb.in") {
pageDown = false;
}
useEffect(() => {
if (base_url === "http://stagb.in" || base_url === "https://stagb.in") {
const TRACKING_ID = "UA-195260575-1"; // YOUR_OWN_TRACKING_ID
ReactGA.initialize(TRACKING_ID);
ReactGA.pageview(window.location.pathname + window.location.search);
} else if (base_url === "http://test.stagb.in") {
pageDown = false;
}
}, []);

const patch_save = async (
data,
Expand Down

0 comments on commit 239ea54

Please sign in to comment.