css - Adsense Responsive not always displayed -
yup, 1 problem google adsense , responsive ads. added total of 3 ads site, 2 'horizontal' , 1 'auto'.
created css classes them since adsense couldn't figure out width.
.adsidebar { margin: auto; max-height: 600px; width: 302px; } .adcontent { margin: auto; width: 300px; @media #{$small-break} { width: 320px; } @media #{$large-break} { width: 730px; } }
ads included using these classes.
<div class="adcontainer"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle adcontent" style="display:block" data-ad-client="ca-pub-123456789" data-ad-slot="987654321" data-ad-format="horizontal"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script> </div>
about 50% of time 3 ads displayed correctly. however, in other cases, 1 or 2 , missing, three. error message:
tagerror: adsbygoogle.push() error: no slot size availablewidth=0
but when @ ins-element that's not being displayed firebug shows me fixed width planned.
anybody have idea issue? if want take yourself, website www.kfc-uerdingen.de
p.s.: treid contacting adsense since account new , doesn't show constant revenue yet, won't let email them. support forum worse.
i think these 3 steps can solve problem;
first, uses measure of minimum width of adsense mobile in css:
.adsidebar { margin: auto; max-height: 600px; width: 320px; /*width: 302px;*/ } .adcontent { margin: auto; width: 320px; /*width: 300px;*/ @media #{$small-break} { width: 320px; } @media #{$large-break} { width: 730px; } }
second, load initialization script once on "head" block, not in every "ins" block:
<head> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> </head>
third, load blocks using jquery @ end of page load:
<script> $(document).ready(function(){ $('ins').each(function(){ (adsbygoogle = window.adsbygoogle || []).push({}); }); }); </script>
i hope problem.
Comments
Post a Comment