How do you work with google adsense responsive blocks on a responsive website layout? Consider this simple case (written using bootstrap):
<div class="container">
<div class="row">
<div class="col-sm-4 col-md-3">Menu</div>
<div class="col-sm-8 col-md-6">Content</div>
<div class="col-md-3 hidden-sm hidden-xs">Column with Adsense</div>
</div>
</div>
So, we have 3 column layouts for the big screen and only two columns for the small one. The right column is not very important, so we just hide it, it includes an AdSense response unit, and we also hide it.
If we open this page on a small screen, we will receive an error message TagError: adsbygoogle.push() error: No slot size for availableWidth=0. How to avoid this?
Ideally, I would like to reinitialize the adsense blocks if window resizing (open on a small screen and then enlarged so that the third column is visible should initiate adsense initialization in the column that appears), but I believe that this is not possible now.
I tried to place adsense in a container with a fixed size (which lives inside the hidden-xs block), it does not work, an error appears in any case.
I also tried to add a response class to <ins class="adsbygoogle hidden-xs">...</ins>, but it also does not remove the error.
source
share