Exclude topic from AdSense


(Bart) #1

Hi,

on our forum we allow artistic nudity to be posted. However, this is against the AdSense policy and from time to time they require us to remove AdSense from specific pages.

I suspect this can be achieved with some custom Javascript that compares the current topic ID against a blacklist and then disabled AdSense for that topic, but I haven’t been able to figure this out.

Has anyone tried something similar? I’d really appreciate some help with this.


(Jeff Atwood) #2

Why not archive those topics? Archived topics are excluded from google indexing. This would prevent new replies, though.

You could also make them unlisted topics which would achieve the same effect without preventing replies.


(Bart) #3

These topics are allowed under our content policy, so I have no reason to hide them from users.


#4

If you serve AdSense ads through Google Ad Manager (formerly DFP), perhaps you could do something like this:

https://support.google.com/admanager/answer/7380963?hl=en


(Mittineague) #5

Maybe you could limit such “specific pages” to a category requiring being in the TL0 group?
Search engines do not register accounts and belong only to the everyone group.


(Bart) #6

I’m using plain old AdSense, so I’m afraid that won’t work.

Hmmm, but that would take the topics out of the context of their current category. I don’t think that’s a good idea either.

So far, I’ve tried writing some CSS rules that use the [data-topic-id="12345"] selector to target the adsense blocks on that page and set them to display:none, but that selector doesn’t get used until the posts stream. Since I also have an ad at the very top of the page, I can’t target it.

So perhaps I can write some Javascript to just compare the current topic ID to a defined list and use jQuery to insert some styling ad needed.

The question is now: how can I access the topic ID from Javascript, in a way that doesn’t require any additional server requests?


#7

Google Ad manager can fill in your unsold inventory with AdSense ads, so if AdSense itself doesn’t have a feature you need, switching to Google Ad Manager to serve those same ads could give you more options.

https://support.google.com/admanager/answer/1670087?hl=en&visit_id=636705569790263403-3167174582&rd=1