Skip to content

Commit

Permalink
[feat] 광고와 통계용 헤더 스크립트 생성 #458
Browse files Browse the repository at this point in the history
  • Loading branch information
triplecheeseburger committed Aug 10, 2023
1 parent d2d0cc2 commit e5b501e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,30 @@ import React from 'react';
export default function Document() {
return (
<Html lang='en'>
<Head />
<Head>
<script
async
src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5861134754944224'
crossOrigin='anonymous'
></script>
<script
async
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA_ID}`}
></script>
<script
async
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_GA_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
</Head>
<body>
<Main />
<NextScript />
Expand Down

0 comments on commit e5b501e

Please sign in to comment.