From ddef05d41842435034d4386c783d683ca43f0394 Mon Sep 17 00:00:00 2001 From: wonderlandpark Date: Mon, 31 May 2021 11:35:50 +0900 Subject: [PATCH] chore: ads improved --- components/Advertisement.tsx | 23 +++++++++++++++-------- pages/_document.tsx | 6 +----- pages/bots/[id]/index.tsx | 11 +++++++---- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/components/Advertisement.tsx b/components/Advertisement.tsx index d770ecb..f3c7f71 100644 --- a/components/Advertisement.tsx +++ b/components/Advertisement.tsx @@ -5,12 +5,18 @@ const Advertisement: React.FC = ({ size = 'short' }) => { useEffect(() => { if (process.env.NODE_ENV === 'production') { window.adsbygoogle = window.adsbygoogle || [] - window.adsbygoogle.push({}) + try { + window.adsbygoogle.push({}) + Logger.debug('Ad Pushed') + } + catch { + Logger.debug('Ad Push Fail') + } } - Logger.debug('Ads Pushed') + }, []) - return ( + return
= ({ size = 'short' }) => { > {process.env.NODE_ENV === 'production' ? ( + data-adtest='on' + /> ) : ( 'Advertisement' )}
- ) +
} declare global { diff --git a/pages/_document.tsx b/pages/_document.tsx index 950ea75..c6f74fa 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -53,11 +53,7 @@ class MyDocument extends Document { {/* SCRIPT */} - +