fix: ad script

This commit is contained in:
원더 2021-02-12 09:55:51 +09:00
parent 207d6ec785
commit 12ea06b57d
2 changed files with 2 additions and 13 deletions

View File

@ -1,10 +1,5 @@
import { useEffect } from 'react'
const Advertisement = (): JSX.Element => {
useEffect(() => {
if(process.env.NODE_ENV === 'production') window.adsbygoogle.push({})
})
return <div className={`z-0 mx-auto w-full text-center text-white ${process.env.NODE_ENV === 'production' ? '' : 'py-12 bg-gray-700'}`} style={{ height: '90px' }}>
{
process.env.NODE_ENV === 'production' ? <ins
@ -18,11 +13,4 @@ const Advertisement = (): JSX.Element => {
}</div>
}
declare global {
interface Window { adsbygoogle: {
loaded: boolean
push(obj: unknown): void
} }
}
export default Advertisement

View File

@ -22,6 +22,7 @@ class MyDocument extends Document {
<script
dangerouslySetInnerHTML={{
__html: `
(adsbygoogle = window.adsbygoogle || []).push({})
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());