Skip to content

Commit

Permalink
Merge pull request #11 from 0rbit-co/analytics-setup
Browse files Browse the repository at this point in the history
Analytics setup
  • Loading branch information
0rbitCo authored Mar 27, 2024
2 parents 4fa3303 + 626ab58 commit 7d71428
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
15 changes: 15 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import Script from "next/script";
import { Inter } from "next/font/google";
import "./globals.css";
import { Analytics } from "@vercel/analytics/react";
Expand All @@ -19,6 +20,20 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<head>
<Script
strategy="lazyOnload"
async
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GOOGLE_ANALYTICS}`}
></Script>
<Script id="google-analytics" strategy="lazyOnload">
{`window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GOOGLE_ANALYTICS}');`}
</Script>
</head>
<body className={inter.className}>
<FloatingNavDemo />
{children}
Expand Down

0 comments on commit 7d71428

Please sign in to comment.