Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add Google Analytics [MDS-1066] #187

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/weak-ligers-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"docs": patch
---

Add Google Analytics [MDS-1066]
2 changes: 2 additions & 0 deletions docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { cookies } from "next/headers";
import "./globals.css";
import "./themes.css";
import { mergeClassnames } from "@heathmont/moon-base-tw";
import GoogleAnalytics from "@/components/GoogleAnalytics";

export const metadata = {
title: "Moon Design System",
Expand All @@ -31,6 +32,7 @@ export default async function RootLayout({
<Head>
<link rel="icon" href="/favicon.ico" sizes="any" />
</Head>
<GoogleAnalytics />
<body className={mergeClassnames(defaultTheme, "bg-goku")}>
<SearchProvider actions={actions}>
<div id="__next">{children}</div>
Expand Down
20 changes: 20 additions & 0 deletions docs/components/GoogleAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Script from "next/script";

const GoogleAnalytics = () => (
<>
<Script
src={`https://www.googletagmanager.com/gtag/js?id=G-4842W3RKZJ`}
strategy="afterInteractive"
/>
<Script id="google-analytics" strategy="afterInteractive">
{/* cSpell:disable */}
{`window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-4842W3RKZJ');`}
{/* cSpell:enable */}
</Script>
</>
);

export default GoogleAnalytics;