Thursday, February 3, 2011

How to Integrate AdSense in Drupal 6

AdSense integration in Drupal 6  

Although Drupal  AdSense module is  available in Drupal website (http://drupal.org/project/adsense) , this module is only for Drupal 5 and Drupal 6. If you want to place adsense ad in your Drupal 7 site or do not want to install this module , hope this code will be useful.   

If php filter module not enabled, enable the php filter module. Create a new block and place the code below. Do not forget to change the “Pub Id”.
<?php
$adsencead="<script type='text/javascript'><!--
google_ad_client = 'pub-XXXXXXXXXXXXXXXX';
/* 160x600, created 2/2/2011 */
google_ad_slot = '3339531126';
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>"
;
echo
$adsencead;
?>


Change the input format from Filtered html to PHP code.



No comments:

Post a Comment