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.
Would really appreciate if I could get help on this, Thanks!
is it a new adsense account that you’re serving ads from? Google might take a while for these ads to show up.
another possibility is that you might be using a browser that blocks ads by default.
Yes, it is a fairly new Adsense account. In fact it got approved less than a day ago.
I don’t think it’s my browser, I am using Chrome without an adblocker
Here is my forum link if anyone wants to see it for themselves:
Wait for google to start serving ads, it might take up to 72 hours
Oh ok, me wait karoonga, will update back after 72 hrs.
Well, I got ads on that url.
Always? It’s usually a hit or miss for me, sometimes it shows, sometimes it doesn’t.
I tried three times, from different IP’s.
Ad coverage definitely seems to have improved, I guess the trick is just to wait?
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.
Fixing Content Security Policy Issues
If your site uses an advertising service (like Google Ad Manager, Adsense, etc.) you probably will have to use a very permissive policy:
In the screenshot above, the policy allows any script from a
https: source and any inline script. (In the future, this might be replaced by the
strict-dynamic keyword, but as of this writing,
strict-dynamic isn’t supported by Safari or Edge.)
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…
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.