Google AdSense plugin


(Michael - DiscourseHosting.com) #21

Try

export RAILS_ENV=production
bundle exec rake plugin:install repo=http://github.com/discoursehosting/discourse-adsense

(Richard) #22

is working now!

Thanks!


(William Karavites) #23

I got everything working, but when I get to the admin page the button to get to the adsense settings looks a little off.

Not a huge bug since it’s only viewable on admin side but, not right.


(Michael - DiscourseHosting.com) #24

Usually that’s a sign that the assets have not been re-precompiled correctly.


(William Karavites) #25

Looks like it’s showing up correctly now. Thanks!


(Aselox) #26

I think this should be included by default in Discourse. Great work @michaeld! :smiley:


(Manthan Mallikarjun) #27

Hey! I have a small suggestion.

You should allow us to have custom HTML text as well. I dont really like using adsense, and I much prefer using other ad services.

Another suggestion is to allow us to chose exactly where to put the add. My favorite place to put it is right underneath the first post of every thread.

Anyways, thanks fro making the plugin!


(Aselox) #28

@michaeld I have a problem: The banner at the top of the topic list shows fine but if i open a topic and go back to the forum homepage, I see a transprent space instead of the banner.


(Vikhyat Korrapati) #29

That happens because Adsense thinks you are embedding more than 3 units on a single page, no way around it other than to use a different ad service that has permission to embed Adsense in an iframe like Adzerk or BuySellAds.

See: Discourse Meta

We ended up using BSA for Hummingbird, it has worked pretty well for us.


(Michael - DiscourseHosting.com) #30

That would be another plugin, but yes, a more generic ad plugin would be nice. We’ll see if we can create something for BSA as well.


(Vikhyat Korrapati) #31

Not ready for public use yet, but: GitHub - vikhyat/discourse-bsa: BuySellAds support for Discourse :wink:


(Manthan Mallikarjun) #32

Yeah, that would be pretty awesome.


(Piotr Szal) #33

Ths AdSense Plugin is nice, but in development i have to shut off my adblocker, because the file adsence.js is blocked and the whole page is not loaded.


(Michael - DiscourseHosting.com) #34

You’re saying that your adblocker is, well, blocking ads?

IMHO running an adblocker is undermining the business case of many sites, and running an adblocker and publishing ads on your own websites at the same time is a bit… weird.


(Piotr Szal) #35

Im a developer and not the runner… :slight_smile:


(Piotr Szal) #36

I use adsbygoogle.push({}); to load new adsense from google after the slots are loaded.

Dont know it this is ok.


(Michael - DiscourseHosting.com) #37

Can you post some details @Piioo ?


(Piotr Szal) #38

My problem was, that the adsense disappeared when i moved from TopicList to Topic or from Topic to TopicList.
From Topic to Topic keep the adsense.
It is the same like @Jong and @dablucide.

So when the adsense is disappeared and I execute “adsbygoogle.push({})” in the browser console and adsense show up.

Here a gist:

When the adsense element is inserted (didInsertElement) then call “adsbygoogle.push({})” and it loads new adsense.
But it is not the best solution, because it should not be called after every adsense slot but after the whole page is loaded.


(Piotr Szal) #39

@michaeld

Maybe something like manual adsense code may be cool.

  1. I can add slotid to show default adsense.
  2. I can add manual js code, which would be place in the page and not the default adsence code.

This is only a change in the settings.yml and ad_view.js if manual code for slotid is set or not?

if (eval('Discourse.SiteSettings.adsense_manual_ad_slot_' + slotid.trim())){
    return new Handlebars.SafeString(eval('Discourse.SiteSettings.adsense_manual_ad_slot_' + slotid.trim()));
  } else {
    return new Handlebars.SafeString('<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +

(Michael - DiscourseHosting.com) #40

So where would you use this for?