Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

Commit 22e7243

Browse files
committed
feat(analytics): Integrate Vercel Analytics and add loader component across layouts
1 parent 6491f17 commit 22e7243

File tree

7 files changed

+45
-2
lines changed

7 files changed

+45
-2
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"@emotion/react": "^11.14.0",
1313
"@emotion/styled": "^11.14.0",
1414
"@mui/material": "^7.1.1",
15+
"@vercel/analytics": "^1.5.0",
16+
"@vercel/speed-insights": "^1.2.0",
1517
"critters": "^0.0.23",
1618
"framer-motion": "^10.18.0",
1719
"http-proxy-middleware": "^3.0.5",

src/app/checkout/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Metadata } from "next";
2+
import VercelAnalyticsLoader from "@/components/layout/VercelAnalyticsLoader";
23

34
export const metadata: Metadata = {
45
title: "Finalizar Compra | FireHosting",
@@ -15,6 +16,7 @@ export default function CheckoutLayout({
1516
<section className="section-padding">
1617
<div className="container-max">{children}</div>
1718
</section>
19+
<VercelAnalyticsLoader />
1820
</div>
1921
);
2022
}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
"use client";
2+
import VercelAnalyticsLoader from "@/components/layout/VercelAnalyticsLoader";
23

34
export default function ServerAppLayout({
45
children,
56
}: {
67
children: React.ReactNode;
78
}) {
8-
return <>{children}</>;
9+
return (
10+
<>
11+
{children}
12+
<VercelAnalyticsLoader />
13+
</>
14+
);
915
}

src/app/dashboard/layout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
"use client";
22
import DashboardLayout from "@/components/dashboard/DashboardLayout";
33
import { ReactNode } from "react";
4+
import VercelAnalyticsLoader from "@/components/layout/VercelAnalyticsLoader";
45

56
export default function DashboardSectionLayout({
67
children,
78
}: {
89
children: ReactNode;
910
}) {
10-
return <DashboardLayout>{children}</DashboardLayout>;
11+
return (
12+
<>
13+
<DashboardLayout>{children}</DashboardLayout>
14+
<VercelAnalyticsLoader />
15+
</>
16+
);
1117
}

src/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ConsoleWarning from "@/components/layout/ConsoleWarning";
66
import ConditionalLayout from "@/components/layout/ConditionalLayout";
77
import ExternalScripts from "@/components/layout/ExternalScripts";
88
import UtmTracker from "@/components/tracking/UtmTracker";
9+
import VercelAnalyticsLoader from "@/components/layout/VercelAnalyticsLoader";
910

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

@@ -57,6 +58,7 @@ export default function RootLayout({
5758
<UtmTracker />
5859
<ConditionalLayout>{children}</ConditionalLayout>
5960
<ExternalScripts />
61+
<VercelAnalyticsLoader />
6062
</AuthProvider>
6163
</body>
6264
</html>

src/app/vercel-analytics.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use client";
2+
3+
import { SpeedInsights } from "@vercel/speed-insights/next";
4+
import { Analytics } from "@vercel/analytics/react";
5+
6+
export function VercelAnalytics() {
7+
return (
8+
<>
9+
<SpeedInsights />
10+
<Analytics />
11+
</>
12+
);
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use client";
2+
3+
import dynamic from "next/dynamic";
4+
5+
const VercelAnalytics = dynamic(() =>
6+
import("@/app/vercel-analytics").then((mod) => mod.VercelAnalytics),
7+
{ ssr: false }
8+
);
9+
10+
export default function VercelAnalyticsLoader() {
11+
return <VercelAnalytics />;
12+
}

0 commit comments

Comments
 (0)