ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Set up Google AdSense in drupal 7 website without using any module or editing themes to monetize your Drupal 7 website

Updated on February 5, 2012

Turn any Drupal 7 website into a revenue generating machine. Google AdSence, the giant of all AdSense, offers a contextual advertising solution to web publishers, delivers text-based Google AdWords ads that are relevant to site content pages. Drupal is a free and open source CMS written in PHP and distributed under the GNU General Public License, and using Drupal 7 any type of website can be created withing few hours. Idea is pretty simple to earn much money using these two things combined. Add Google AdSence code into your Drupal 7 website and covert your Drupal 7 website into a cash earning stream. So, the requirement is to know the way to add Google AdSense code to the Drupal 7 website. Lots of tutorials and techniques and modules are available to add Google AdSense code on Drupal 7 website. But most of them are not easy and always working for most Drupal 7 website. Me too, needs more than one month to find out the easiest way to add Google AdSense code to Drupal 7 website. Finally, I discover the solution. Believe me, no need any type of modules or any code modification to the templates, just follow the steps of this page and add Google AdSense code to your Drupal 7 website and generate revenue as much as you can!

Requirements for setting up Google AdSense in drupal 7 website without using any module or editing themes to monetize your Drupal 7 website

To monetize any Drupal 7 site, the followings are necessary:

  • An active Drupal 7 website
  • An active Google AdSense account
  • Administration permission to the Drupal 7 website

If you have the above mentioned three things then you can step forward to add Google AdSense ads to your Drupal 7 website easily without using any Drupal module or any type of theme customization.

Steps to set up Google AdSense for Drupal 7 website to earn revenue form your website:

Setting up Google AdSense ads is pretty simple and easy. The most interesting thing is that for Drupal 7, we even do not need any modules. Moreover, we do not need any type of code or template customization. The logic is pretty simple and can be apply any type of person if his / her website is build using Drupal 7. Follow the following steps to add Google AdSens ads to your Drupal 7 website and to generate revenue from your website:

Step 1: Create or generate a Google AdSense ad code for your Drupal 7 website using your active Google AdSense account according to your choice. After generating the AdSense code for your Drupal 7 website, copy that code and paste it to a notepad file and save it as your wish. For example, we save the code in the file MyDrupalCode.txt. Remember, you donot have any permission to add or modify any part of the generated Google AdSense code. [Note: I will publish a page how to create Google AdSense code for Drupal 7 website very soon].

Step 2: Login to your Drupal 7 website's administrator account using the administrator account's user name and password.

Step 3: Enable the PHP functionality of your Drupal 7 website. To do this, access the Module section of your Drupal 7 website. Now, find PHP Filter and enable this module and click on Save configuration button to save the settings.

Step 4: Go to the Structure of your Drupal 7 website. From the "Structure", choose Blocks section. We need a block to add the Google AdSense code to our Drupal 7 website. Now click on Add block link to create a new block for the AdSense block to monetize our Drupal 7 website

Step 5: From the Block creation page, we have to do several things. First, we type the description in the field Block description like My Google AdSense Block. Remember, this is not a fixed text. You can write anything in this description section. Now, go to the Block body section. Before putting / writing anything there, first choose the Text format as PHP code. You must have to choose this. Otherwise the code will not work for your Drupal 7 website. Now, we have to create an empty PHP block code in the Block body section like <?php ?>

Step 6: We now have to put the AdSense code block ads code into the PHP code block of previous step. Just copy the Google AdSense auto generated code block (which we save in Step 1) and paste it in the PHP block codes to print using PHP printing function. After doing this, specify in which themes and regions this block is displayed. Moreover, we have to set the Custom visibility settings (Users cannot control whether or not they see this block.), Show block for specific roles (Don't enable either of these options.) and Show block on specific pages (Don't choose a option. If you have to, choose: Show on every page except the listed pages. and leave Pages: Blank Unless you know what your doing.) and after doing all things click on Save block button to save the block's code which we just created.

Step 7: After finishing the above steps, move your new block to your left or right sidebar or header part or anywhere of your website.

When you have completed the above steps, you have done all things. Now, your Drupal 7 website is ready for displaying Google AdSense ads for you to monetize for you. It's time to visit your Drupal 7 website and see in action. Just visit and refresh your website. What are you seeing? I think you are seeing the Google AdSense ads are showing on your website.

Following the instructions which we mentioned here, you can easily add Google AdSense ads for your Drupal 7 website. The great challenge is that here we do not need any type of module or any type of custom template modifications. The steps are really very simple and anyone can do this. Lots of tutorials and forum posts only give instructions but most of them are not effective as most people do not know the actual ways to do. Hopefully, following the instructions, you can easily add Google AdSense ads to your Drupal 7 website to monetize some money each month. Furthermore, if any query or support is in need, please mention in the comment section.

@ Written by rancidTaste [web:]


    0 of 8192 characters used
    Post Comment

    • profile image


      6 years ago

      Thanks for your sharing!

    • rancidTaste profile imageAUTHOR


      6 years ago

      Dear SIVAG, it's fully worked to Drupal 7 website. I followed this method to all of my Drupal website. Would you please mention me where actually you don't understand then i could help you clearly to solve the issure.

    • profile image


      6 years ago

      its not working in Drupal 7!! Can u help More!!

    • rancidTaste profile imageAUTHOR


      6 years ago

      Thanks vrajavala for your comment. Wish you would apply the techniques and will be successful to display Google AdSense ads to your Drupal 7 website.

    • vrajavala profile image


      6 years ago from Port St. Lucie

      I'll check it out. Thanks.


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)