Sunday, March 5, 2017

AdSense Responsive Ads Not Showing No Slot Size for Availablewidth

How to fix AdsSense responsive problems without modifying AdSense code. AdSense Responsive adapts to device sizes to display ads properly. The size of the ad will automatically adapt to smartphones browsers, tablets and any web site. But making these ads work need some implementation or you may get the no slot size for available with Javascript error, or just not seeing any ad all.

But, do not edit the inside AdSense Javascript code at all, do not add any custom css style to it or modify the tags, just take your code from AdSense unit as is and copy and paste it in your web site. It will look like this:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="xxx"
     data-ad-slot="xxx"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


Before copying into your web site you need to create a div that will act as a parent container:

<div style="width: 300px; height: auto">
<!-- Copy AdSense code here -->
</div>


That will display an ad with a maximum width of 300 pixels and any available height. If you only want to display ads with limited maximum width and height, let´s say you want a 300 x 250 rectangular box, then your code should look like this:

<div style="width: 300px; height: 250px">
<!-- Copy AdSense code here -->
</div>


This will display any ads with 300 x 250 pixels and any other available smaller size ad adapted to smartphones, tablets and any other device.