Drupal Module: Google AdSense

A while back I wrote about Search Engine Optimization, which touched a bit on AdSense. I also wrote a tutorial on how to use Google's AdSense with Drupal.  Well, the time has come to make this a module, and here it is : the Google AdSense Drupal module. It is not as feature complete as I want it to be, but will do the job for most sites. Wish list includes:

  • Have different colors for different ads. This will allow you to style the left sidebar different from the right sidebar
  • Allow certain roles/users not to see ads (e.g. paying subscribers)

Go ahead and install it and make some money!



problem with no show adsense using this module

I have installed the adsense module according to the instructions, put my adsense client id in and configured it as a block in the sidebar. No adverts show even in anonymous login.

Since it is easy to put the adsense Javascript code in a homemade block which works reliably I am beginning to wonder about the usfulness of this module.

I tried everything and still

I tried everything and still I get nothing.

When will the "EASY" Version of this module be released?

I have installed it but I

I have installed it but I don't see it on my module directory when I login to my site.

Pretty easy setup

I followed the instructions down to the last letter. Setup was easy. Also, I have tested this with the following browsers: Internet Explorer, FireFox, Opera, and Apple Safari. Works great! I'm a total newb at web design and Drupal. So far, my experience has been great!

Thanks for the awesome module
W. Brown

Turn off Adblock

It took me some three hours to find the silly reason to why AdSense didn't work on my site: I had Firefox Adblock extension active.

Hopefully this tip helps other people in my situation. :-)

Thanks for a neat module!
//Johan in Sweden

I have Firefox Adblock

I have Firefox Adblock extension active too, but the Google-Ads on this site are visible! That's GREAT! Can I have this for my Drupal-Site?

Ads can be horrible annoying and time/traffic-consuming. These decent Google-Ads may even be eye-candy and add value for both site-owner and visitor.

I'd like to show Google-Ads to visitors with AdBlock on, and let them the option to turn the ads off.

And Yes, Mr. Baheyeldin, I will set up my AdSense-account via your referral-link.

Thank you for your great work.


Oops, sorry. The Google-Ads

Oops, sorry. The Google-Ads disappeared. Must have been a problem with my AdBlocker.

New question: Would it be possible to 'mask' AdSense-Ads in Drupal? In a way thas visitors can add them to their AdBlocker, if they want to?



It can be done on many levels.

I don't use adblock, so don't know how it works, but probably it blocks javascript in specified domains.

You can simply assign the "hide adsense" permission to the roles you want on your Drupal site, so logged in users would not see any ads, but anonymous visitors would see the ads. You can refine that by doing it to more roles as well.
Khalid Baheyeldin

Thank you

Thank you for the answer.

Yes, AdBlocker blocks JS by domain and catchwords. And they do that very well. This is a problem now and could become a disaster in the future for freelancers and small companies, who depend on ad-agencies with their informational site (like me soon, I'm still working on my first project).

More and more people use AdBlockers. The reason why is obvious: On many sites it's hard to spot the content amidst the advertising - and a dozen flashing Flash-Ads may cause eye-cancer ;-). Often it's a relieve from pain.

Unfortunately AdBlocker block any ads from decent text-ads to flashy skyscrapers.

If someone *hint* could create a module that masks adverts in order to let them pass the ad-filter, he would be the drupal-hero of the year for two years (maybe even three).

The idea is to combine such a module with non-disturbing advertising, so the visitor does not feel the need to add the ads to the ad-filter (which can be easily be done via rightclick - at least with my Firefox-AdBlockPlus).

Regards from Gerhard