We’ve recently set up a couple of Drupal sites and decided what the heck let’s place some Google ads on them! You would think I’d naturally gravitate to the Google AdSense module right? Is that what I did? No, not initially, that would make too much sense. I’m going to walk through the different approaches we took and hopefully help others from making the same mistakes I made.
I can’t remember if I even installed the module before I discounted it as overkill, I figured it was more than I needed. Let’s face it all you have to do is go to your AdSense account, run the wizard, pick your colors, format then copy and paste the JavaScript into a block or a node. Right? Well sort of….
As we went along we discovered that placing ads within an article mixed in between paragraphs might be better. Here's an example: Target Heart Rates - Staying in the Zone. The thinking was if the ad is in the same place off to the side, people may tend to ignore it. If it changes position on a page per page basis people are more apt to read it. Being a geeky programmer wasn’t about to copy and paste the same hunk of JavaScript in a million places. So I found the Rep[lacement] Tags module.
The Rep[lacement] Tags module allows you to create tokens that replaced with longer text at page creation time. So I created $AD_200X200$ that got replaced with the big string of JavaScript from Google.
That worked great for a while until we saw our CTR (click through rate) was 0.36%. The problem is the majority of the page views were from us! As we right blogs, develop themes and module we were seriously skewing the results. Initially we said oh well, no big deal. Google is pretty tight lipped about it but I think it’s pretty commonly accepted that a low CTR hurts you in both the quality of ads and cost per click. So we need to hide the ads for us but not for other right?
So being a programmer my first thought was to hack the replacement module so that it doesn’t show the ads when we’re logged in but it would for the public. Then I thought, hhhmmm, maybe I should have another look at this Google AdSense module. (Duh!)
And low and behold I installed it and it does everything I need it to do! Imagine that! A large help text is displayed right on the configuration page. It’s very flexible; you can set up different ad groups (for different colored ads), channels even revenue sharing. There are three ways to show your ads in Blocks, PHP Snippets and Tags.
- Blocks - The easiest way to get started with this module is to use one or more of the pre-defined blocks.
- PHP Snippets - To display ads, you call a function called adsense_display() and supply it with three arguments: format, group and channel.
- Tags - This feature allows placement of ads in any place in the content. It works just like the Rep[lacement] Tags module I talk about above but incorporates all this modules features.
However, to me the really important features are the control you have over visibility. We’re not done implementing the tags on all our pages yet but I’ve tested it out on a few pages and it works great. It’s caused few conflicts with our style sheet which are pretty easy to resolve. Our click through rate should settle down into something more realistic soon. I sure wish I had given it more of a chance in the first place. Likely the majority of people will use the AdSense Module for displaying Google ads from the get-go but if not maybe you can learn from my mistakes.

Try the adsense injector module.
Works great with the adsense module. You should check it out.
http://drupal.org/project/adsense_injector