mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-08-17 02:10:31 +03:00
✨ set up google analytics
This commit is contained in:
parent
ef9ae86b87
commit
62511ea283
@ -4,8 +4,12 @@ NEXT_PUBLIC_SUPABASE_URL=<change-me>
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=<change-me>
|
||||
|
||||
NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY=<ignore-me-or-change-me>
|
||||
NEXT_PUBLIC_JUNE_API_KEY=<ignore-me-or-change-me>
|
||||
NEXT_PUBLIC_GROWTHBOOK_URL=<ignore-me-or-change-me>
|
||||
|
||||
NEXT_PUBLIC_JUNE_API_KEY=<ignore-me-or-change-me>
|
||||
NEXT_PUBLIC_GA_ID=<ignore-me-or-change-me>
|
||||
|
||||
NEXT_PUBLIC_E2E_URL=http://localhost:3003
|
||||
NEXT_PUBLIC_E2E_EMAIL=<ignore-me-or-change-me>
|
||||
NEXT_PUBLIC_E2E_PASSWORD=<ignore-me-or-change-me>
|
||||
NEXT_PUBLIC_E2E_PASSWORD=<ignore-me-or-change-me>
|
||||
|
||||
|
@ -7,6 +7,7 @@ import { ToastProvider } from "@/lib/components/ui/Toast";
|
||||
import { FeatureFlagsProvider } from "@/lib/context";
|
||||
import { BrainProvider } from "@/lib/context/BrainProvider";
|
||||
import { SupabaseProvider } from "@/lib/context/SupabaseProvider";
|
||||
import { GoogleAnalytics } from "@/services/analytics/google/googleAnalytics";
|
||||
|
||||
import { App } from "./App";
|
||||
import "./globals.css";
|
||||
@ -49,6 +50,7 @@ const RootLayout = async ({
|
||||
</SupabaseProvider>
|
||||
</ToastProvider>
|
||||
<Analytics />
|
||||
<GoogleAnalytics />
|
||||
</FeatureFlagsProvider>
|
||||
</body>
|
||||
</html>
|
||||
|
29
frontend/services/analytics/google/googleAnalytics.tsx
Normal file
29
frontend/services/analytics/google/googleAnalytics.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
import Script from "next/script";
|
||||
|
||||
export const GoogleAnalytics = (): JSX.Element => {
|
||||
const ga_id = process.env.NEXT_PUBLIC_GA_ID;
|
||||
|
||||
if (ga_id === undefined) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Script
|
||||
async
|
||||
src={`https://www.googletagmanager.com/gtag/js?id=${ga_id}`}
|
||||
/>
|
||||
<Script
|
||||
id="ga-config"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '${ga_id}');
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user