Skip to content

Commit

Permalink
Use the analytics in prod only 📊.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarty committed Apr 20, 2024
1 parent 71c8132 commit a91ec2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,5 @@
<script
type="module"
src="index.js"></script>
<script src="https://getinsights.io/js/insights.js"></script>
<script>
insights.init('OTy7QFoUv4bUuKzo');
insights.trackPages();
</script>
</head>
</html>
10 changes: 10 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ root.render(
<App />
</BrowserRouter>,
);

if (process.env.NODE_ENV === 'production') {
// Load the analytics.
const url = 'https://getinsights.io/js/insights.js';
(async () => {
await import(url);
insights.init('OTy7QFoUv4bUuKzo');
insights.trackPages();
})();
}

0 comments on commit a91ec2e

Please sign in to comment.