Skip to content

Commit 24a26a3

Browse files
committed
ga
1 parent 17f511a commit 24a26a3

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

apps/www/src/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { siteConfig } from '@/config/site';
1313
import { fontSans } from '@/lib/fonts';
1414

1515
import '@/styles/globals.css';
16+
import { GA } from '@/components/analytics/ga';
1617

1718
export const metadata: Metadata = {
1819
authors: [
@@ -103,6 +104,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
103104
</Providers>
104105
<TailwindIndicator />
105106

107+
<GA />
106108
<Toaster />
107109
</body>
108110
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { FC } from 'react';
2+
3+
import { GoogleAnalytics } from '@next/third-parties/google';
4+
5+
export const GA: FC = () => {
6+
if (!process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID) {
7+
return null;
8+
}
9+
10+
return <GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID} />;
11+
};

turbo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"env": [
1212
"COMPONENTS_BASE_URL",
1313
"NEXT_PUBLIC_APP_URL",
14+
"NEXT_PUBLIC_GA_MEASUREMENT_ID",
1415
"NODE_ENV",
1516
"npm_config_user_agent",
1617
"https_proxy"

0 commit comments

Comments
 (0)