AdSense Responsive Ads

@neil I would need a little hand holding with this.

On mobiles (with full HD screens or better) the responsive setting has started to increasingly show large square banners in the top banner positions. This drops the majority of the content below the fold.

I tried mocking around based on your CSS example but could not nail it. I would like to halve the top banner height, making it a large mobile banner (320x100). How could I achieve that?

1 Like

What CSS did you use, and how did you add/enable it? Which ad units are you trying to limit the height?

It should be this if you want it to be 100px height of the ad unit above the topic lists:

:warning:

This doesn’t work anymore

.adsense-topic-list-top.adsense-responsive {
  height: 100px;
}
3 Likes

Thanks, I’ll give that a try tomorrow or later this week.

Been using the responsive ads for a full year, since my earlier praise in this thread. For some reason the large square ad format has increased popularity as time went by. Originally I got the large mobile banners, but now more squares.

Thanks, I’ll report back later.

3 Likes

@neil

Now I just realized that the code you pasted above was identical to the earlier. The reason I had issues implementing was that for some reason it does not work correctly in the Chrome Inspector / Mobile mode (the ad remains square and topics flood over it), but now when I implemented it again and verified on real devices, the results look as expected.

I’ll ask my community to verify this to get some device diversity.

Update: Well, our community is the best and had already spotted layout breakage. This happens on some Android devices at least.

I can see square ads in Chrome on Android too, and sometimes banner ads. I don’t see it underneath the topic list content though… Which devices are people seeing layout problems?

Also, I don’t see the CSS to control height, which would prevent the square ads.

1 Like

Sony XZ, Honor 7 and OnePlus 5T were used by those who reported. The screen capture was taken with the Sony phone.

And you want to allow square ads, which is why you didn’t add the custom css with height?

2 Likes

@neil Once again thank you for this plugin - this single component is a make-it-or-break-it feature for our community that runs without any other funding.

I have been running AdSense banners with the Responsive setting ever since this feature was introduced to the plugin. Recently however the Responsive ads have started misbehaving – I seem to be getting larger ad units that break the intended UX (too much ad content above the fold). I also get ads that are too big for my iPhone SE – they produce a large white space on the screen unless I turn the device landscape.

I had a look at the settings and noticed that ad size is now a multi-select option. I tried searching here but I failed to find information how does this multi-select feature actually work – what ad sizes are shown and when if I choose more than one?

1 Like

If you choose multiple sizes, the ad units will alternate between them evenly. So you could alternate between banner ads and square ads in the same ad slot, for example.

As for the ad height problems you’re seeing, you can try to add height rules to the ad slots like the first post in this topic shows:

:warning:

This doesn’t work anymore!

3 Likes

BTW, I never got the responsive element size control working. Just noticed that Google has made some updates to responsive units in September.

https://support.google.com/adsense/answer/9467650?hl=fi

Max heigh/width would be an awesome addition to the plugin and make the fixed size options redundant. Perhaps something to consider for the development roadmap?

1 Like

You can already do this see the (Optional) Controlling Ad Sizes section in the first post of this topic.

1 Like

BTW, I never got the responsive element size control working

But that was not the point. I’ve tried it a number of times, but for some reason it does not work as-is (in our scenario).

The benefit would have been simplifying the Plugin settings view, which is currently quite cluttered.

I don’t know what you’re proposing, but I found this article that seems to say that responsive ads can ignore their containers now.

…responsive ad units can now resize the HTML parent container (e.g. <div> ) that they’re within. This allows them to automatically adapt to all the different ad sizes on publishers’ pages.

Note that for responsive ad units to work properly, they must not be placed inside a container with a fixed or limited height.

Cool. :frowning:

If you want to limit the height of your responsive ads, you’ll need to modify your responsive ad code…

<ins class="adsbygoogle" style="display:inline-block;min-width:400px;max-width:970px;width:100%;height:90px"

So do the same thing as the way it worked before with containers and css, but do it with inline styles instead to let Google “automatically adapt to all the different ad sizes” whatever that means.

BUT their examples show that using CSS should still work: @ljpp see this article:

https://support.google.com/adsense/answer/9183363

Are you sure you haven’t tried using CSS to control the max width/height of the responsive units? The two articles contradict each other, so maybe their examples are obsolete.

2 Likes


Getting the word advertisement, but there is no ad.

1 Like

Why do I only get the word advertisement where an ad should be? This is my config

Hi, I’m posting this to try to get some feedback on a recurrent and most annoying issue with ads:

When in mobile, it is frequent that the posts “jump” up or down (lacking a better description) even after everything in the page is loaded, being really really hard to read certain posts due to this involuntary vertical scrolling. The screen doesn’t stay still at the post, it jumps whenever one tries to put it in front again. I say this is because of ads since when they’re not there then the issue goes away. I have everything configured as it should, with responsive ads on discourse corresponding to responsive ad-codes on Adsense.

Does anyone recognize this behavior?
Could it be related to Adsense trying to “decide” the height of the ads the whole time?

1 Like

Replying to my own post, after searching for a while I stumbled across this post where the same behavior is described:

The jittery on mobile seems to be exclusively related to the option to placed ads every nth post. Putting this to zero does in fact stop the problem, but it would be much nicer if the plugin authors could fix the issue instead.

2 Likes

The UI proposal is to add max size parameters to the Discourse settings UI, instead of the current selection menu where you have a handful of fixed sizes available. Would de-clutter the UI, as responsive would be the default, with the possibility to limit the height.

Are you sure you haven’t tried using CSS

I suck at CSS, but to my knowledge it has been tried a number of times. Currently working around the issue by using a fixed size for mobile layout.

I think I understand this. So what we would end up with is this:

The big problem with responsive ads currently is that it causing jumping in the page layout, which is horrible within a topic while you’re trying to read. I’ll try adding these new settings to see if it prevents the jumping, but I have my doubts about max height helping because a smaller add will cause the placements to shrink.

1 Like

@ljpp I implemented what you suggested, and it simply doesn’t work. Not even a little bit.

I followed this article to try to implement something like the example. See this result, where I’ve included some debugging to show what the ins element’s inline-style attribute contains when the adplugin renders it:

Here are my settings:

Notice the final result after AdSense has finished its work has a fixed height of 280px, replacing the 90px that the initial ins style had. And AdSense didn’t even find an ad to show, but decided to make the div bigger anyway. :man_facepalming:

And anyway, these new settings don’t streamline the AdSense settings, they add a lot more that are even more confusing and don’t actually let you control the sizes with the new way that responsive ads work.

8 Likes