I'm using react in my app to show adsense ads but they don't appear. I'm using them on a HTML5 game, so there is no content on the page, just canvas.
This has been approved a few hours ago. Might be a reason?
I'm seeing this error: "TagError: adsbygoogle.push() error: Only one 'enable_page_level_ads' allowed per page., but this should not affect.
My static HTML page ending:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:1000px;height:90px"
data-ad-client="ca-pub-XXXXXXX"
data-ad-slot="XXXXXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>
My react component:
export const AdsenseBlock: React.FunctionComponent<{}> = () => {
React.useEffect(() => {
try {
(window.adsbygoogle || []).push({})
} catch (e) {
console.error(e)
}
})
return (
<ins className="adsbygoogle"
style={{'display': 'inline-block', width: '1000px', height: '90px'}}
data-ad-client="ca-pub-XXXXXXX"
data-ad-slot="XXXXXXX"></ins>
)
}
This is how th HTML looks like after I execute my code. Note how the 2nd iframe body is empty. I guess it should have something.
In adsense report I see 101 page views and 0 impressions.
How I created the ad:
Also my domain is approved, and added subdomain:
What I tried:
- sub.domain.com/ads.txt and domain.com/ads.txt contains the
google.com, pub-XXXXXXXXXXX, DIRECT, XXXXXXXXXXXX(also contain AdinPlay.com ads.txt, does this affect?) - Disabled ad blocker
- Tried in incognito and on other devices
- Ads are approved in adsense. Also added the subdomain
I also tried to create a new empty page:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-XXXX"
data-ad-slot="XXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>
but ads still not showing. I literally copy pasted the code from adsense
What else can I do?




