I\'m using responsive Google Ads on my website but unfortunately it is not working all the time and most of time it is returning
TagError: adsbygoogle.pus
I used:
window.onload = function() {
(adsbygoogle = window.adsbygoogle || []).push({});
}
My site was loading pages in a special way, making heavy use of AJAX, so it had to be this way. Hope this helps someone.
EDIT 2018: I feel like I should mention now that the preferred way to do this would be with window.addEventListener( 'load', ... )
, instead of the old method of window.onload = ...
In our case, we had problem displaying two banners but only in Chrome. First banner would not show and it would generate error:
No slot size for availableWidth=0
The second banner would be displayed OK. The problem was not happening in Safari or Firefox. Trying to fix the problem via CSS didn't help.
We solved the problem by changing the:
(adsbygoogle = window.adsbygoogle || []).push({})
to
$(document).ready(function(){(adsbygoogle = window.adsbygoogle || []).push({})})
jQuery is required for above method.
I found modifying the ins tag to remove the data-ad-format attribute solved the error for me:
<ins class="adsbygoogle adslot_1"
style="display:inline-block;"
data-ad-client="ca-pub-[MY_AD_ID]"
data-ad-slot="AD_SLOT_NOS"></ins>
I had the same problem, as there is no sidebar on the homepage and the error only appears on it I corrected by adding this on adsense elements in the sidebar
cond='data:blog.pageType == "item"'
I solved it using setTimeout as the issue is that the GA code its not picking the size of the parent on its default loading.
setTimeout(function(){(adsbygoogle = window.adsbygoogle || []).push({})}, 1000);
just add style="display:inline-block;width:100%;"
this is work for me.