Google AdSense plugin

(Michael - #1

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

Adding Advertising
[Paid] Google Adsense Plugin Installation
Monetizing Discourse using Adsense
Oh advertising, oh advertising where for art thou advertising
Core Advertisements
Should I recreate Google Adsense Plugin?
Adding Advertising
AdSense plugin comparison
Advertising on Discourse
How to place ad after first paragraph of the topic?
Custom Layouts Plugin
Akismet with 1.5.0.beta10 broken?
Post jump when scrolling - Official Adsense Plugin
Blank page with js error after upgrade
Hide/Show single posts in the overall discussion
(Anthony Giovannetti) #2

Any screenshots of the plugin in action?

(Amit Friedmann) #3

Awesome! Can’t wait.

(Jong Eun Lee) #4

@michaeld Thanks for share your plugin. :smile:

I have a problem with this plugin.
my discourse version is ( )

After move page with click a link of my discourse, Adsense disappeared.
If reload page, Adsense will appear again.

Is this a bug or my mistake?

see captured video.

(Michael - #5

I see errors in the console when browsing your forum.

The errors come from a Google javascript file.
When searching for the error, it seems like an incompatibility with Gecko browsers, Ajaxy applications, and AdSense.!topic/adsense/pQbqeEV-NUA

The weird part is that I have not seen this but on your forum.

(Tropnevad) #6

Is this available as part of all the discoursehosting packages as I cant find it on my admin settings? Otherwise awesome stuff with the plugin!

(Michael - #7

We’re having some issues with the deployment, causing unwanted downtime during rollout.

I was hoping @zogstrip has a solution to that issue. If there is no quick fix, we’ll be rolling out anyway next weekend.

(DAB Lucide) #8

I appear to be having the same issues as Jong. Any thoughts?

(Vikhyat Korrapati) #9

The problem is that the async adsense code renders blank spaces after the first three advertisements in order to enforce their “only 3 units per page” policy. When you switch between pages on Discourse the page isn’t actually refreshed, so after the first three ad units shown to the user no more ad units will be rendered until the user refreshes.

Only decent workaround is to put the actual advertisement inside an iframe, which is in violation of their terms of service unless you have permission from them. They aren’t replying to my emails, so in the mean time we’ve gone with BSA units that support adsense as backfill.

It’s been working pretty well (you can have a look here). However note that it looks like the adsense bot doesn’t execute Javascript and also seems to ignore the <noscript> sections, since the advertisements I’ve seen have never been relevant to the actual page contents.

(Sam Saffron) #10

WARNING: appears broken with latest Discourse.

(Michael - #11

We have released a new version of the AdSense plugin which works for v0.9.8.5.

(miceiken) #12

Nice share. Haven’t tried this yet, so I’m not sure if this already exists, but what about a feature that lets you disable ads for users above a certain trust level/group?

(Jens) #13

I second the option to disable Adsense. But not for groups or user with a certain level, but for all logged in users. Let them leechers klick on ads, not the actual contributors to the community.
Like that you can display very prominent Ads to search engine traffic without getting in the way of your users (who won’t click on ads anyway).

(Jeff Atwood) #14

I agree, but putting the “remove ads” reward at trust level 1 is an extremely modest barrier and gives those users incentive to hang around a bit.

(Jens) #15

I agree, of course that’s even better, @codinghorror. You have to be logged in to have trust level 1+, which I didn’t realize last night blush.

(Michael - #16

Great suggestions @miceiken and @jeans!

We’ll implement this with a configurable show_ads_up_through_trust_level (is that clear English?).

So then 0 will show ads for anonymous users only and 4 shows ads for everyone. Put the default at 2.

(Michael - #17

We’ve released a new version of the plugin. It has a adsense_through_trust_level setting which is default at 2, so it shows ads to everyone but leaders and elders.
Lower the setting to 1 to keep regular users and above from seeing ads.
For new and not logged in users only, set it to 0.

(Richard) #18

I get an error when trying to install:

root@ip-:/opt/bitnami/apps/discourse/htdocs# bundle exec rake plugin:install repo=
rake aborted!
cannot load such file – rb-inotify
/opt/bitnami/apps/discourse/htdocs/config/application.rb:11:in <top (required)>' /opt/bitnami/apps/discourse/htdocs/Rakefile:5:in<top (required)>’
(See full trace by running task with --trace)

sorry, I’m n00b in ruby.

(Michael - #19

What version of Discourse are you running?

(Richard) #20