feat(analytics): Add Firebase Analytics integration with page tracking
- Initialize Firebase Analytics with configuration and client-side setup - Create GoogleAnalytics component to track page views on route changes - Add analytics utility functions for tracking custom events (button clicks, form submissions, link clicks, searches) - Integrate GoogleAnalytics component into home, not-found, and marketing layouts with Suspense boundary - Add firebase dependency to package.json - Enable automatic page view tracking with pathname and search parameters
This commit is contained in:
@@ -2,6 +2,8 @@ import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import { ToastContainer, Zoom } from "react-toastify";
|
||||
import "../globals.css";
|
||||
import { Suspense } from "react";
|
||||
import GoogleAnalytics from "../_components/GoogleAnalytics";
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
@@ -43,6 +45,10 @@ export default async function RootLayout({
|
||||
pauseOnHover
|
||||
/>
|
||||
|
||||
<Suspense>
|
||||
<GoogleAnalytics />
|
||||
</Suspense>
|
||||
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user