How to Add Adsense in Drupal 7 with Blocks

There are a number of ways to insert ads in a Drupal site including using “content injection” module, formerly known as Ad sense injector. In this post you can learn about how to add Adsense in a Drupal site with blocks. As you know that to add any functionality or features in Drupal you need to add blocks, which are considered the building unit. You have to follow the following steps:

  1. Logon to your Drupal blog.
  2. Click on “structure “and then on “blocks”
  3. Click on “Add blocks”
  4. In the block title, type any name that you want to show up before the ads. If you do not want anything to show up before the ad sense codes then leave this option blank
  5. Now give a name to the “block description”. For your convenience you can type any suitable name.
  6. In the block body section, click on “source” and paste the Adsense codes on it.
  7. Now, if you want to show up the ads between content title and the post, then select “content” in the default theme of the “Region settings” section.
  8. Finally save it and allow a few minutes to appear the ads on your pages. Sometime ads may take time to show up in pages.

add blocks.jpg

add adsense in drupal.jpg.

The above mentioned way will help you to add ads on your entire sites.

If you want your ads to appear only the individual post not in any pages including front pages, then you have to specify the list the pages in the “visibility settings” in your blog. For example you want block ads in the front page and in another page called poll. Then you have to select “All pages except those listed” in the “Show block on specific pages” option in the Adsense block. Next, you have to type the following the box:

<front>

Node/57

In order to block ads in the front page you just have to type <front> and a page with URL http://pagetron.com/poll, you have to find its node address. To find the node address click on configuration, then click on “URL aliases from “search and metadata”. In the URL aliases look for your page URL that you want to block and under the “system” column you will find the node address for that page.

configuration.jpg

URL aliases.jpg

An alternative way to insert ads into your post is by using the content injection module. Like the other modules in Drupal, you have to download it and the unzipped it in your PC. After that you have to upload it from your FTP to the module folder in Drupal. You can download this module by going at the Drupal content injector page.

If you know about the other methods about injecting advertising codes in Drupal site, then please add your feedback or suggestions in the comment section.

categories: