Skip to content

Commit

Permalink
chore: 분석 툴인 clarity 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hjy0951 committed Sep 13, 2024
1 parent 9e58ad4 commit 60a5009
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/analyzers/clarity.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Script from 'next/script';

export const Clarity = () => {
if (process.env.NODE_ENV !== 'production') return null;

return (
<Script id="clarity" type="text/javascript">
{`
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "o2k3nk4cvl");
`}
</Script>
);
};
1 change: 1 addition & 0 deletions app/analyzers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './clarity';
4 changes: 4 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import MetaTagImage from '@/public/images/meta-tag.png';
import { css } from '@/styled-system/css';
import { pretendard } from '@/styles/font';

import { Clarity } from './analyzers';
import ReactQueryProvider from './providers/ReactQueryProvider';

export const metadata: Metadata = {
Expand Down Expand Up @@ -62,6 +63,9 @@ export default function RootLayout({
}>) {
return (
<html lang="ko" className={pretendard.className}>
<head>
<Clarity />
</head>
<body className={rootStyle}>
<ReactQueryProvider>
<ReactQueryDevtools initialIsOpen={true} />
Expand Down

0 comments on commit 60a5009

Please sign in to comment.