Skip to content

Commit

Permalink
🐛 GA 트래킹 ID 수정
Browse files Browse the repository at this point in the history
GA 트래킹 ID 수정
  • Loading branch information
JUNOSHON committed Dec 12, 2023
1 parent f24bf5a commit 21d992b
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions src/components/MonitoringInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,18 @@ 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,
});
`,
}}
/>
</>
}
</>
<div className="container">
<Script src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`} />
<Script id="google-analytics">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', ${GA_TRACKING_ID});
`}
</Script>
</div>
);
};

Expand Down

0 comments on commit 21d992b

Please sign in to comment.