I have recently added the Adsense plugin onto my Discourse forum. Except there is one slightly alarming issue, some of the ads never show up. They show up blank like this.
I have already read all of the other topics here regarding this issue, but found no help. I noted that this happens more often in the Ads near the bottom of a thread (above suggested , post bottom).
I checked the console and network, and found no errors.
I have also added all the Google Ad Domains (which I know of) in the content security policy:
Yet, this error is still happening. One thing that I wonder may be causing this is that I’m using the exact same ad code for all the ads. Not sure if I need to make multiple ad codes for each ad location.
I think it depends on your ads categorizing, filtering, size of ads and the amount of ads that fit your website etc… This is totally usual if there is no advert to show on a place. Ads are optimized by Google and displayed on websites, if Google cannot place an appropriate ad in a place, it will be left unfilled. In such cases, it adds the following to the empty ad space. data-ad-status="unfilled". This is targetable with CSS so you can hide the whole ads place if it is unfilled.
This is happening sometimes on your site too.
I am not sure about the Discourse Ad Plugin Adsense part (I set it up once a while ago, but it no longer run on my website) but I am pretty sure you don’t have to add these URLs to CSP.
On the plugin’s description it only say add these.
With Adsense Google’s solution makes CSP totally useless because we should allow every adservise.google.<country> too. Or allow everything when there is no need to use CSP anymore.
Ah ha… that’s why adsense ads disappeared, it was the recently enabled CSP to allow the twitter component work!
Trying the above ‘unsafe-inline’ can not be used when encryption is enabled for DM’s, now here we have a of web of unintended consequences if I ever saw one…