Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OchiengPaul442 committed Feb 24, 2025
1 parent 3ab722a commit f89debe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions website2/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import './globals.css';

import dynamic from 'next/dynamic';
import localFont from 'next/font/local';
import { ReactNode, Suspense } from 'react';

import EngagementDialog from '@/components/dialogs/EngagementDialog';
import GoogleAnalytics from '@/components/GoogleAnalytics';
import Loading from '@/components/loading';
import { ErrorBoundary } from '@/components/ui';
import { ReduxDataProvider } from '@/context/ReduxDataProvider';
import { checkMaintenance } from '@/lib/maintenance';

import MaintenancePage from './MaintenancePage';

// Load the GA component dynamically, disabling SSR so that it runs only on the client.
const GoogleAnalytics = dynamic(() => import('@/components/GoogleAnalytics'), {
ssr: false,
});

const interFont = localFont({
src: [
{
Expand Down Expand Up @@ -54,8 +59,10 @@ export default async function RootLayout({
</ReduxDataProvider>
</ErrorBoundary>

{/* Initialize & Track Google Analytics */}
<GoogleAnalytics measurementId={GA_MEASUREMENT_ID} />
{/* Initialize & Track Google Analytics only on the client */}
{GA_MEASUREMENT_ID && (
<GoogleAnalytics measurementId={GA_MEASUREMENT_ID} />
)}
</body>
</html>
);
Expand Down

0 comments on commit f89debe

Please sign in to comment.