feat(frontend): setup DataFast analytics (#11182)

## Changes 🏗️

Following https://datafa.st/docs/nextjs-app-router

## Checklist 📋

### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] We will see once we make a production deployment and get data into
the platform

### For configuration changes:

None
This commit is contained in:
Ubbe
2025-10-20 16:18:04 +04:00
committed by GitHub
parent 3988057032
commit 271a520afa

View File

@@ -11,6 +11,8 @@ import { Toaster } from "@/components/molecules/Toast/toaster";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { Analytics } from "@vercel/analytics/next";
import { headers } from "next/headers";
import Script from "next/script";
export const metadata: Metadata = {
title: "AutoGPT Platform",
@@ -22,6 +24,9 @@ export default async function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
const headersList = await headers();
const host = headersList.get("host") || "";
const isPlatformDomain = host === "platform.agpt.co";
return (
<html
lang="en"
@@ -32,6 +37,14 @@ export default async function RootLayout({
<GoogleAnalytics
gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID || "G-FH2XK2W4GN"} // This is the measurement Id for the Google Analytics dev project
/>
{isPlatformDomain && (
<Script
strategy="afterInteractive"
data-website-id="dfid_g5wtBIiHUwSkWKcGz80lu"
data-domain="agpt.co"
src="https://datafa.st/js/script.js"
/>
)}
</head>
<body>
<Providers