Skip to content

Commit

Permalink
fdas
Browse files Browse the repository at this point in the history
  • Loading branch information
neerajrekwar committed Aug 7, 2024
1 parent 6f297b1 commit 53f9170
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
9 changes: 9 additions & 0 deletions app/components/GoogleAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { GoogleAnalytics as GoogleAnalyticsLib } from "@next/third-parties/google";

interface GoogleAnalyticsProps {
gaId: string;
}

export default function GoogleAnalytics({ gaId }: GoogleAnalyticsProps) {
return <GoogleAnalyticsLib gaId={gaId} />;
}
13 changes: 7 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Alata, Source_Code_Pro, DM_Sans } from "next/font/google";
import { GoogleTagManager, GoogleAnalytics } from "@next/third-parties/google";
import { GoogleTagManager } from "@next/third-parties/google";
import "./globals.css";
import "./add.css";
import { FloatingNavDemo } from "./components/floatingNavBar";
import { ThemeProvider } from "./context/ThemeContext";
import Footer from "./components/footer";
import Script from "next/script"
import GoogleAnalytics from './components/GoogleAnalytics';

const dm_Sans = DM_Sans({
weight: "400",
Expand All @@ -24,14 +25,14 @@ export default function RootLayout({
}>) {
return (
<html lang="en" className="scroll-smooth bg-primary focus:scroll-auto">

<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID as string}

<body className={dm_Sans.className}>
<FloatingNavDemo />
<GoogleAnalytics
gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID as string}
/>
<GoogleTagManager
gtmId={process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID as string}
/>
<body className={dm_Sans.className}>
<FloatingNavDemo />
<ThemeProvider>{children}</ThemeProvider>

<Footer />
Expand Down
4 changes: 3 additions & 1 deletion lib/gtag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@


export const GA_ID = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID || '';

export const GTM_ID = 'GTM-MV76385';
export const GTM_ID = process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID || '';

export const existsGaId = GA_ID !== ''
type ClickEvent = {
Expand Down

0 comments on commit 53f9170

Please sign in to comment.