Skip to content

Commit

Permalink
added analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniocosentino committed Jul 28, 2023
1 parent 646551e commit 4b9229b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import Script from "next/script";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -17,6 +18,24 @@ export default function RootLayout({
return (
<html lang="en">
<head>
<Script
strategy="afterInteractive"
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GA_KEY}`}
/>
<Script
id="google-analytics"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GA_KEY}', {
page_path: window.location.pathname,
});
`,
}}
/>
<link
rel="apple-touch-icon"
sizes="180x180"
Expand Down

0 comments on commit 4b9229b

Please sign in to comment.