AdSense Responsive Ads

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

Since the problem seems to be with the “responsive” settings, I tried this: Limiting the mobile bottom ad sizes (which is also the code use for the nth post ad, I think) to the two mobile formats available (320 width) plus one with width 336… and removed the responsive.

So far so good, the jumpiness is much much less than before.

2 Likes

Thanks @Paracelsus, I’ll try this too…

@neil, whats the difference between “Adsense post bottom” and “Adsense mobile post bottom”?

A tablet, iPad or other intermediate-size devices are considered as PCs or as mobiles talking about the ads plugin?

1 Like

@Cazadividendos so far the “only” disadvantage is that you can’t have wider ads between posts even if, for instance, you rotate your mobile to an horizontal view, the ads are “stuck” on those sizes you choose. And if you choose wider ad sizes, you will start seeing some that break the layout when mobile is vertical.

1 Like

First one is not mobile, the other is mobile. It uses Discourse’s rules for telling what is “mobile” or not.

2 Likes

They will be considered mobile.

1 Like

Hi,

Is it possible to add Google ads in the middle of a topic? Let’s say for every X replies, a ad could show? right now i see only top or bottom options.

Thanks!

Yes, look for “post bottom” and “nth post”.

1 Like

Thanks @neil I was using the old version of the plugin that did not allowed it :upside_down_face: