Unofficial Google AdSense plugin

Compatibility: Discourse 1.3 and up

Yes! Since plugins are now able to override handlebars templates (thanks again, @zogstrip ) we have finally been able to create a clean Google AdSense plugin for Discourse.

It’s available at GitHub - discoursehosting/discourse-adsense: Google AdSense plugin for Discourse forum

To install, use the standard plugin installation.

This plugin will be automatically made available to customers by the end of next week.

To use:

  • Go to Admin -> Settings -> AdSense
  • Enter your AdSense publisher ID (ca-pub-xxxxxxxxxxxxxxxx)
  • Create new ad slots within your AdSense account (728x90 for desktop, 320x50 for mobile)
  • Copy the slot id # numbers (ten digits shown in the ID column) in the Discourse settings
  • Enable the slots you want to use


Would prefer this plugin to serve ads based on Group, rather than Trust Level. Possibility of this becoming a feature?

1 Like

Can you give a few use case examples for that? Just want to know I’m understanding your needs correctly.

I serve ads to users based on whether they have donated to the forum or not. When they donate, they get put into a group. I would prefer to show ads based on whether they are a member of a particular group or not. Their trust level isn’t really the issue here, it’s how big a financial contribution they’ve made to offset the needs to have ads on the site at all.


Bump: I’m really keen to know if displaying ads by Group instead of Trust Level is something that ever might come to pass…


Question, does this plugin generates an ads.txt file ?

We are planning on implementing that soon. Please note that you only need an ads.txt file in the root of your domain (i.e. so this only applies when you are hosting your forum on the naked domain.


Thanks. I tested the plugin earlier but i can’t edit my adsense account on the config menu. It says there’s à problem when i try to save this parameter

Disable your ad blocking software…


Thanks, I didn’t thought Adblock would block this parameter so I didn’t even thought about it being activated.

Best regards

what you mean by naked domain like my discourse forum is -

Ads are disabled here and I have no idea how I can implement this.

On main domain - I submit the ads.txt in root domain still the same problem came and no ads are showing.

Can you please explain it a little.

It looks as though you should be able to ignore it if you already have it in your root domain

In 2017 Google will only crawl and enforce ads.txt files placed on root domains, ignoring files placed on subdomains. Ensure that sellers authorized for your subdomains are included in the ads.txt file you place on your root domain. We are planning to crawl and enforce ads.txt files placed on subdomains beginning some time in early 2018. We will provide further details when this feature is available.


Is it possible to disable Adsense when your are logged in?

It might force users to login, so ads only visible for non logged in users…

You Probably can configure it to the lowest trust level.

Great idea but against google’s Adsense T&C

So according to Google’s T&C we can’t decide whom we want to show ads and whom we don’t?

Not quite.

They don’t want you providing a better/cleaner version of your site for pay.

Can You Please DM me the relevant link from Google’s Side? I Can’t seem to have notice it! That’d be a real help for me to understand exactly how that works!

1 Like

Please don’t DM it but post the relevant link in this topic so everybody has the information.
I can’t find it in the policy document.
AdSense Program policies - AdSense Help?


Hello. I activate the plug in in my site

When click the ad page opens in same window. How can I open the links in new page?