Skip to content

Commit

Permalink
Add google tag #51
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianMachado authored Sep 24, 2024
1 parent cefd192 commit 3dc1496
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions www/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Head, Html, Main, NextScript } from "next/document";
import Script from "next/script";

export default function Document() {
return (
Expand Down Expand Up @@ -41,6 +42,26 @@ export default function Document() {
// eslint-disable-next-line @next/next/no-sync-scripts
<script src={process.env.NEXT_PUBLIC_ANALYTICS_URL}></script>
) : null}
{process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? (
<Script
async
src="https://www.googletagmanager.com/gtag/js?id=AW-11213523037"
/>
) : null}
{process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? (
<Script
id="google-analytics"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-11213523037');
`,
}}
/>
) : null}
</Head>
<body>
<Main />
Expand Down

0 comments on commit 3dc1496

Please sign in to comment.