I’m aware that this problem may be due to AdRotate and not Newspaper, but I’m posting it here in case anyone ran into a similar problem.
I have several custom ads along with one responsive AdSense unit all together in an AdRotate group.
The group is placed through Newspaper theme panel into ‘Header’ location, with default options for AdSense.
On desktop, all ads work as expected.
On mobile, the AdSense unit will not show up no matter what. Its code is in the source, but all of its parent elements have a height of 0.
When I add the AdSense unit there manually (not through AdRotate group – just pasting the code in the panel box or in AdRotate code box) it works.
So I believe there is a problem with the way mobile ads are sized. I have contacted the AdRotate author as well. Any ideas?
Hello,
Please make sure the ad is not disabled from mobiles in the theme panel: https://www.screencast.com/t/8uzbMH4ibux
Thank you!
No, it’s enabled, and it doesn’t matter if I set the dimensions there or leave them on ‘Auto’.
The problem is with responsive AdSense units only and only those that are in AdRotate groups (well, almost all of them should be in groups anyway). If I place a fixed-size AdSense unit in a group, it works. Somehow the responsive unit doesn’t get the information how big it should be so the code is there, but the size of its containers gets set to zero height. Or something like that.
Hi,
The header ad seems to be displayed at the moment
– https://www.screencast.com/t/cdLCgM2UZiX4
This ad is displayed – https://www.screencast.com/t/bDyRJWdsJZ
I refreshed the page a few times, the ad disappeared but it seems to try to display a different ad
– https://www.screencast.com/t/bNRgk7TqK
Maybe double check the ad codes to be valid, and the plugin documentation
– https://ajdg.solutions/manuals/adrotate-manuals/
Thanks
Non-AdSense ads are displayed properly. When no ad is shown, AdRotate tries to display the AdSense responsive unit, but fails every time. It’s the same for any other ad location on the site. Fixed-size AdSense works fine. Responsive AdSense units work only if they’re not in groups.
I have tried placing separate AdSense units for desktop and mobile in the same group, but that doesn’t work either. I believe there’s something in the code that blocks them from rendering even though they are properly loaded in the source, but can’t figure out what it is.
Might not help, but I found in one instance with responsive AdSense units that it only served up proper sizes when I wrapped it into a div with a size class like 100%, or when inside a post layout adding a ‘max width’ as well to the class.
e.g.,
<div class="mybanbox">
--- normal adsense code here ---
</div>
You might try that — might be unrelated to your issue. But ran into that when trying to put full width banner “above” the top menu on one site to run full width.
ALSO: make sure you are not using some kind of minification option which might strip out commented code or inline javascript, etc. as that can also break AdSense ads by crunching the wrong thing.
AND: if you have recently clicked ‘don’t show me this type of ad’ on your own site, you may see empty ad units for a while. Incognito mode in Chrome might help there, maybe not.
OK, I have managed to come up with something. I noticed that the AdSense script set “display: none” for itself, so I figured that the problem might be with AdSense after all.
Then I modified the responsive unit’s code by specifying expandable width and min-height, per instructions described here: https://support.google.com/adsense/answer/6307124
And it worked!
I’ll keep looking into this to see if it works everywhere and in all situations, but it’s a decent first step for now.
NOTE: I used the following settings for the header ad:
style="display:block;min-width:320px;max-width:768px;width:100%;min-height:90px"
You’ll of course probably want to modify the numbers for your needs. Fiddle around with it.
Thanks. This is just a rough first try, a patch until something more elegant comes along.
I’ll keep messing with it.