Skip to content

Commit

Permalink
fix: add Google Analytics initialization and tag manager script
Browse files Browse the repository at this point in the history
  • Loading branch information
HamburgJ committed Dec 31, 2024
1 parent aabfbdf commit 259f590
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">

<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=%REACT_APP_GA_ID%"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '%REACT_APP_GA_ID%');
</script>

<title>Match Five</title>
</head>
<body>
Expand Down
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { initGA } from './utils/analytics';

// Initialize Google Analytics
initGA();

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
Expand Down

0 comments on commit 259f590

Please sign in to comment.