Skip to content

Commit

Permalink
Google Anal ytics (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
BinarySoftware authored Jun 20, 2024
1 parent ded4703 commit e19354b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,27 @@ function Example() {
}

export default function Home() {
React.useEffect(() => {
const script1 = document.createElement('script')
script1.src = 'https://www.googletagmanager.com/gtag/js?id=G-1D6PG4T5MH'
script1.async = true
document.head.appendChild(script1)

const script2 = document.createElement('script')
script2.innerHTML = `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-1D6PG4T5MH');
`
document.head.appendChild(script2)

return () => {
document.head.removeChild(script1)
document.head.removeChild(script2)
}
}, [])

return (
<main className='relative flex min-h-screen flex-col items-center justify-between bg-page'>
<Tooltip id='tooltip' className='tooltip' classNameArrow='arrow' style={{fontSize: '12px'}} />
Expand Down

0 comments on commit e19354b

Please sign in to comment.