Close

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

 

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.  ;)

 

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  ;)

 


 

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

NickLitten's picture
Submitted by NickLitten on Thu, 01/01/2009 - 15:58

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   ;)

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

 

B)

Some Bloke

Projex dot com is the cyber home of Nick Litten an AS400 IBMi developer, RPG programmer, SOA code enthusiast, website tinkerer, information technology evangelist, early adopter, proponent of open source and hopeless technology addict...

Nick Litten looking dazed while refactoring some RPG2 code to kick it into this century

Born and raised in Rainy England, now enjoying programming in the sunshine of Southern USA. Founder of SOFTWARE PROJEX.

Clustermap

Locations of visitors to this page

glqxz9283 sfy39587stf02 mnesdcuix8
sfy39587stf03
sfy39587stf04