Reputation: 4405
I need to add 3 ads in a page. I have created those ads in AdSense console, then, I added this code once in the page, before </head>
:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7744644029571866"
crossorigin="anonymous"></script>
At the end of the page, I added:
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Finally, inside the DIV's where I need the ads to appear, I added:
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-client"
data-ad-slot="myslot"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
After that, when I load the page, these errors are shown in browser console:
How can I solve this?
Upvotes: 0
Views: 463
Reputation: 13
In very top of Head of HTML Add
<style>
.adsbygoogle {position:relative;width:100%;}
</style>
or Manually Define Adsize by acceptable Admodification
<style>
.example_responsive_1 { width: 300px; height: 250px; }
@media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 60px; } }
@media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 90px; } }
</style>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXX" crossorigin="anonymous"></script>
<!-- example_responsive_1 -->
<ins class="adsbygoogle example_responsive_1"
style="display:inline-block"
data-ad-client="ca-pub-XXX"
data-ad-slot="YYYY"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Upvotes: 0