configure Drupal 6 with Google Adsense and the Injector module

So, I just love the Drupal content management system. I also love the fact that it I can add articles, news, blogs, forum posts, videos and even earn some Google pennies by displaying relevant google adverts. You can add Google Adsense to the CMS simply by creating a block and cut/pasting your adsense <form> into the block but this is a rather clumsy solution and quite fiddly to implement.

But wait... galloping over the hill comes the excellent Drupal Adsense Module All you do is setup this module to use your Adsense ID (something like pub-5546111582340768) and team this with the Drupal Adsense Injector and it will then automatically insert relevant adsense into pages, news, forum posts, blog entries... in fact anything and everything on your drupal website. Voila - google adwords appear like magic and you earn some money!

It's simple, elegant and just pretty damn cool!

It's very easy to configure and works smoothly once it's running. The installation is precise and works perfectly as long as you

  • Read these instructions
  • Follow them exactly
  • then watch your adwords appear on your drupal website

It's as easy as that.

 


 

OK so lets start - Firstly I'm assuming you have installed drupal and have it running on your website. At the time of writing this I am using Drupal version 6.8 with a bunch of different modules and selected themes.

I load my themes and modules in the SITES subdirectory so your Google Adsense module should be FTP'd up to your server into the www.yoursite.com/sites/all/modules/adsense/

Download the latest version of Drupal Adsense Module
Unzip it and FTP all files into www.yoursite.com/sites/all/modules/adsense/

Download the latest version of Drupal Adsense Injector
Unzip it and FTP all files into www.yoursite.com/sites/all/modules/adsense_injector

 

  • Enable the ADSENSE MODULE (http://www.yoursite.com/admin/build/modules) or click ADMINISTER ¦ MODULES

Here you can see I have enabled adsense core (this is where I store my adsense id), the adsense injector module (which will automatically insert adverts in my applications) and Managed Ads - this lets you (optionally) define the style of your adds in your Google Adsense account.

First time you configure this - I would recommend you select the ADS OLD (option 1) as an alternative - allowing you to define your ad style in the module iteself. Once you've got it working and want to tweak the layout then use the MANAGED ADS route... its much more felxible.  Wink

 

Click the PUBLISHER ID link and enter your Google Adsense ID (Your client ID is the name associated with your Google Adsense account. Log into Adsense and double check... cut/paste the Client ID)

You client ID will look something like: pub-5546111582340768

Enter in your Google Adsense ID in the field that is there. note only the pub-xxxxxxxx part!

 

 

  • Thats it!!!   Your adsense is now configured so lets start adsense injecting!

Configure the adsense injector at http://www.yoursite.com/admin/settings/adsense_injector

This is where you can set the ad placement, size and lots of other wonderful bits and pieces.

Make sure you scroll down and select the Drupal Node types that you want to be injected... to inject.. erm.. to be injectified... oh you know what I mean  ;)

 

THATS IT - You're finished!!!

Sit back and watch those google adsense pennies come rolling in  Wink

 


 

Note: By default the GOOGLE ADS wont display when your logged into your browser - you will see a lovely window saying 'Google Adsense' where the adds would be displayed. However, all other internet surfers will see the adverts correctly.

hint if like me you use a couple of browsers to check that everything looks OK for all internet users then open another browser session and look at www.yoursite.com with another browser - I use Chrome (this week) as my main browser and IE/Firefox/Safari as my backup so Chrome is the one I am logged in with and administering this drupal site but I can flick into my IE session and see the website as an anonymous (ie: logged out user)...

Check your website and google adsense adds will be inserting all over the place. You can tweak the advert placement by modifying the ADSENSE INJECTOR MODULE settings.

PS: Look below and you should see a google ad that has been INJECTED by the module on this website!

 



Comments

 perfect - just what i was

 perfect - just what i was looking for.

i just followed your instructions and it has worked first time. brilliant!!!!!!!!!!!!!!!!!!!!!!

OK - it looks good but I dont

OK - it looks good but I dont see any adsense? I'm using IE6.    and before you say anything NO IM NOT CHANGING MY BROWSER.   :)

projex's picture

IE6 works perfectly with adsense injections

make sure you have selected ADSENSE CORE, and either the ADSENSE OLD option or the MANAGED ADS option in the ADSENSE module. OLD gives you basic adsense boxes and this is what you should try first. If you dont select either of these then you will see the adsense 'placeholder boxes' when you are logged in to your website but when you log out you see nothing... took me a while to figure this out the hard way   Wink

I can confirm that the adsense displays with Firefox 3 (and 3.1Beta), Chrome and IE6, 7 and 8.

 

Cool

 I'm using IE6 now and I can

 I'm using IE6 now and I can see the google advertisements. hope that helps out.

Current weather

Roanoke, Virginia USA

Overcast
  • Overcast
  • Temperature: 60.8 °F
  • Wind: East, 4.6 mph
  • Pressure: 1004 hPa
  • Rel. Humidity: 88 %
  • Visibility: 10 mi
Reported on:
Fri, 03/12/2010 - 16:45

Locations of visitors to this page

Bunch of Twits

  • adds 'Thievery Corporation' to his list of groovey background music to play while programming :) 6 hours 43 min ago
  • is watching very serious blokes playing plastic darts.... wtf is that all about? 21 hours 26 min ago
  • has discovered that his mighty hammer Mjölnir is missing. 3 days 8 hours ago
  • grabs a coffee and settles down for a day of post implementation checks, project closure and user documentation... bah! 4 days 9 hours ago
  • is about to embark on an IHOP pancake eating frenzy with the sprogs... 5 days 8 hours ago
  • just watching tv, a female marine running up a beach, teagan says 'i hope shes not wearing heels because thats hard' ;) 5 days 21 hours ago
  • saturday morning, determined to do no work today just gonna hang out with the kids, walk the mutts, watch movies and vejjjjjj... hurrah! 6 days 6 hours ago
  • is al about rpg3, rpg4, php, asp, IBMi, html, xml, wsdl's and any other acronyms I can think of.... 1 week 17 hours ago
  • is pretending to type something important to avoid listening to someone talking a load of codswallop. 1 week 1 day ago
  • see... DOTnetnuke.... Microsoft products make my brain shout 'Uncle!' 1 week 2 days ago

Who's online

There are currently 0 users and 54 guests online.

Finkpad's tweets

  • adds 'Thievery Corporation' to his list of groovey background music to play while programming :) 6 hours 43 min ago
  • is watching very serious blokes playing plastic darts.... wtf is that all about? 21 hours 26 min ago
  • has discovered that his mighty hammer Mjölnir is missing. 3 days 8 hours ago
  • grabs a coffee and settles down for a day of post implementation checks, project closure and user documentation... bah! 4 days 9 hours ago
  • is about to embark on an IHOP pancake eating frenzy with the sprogs... 5 days 8 hours ago
  • just watching tv, a female marine running up a beach, teagan says 'i hope shes not wearing heels because thats hard' ;) 5 days 21 hours ago
  • saturday morning, determined to do no work today just gonna hang out with the kids, walk the mutts, watch movies and vejjjjjj... hurrah! 6 days 6 hours ago
  • is al about rpg3, rpg4, php, asp, IBMi, html, xml, wsdl's and any other acronyms I can think of.... 1 week 17 hours ago
  • is pretending to type something important to avoid listening to someone talking a load of codswallop. 1 week 1 day ago
  • see... DOTnetnuke.... Microsoft products make my brain shout 'Uncle!' 1 week 2 days ago