Skip to content

Commit 23820b2

Browse files
committed
fix: use auto ads instead of manual ads for anchor ad mobile
1 parent b1b6c0a commit 23820b2

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

docs/src/theme/Footer/index.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,16 @@ export default function FooterWrapper(props) {
1313
scriptElement.onload = () => {
1414
if (typeof window !== 'undefined') {
1515
window.onload = () => {
16-
;(window.adsbygoogle = window.adsbygoogle || []).push({})
16+
if (window.document.body.clientWidth <= 768) {
17+
;(window.adsbygoogle = window.adsbygoogle || []).push({
18+
google_ad_client: 'ca-pub-7420210265158247',
19+
enable_page_level_ads: true,
20+
overlays: { bottom: true },
21+
})
22+
}
1723
}
1824
}
1925
}
20-
document.body.appendChild(scriptElement)
21-
22-
if (window.document.body.clientWidth <= 768) {
23-
const adsElement = document.createElement('ins')
24-
adsElement.classList.add('adsbygoogle')
25-
adsElement.classList.add('adsanchor')
26-
adsElement.setAttribute('ad-client', 'ca-pub-7420210265158247')
27-
adsElement.setAttribute('ad-slot', '8159529807')
28-
adsElement.setAttribute('full-width-responsive', 'true')
29-
document.body.appendChild(adsElement)
30-
}
3126
}
3227
}, [])
3328

0 commit comments

Comments
 (0)