tests: ad

This commit is contained in:
원더 2021-02-12 14:59:07 +09:00
parent 39d915c0ea
commit d7633fde99
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,11 @@
const Advertisement = (): JSX.Element => {
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
@ -13,4 +19,11 @@ const Advertisement = (): JSX.Element => {
}</div>
}
declare global {
interface Window { adsbygoogle: {
loaded: boolean
push(obj: unknown): void
} }
}
export default Advertisement

View File

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