AdSense Responsive Ads

Add the publisher ID and ad unit ID, but got the issue below :

I was having similar issues, and upon viewing the source of the page served, found that Discourse was stripping out the inline Javascript entirely.

This post mentions it:

but I don’t see a solution there.

Fair to note we should mention the specific CSP policy changes needed in the first post, can you take that @tshenry

5 Likes

I am guessing this is why I cannot get my Adsense to work at all. I am getting errors that it is blocking inline Javascript, even when CSP is disabled. Does Adsense work for anyone else, and if so, how are you getting around this issue?

Recently, AdSense did not show ads? Could you advice to fix it?

@bck055 Can you please provide more information.

1 Like

Hello @neil, here is our URL.
Could you advise issue?

@bck055 Did you follow the first post in this topic? See this section:

3 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:

3 Likes

I followed your instruction.
The issues are not fix!!!

It’s working for me (Linux, Firefox with content blocking disabled, no ad blocker extension installed). What errors do you see in your web browser’s javascript console?

4 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.