Google AdSense for Moodle 50

moodleI create a block plugin to show Google AdSense in the Moodle E-learning System.
Language : italian and English
Moodle : 1.5 ,1.6, 1.7, 1.8 . (tested)
Download Google AdSense for Moodle for free. [mirror]

You can setup id-publisher, width, height, format, color ecc. in the config.
For info, problem and tips leave comment.


  1. Download it, unzip and put google_adsense directory in blocks directory of your Moodle Installation
  2. login like admin and click on ‘Notifications’ for auto setup
  3. Turn “editing on” to add adsense google in your pages
  4. Go to “blocks” click on the “Add…” and select the google adsense. Then click on the “config” icon

Seguimi su twitter : @ironico

50 thoughts on “Google AdSense for Moodle

  1. Reply Ralf Seliger dic 7,2008 16:19

    I’m not sure the problem is with your module. I have added adsense code without using your module and the bahaviour is the same. Also, only Firefox seems to be affected; IE works fine.

    Regards, Ralf

  2. Reply Gennaro Varriale dic 5,2008 19:57

    @Ralf: Yes. I know it;( When i have some free time i’ll upgrade my module. When i’ll do it, I send you a message!

  3. Reply Ralf Seliger dic 5,2008 10:17


    it seems that the Google Adsense Block is broken for Moodle 1.9.3+ (20081204). Sometimes the block remains empty, i.e. no ads are shown.

    Ralf Seliger

  4. Reply Gennaro Varriale set 6,2008 19:43

    @Fabio: It isn’t a problem of my scripts. It isn’t an error, but a warning. You can solve it, editing php.ini (if u are in housing) else (in hosting) add this line in yuour .htaccess file (“php_flag register_globals off”).

  5. Reply Fabio set 6,2008 08:59

    Hi Gennaro!
    I’ve a problem installing your code:
    I put everything on the right dir, I clicked on notification but nothing happen. I have a warning which says:

    “Security Warning: to operate properly, Moodle requires
    that you make certain changes to your current PHP settings.

    You must set register_globals=off.

    This setting is controlled by editing your php.ini, Apache/IIS
    configuration or .htaccess file.”

    But I’m not sure it was generated by the execution of your script.

    Some suggestion?

    All the best!

  6. Reply miro ago 2,2008 11:50

    Really, Thanks alot for sharing!

  7. Reply Gennaro Varriale apr 19,2008 08:29

    @pop: the google_ad_slot is the new generate ad manage from google.My script is created before google changed, but is work 100% and it’s correct.
    With new code is possible manage group of ads. See at

  8. Reply pop apr 18,2008 14:44

    also in the google code , thier is a field called : google_ad_slot

    this field is not used in your script, can you explain this point, what is the use of this field?


  9. Reply pop apr 18,2008 14:33

    Hi Gennaro Varriale

    thanks a lot for 2 fast replay – withen 30 minutes
    about the channel number, how i can get this number, is this the ID number that appear beside channel name in the channels tab

    thanks in advance

  10. Reply Gennaro Varriale apr 18,2008 13:52

    @pop:Hi, you can leave channel empty ( you can fetch this value from your google account if you want statistics for “channels of banner” )
    Yes, it’s approved from google because respect T.O.C. ( the script generate the google code)

  11. Reply pop apr 18,2008 13:15

    hi, thank you for this nise tools, however, i have some questions
    what should i add in the channel field?
    is it approved from google, or cause any problem with google?


  12. Reply Gennaro Varriale apr 18,2008 09:07

    @fred: Thanks:) If you have some problem, i’m here

  13. Reply Fred apr 17,2008 20:44

    Sounds great!

    I’m downloading and testing, and will post my thoughts and experience here later. Anyway, even before installing, this plugin was a great idea.

  14. Reply Gennaro Varriale dic 31,2007 15:53

    Hi Hoffmann, wait for some day and it’s work ..thanks google ;) !

  15. Reply Blaine J. Hoffmann dic 31,2007 15:42

    Hello, I have installed the adsense block. Looks/works great. I have the google account and added my id code and added competitors url to block, however, i still see competitor’s ads on my site. Any suggestions?

  16. Reply learn french online nov 26,2007 19:44

    Excellent, this is just what I was looking for. Anyone have any bugs to report?

  17. Reply Gennaro Varriale set 20,2007 07:56

    Hi, tahoar
    i’m testing this morning links and is ok!
    You click on Download button at bottom of the page, under the banner image?
    However, if you have problem, send me message from contact form and i send you by email

  18. Reply tahoar set 20,2007 01:43

    the download link ( does not work and times out. is there another download link?


  19. Reply Gennaro Varriale ago 20,2007 09:28

    I have tested plugin on 1.8.2 too and it’s work.

  20. Reply Gennaro Varriale ago 18,2007 08:54

    ok Tom, i see ur email.
    What u mean for influence ads on each page?
    I can’t touch google adsense script for google policy i can only generate script

  21. Reply Tom T ago 18,2007 01:06

    Your Google Adsense block works on older MOODLE. I tested on version 1.54. If you write, please note my email is .info and not .com.

  22. Reply Tom T ago 18,2007 01:00

    Thanks for a great google adsense block. I am wondering how can I make the google ads to be closer to the content on my pages. Can you influence the ads on each Moodle page?

    Many Thanks,

  23. Reply Gennaro Varriale ago 3,2007 20:15

    Hi Kevin, i have no tested for 1.8.
    Now i have no time to check problem.
    As soon as possible i upgrading my module.
    Send me your email in contact form, and i advise you when i’ll do it.

  24. Reply Kevin McCarthy ago 3,2007 03:29

    I am trying to install your fine module on Moodle 1.8+. I copy your directory to t/moodle/blocks/ but then nothing happens. I find nothing in my logs either. All looks good , just no module. I even tried putting the site into maintenance mode. Any suggestions? Thanks for any help in advance.


  25. Reply Gennaro Varriale lug 5,2007 09:24

    Hi Fabricio. I tested module for 1.7 and is ok.
    If module does’nt start there some problem with upgrade.
    I check when i install a new moodle version .

  26. Reply Fabricio lug 4,2007 14:14

    I use your module in Moodle 1.9 Dev and instalation not start. You can help-me?

  27. Reply Gennaro Varriale mar 22,2007 11:06

    Ti ho risposto via email.
    Comunque è un plugin per Moodle che permette di inserire il codice AdSense di google, inserendo solo i parametri necessari ( ampiezza, altezza, formato, colore).
    L’ho creato perchè non esisteva ancora in Moodle e per risolvere un problema che hanno i blocchi html a gestire codice javascript (nel caso si voglia modificare un codice già inserito).

  28. Reply antonio mar 21,2007 20:53

    Ciao. mi sono imbattuto per caso sul tuo sito e ho letto di questo Plugin, ma…non ho capito bene a cosa serve…
    Puoi spiegarmelo?
    Ti ringrazio :-)

Leave a Reply to Gianluca Cancel Reply




Per essere informato sui miei contenuti - Email: