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

Feat/monitoring setting #59

Merged
merged 7 commits into from
Dec 12, 2023
Merged
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from 'next';
import MonitoringInitializer from '@/components/MonitoringInitializer';
import { css } from '@/styled-system/css';
import { pretendardFont } from '@/styles/font';

Expand All @@ -15,6 +16,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
return (
<html lang="en" suppressHydrationWarning className={pretendardFont.variable}>
<body>
<MonitoringInitializer />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOD

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9d288c3 ์—์„œ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค!! ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค๐Ÿ™Œ๐Ÿป

<QueryProvider>
<div className={css(containerCss)}>{children}</div>
</QueryProvider>
Expand Down
2 changes: 2 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default function Home() {
<h1 className={MainTitleCss}>ํ•˜๋ฃจ 10๋ถ„์˜ ๋ณ€ํ™”๋ฅผ ๊ฒฝํ—˜ํ•˜์„ธ์š”.</h1>
</div>
<Link className={LinkCss} href={'/select'}>
{/* ์ดํ›„ ์ถ”๊ฐ€๋  ๋ฏน์ŠคํŒจ๋„ ์ด๋ฒคํŠธ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”์  */}
{/* mixpanel.track("์ด๋ฒคํŠธ๋ช…"); */}
<button type={'button'} className={LoginButtonCss}>
๊ฒŒ์ŠคํŠธ ๋กœ๊ทธ์ธ
</button>
Expand Down
31 changes: 31 additions & 0 deletions src/components/MonitoringInitializer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Script from 'next/script';

const GA_TRACKING_ID = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS;

const MonitoringInitializer = () => {
return (
<>
{
<>
<Script strategy="afterInteractive" src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`} />
<Script
id="gtag-init"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
</>
}
</>
);
};

export default MonitoringInitializer;
Loading