Adsense and Drupal

Adding AdSense ads to your Drupal site is easy and painless.

Before you begin, you have to jump through the hoops of getting a Google Adsense account.  You need an approved account before you begin. 

There is an Adsense module for Drupal.  Just install the module, configure it, and go!  We installed it for this site, but it would not go.  We tried to get it to go, but got frustrated.  We ended up uninstalling the module and doing it old school.

Manually adding an Adsense ad to your site is easy.  First you need to log into your Google Adsense account and navigate to your ad unit.  In your ad unit, you will see a link for "Get code".  Click it.

Drupal Adsense Code Ad units
Click the link to get your custom adsense code.

You will be greeted with a pop up of the code.  From this pop up, you can copy the code.

Drupal Google Adsense Code
The copy the code to your clip board for safe keeping.

The best way to display your Adsense ad is in a Block.  Create a block and configure it appropriately.  You will need to decide which pages will have an ad.  You will need to figure out where in your theme the ad will display.  You will have to configure permissions for you block.

Paste the Adsense code into your block body and select a text format that is devoid of any text formatting.  Nothing.  You will need zero text formatting.   

Drupal text format
This is a custom text format.

Drupal out of the box will not have a custom text format that does nothing.  You will need to create this text format.  Its kind of a pain, but good news!  We have a tutorial on how to create a Drupal text format!

With the correct text format created, and selected in your Adsense block, click the save block button.  You now are serving Adsense ads!

If you are having issues with an Adsense ad not appearing, check the following.


UPDATE:  We have more Drupal Adsense knowledge to share!