Wordpress AdSense Injection – Random Google Ads on Your Blog
Dax “the Hammer” Herrera has whipped up a nice Wordpress Google AdSense Injection plugin to add Google AdSense ads to your blog. It’s painless and automatic.
[Update: I've removed this plugin from my site. Nothing wrong with it. I just don't have the time to style it the way I want.]
Why Google AdSense Injection?
We all know about television ads where the natural volume has been cranked up. It’s jarring, but you look (I tend to follow-up looking by turning the television off). Recently, I’ve noticed some start and stop ads on television. The commercial will begin, run 2-3 seconds and then “skip” back to the beginning. The effect of this “random” problem focuses attention on the screen and the content. Of course, like the volume trick, viewers become desensitized and eventually their attention goes elsewhere.
A better technique would be to randomize the stop and start, the jitter. Only show the jitter X number of times per 30 minute block of television and position the jitter in different places during the commercial.
Online, we can’t really stop and start a webpage, but we can randomize the way we show ads. This is where the AdSense Injection plugin comes in. As Hammer notes on his website, a random dispersement of ads within content is likely to drive higher clicks by evading what is known as banner blindness.
Why AdSense works
Google AdSense puts little text, image, and now video ads on your website. The ads are served based on the relevancy of your site content to the advertiser’s copy and content. As a site owner, you get paid when visitors click on the ads, and visitors tend to click when the ads are relevant.
So, how does AdSense know what to serve?
When a visitor happens by a page with AdSense ads, it triggers a the Google Mediabot crawler to visit the page and grab the content. AdSense looks at the position of the Google AdSense include code to visible content along with overall page content to determine the right ad to show. Soon enough, relevant ads should show up on the site. This is why your first tests may show some odd results.
If don’t have an AdSense account, you can sign up using the ad below:
Why Randomizing with Google AdSense Injection is Good
I talked briefly about changing up the location of ads could be important in getting visitors to read them as opposed to passing them by. I’ve also talked about how AdSense determines which ads to show. So, if we mix these things together (randomizing and importance of placement), we should get more relevant ads that get a visitor’s attention which should lead to more clicks and revenue for you as the site owner.
Options in the Plugin
Hammer’s AdSense injection plugin automatically places AdSense blocks in your content. This means you don’t have to go back and edit all of these entries you’ve saved before (very good). You can also skip editing your theme (also good).
When you configure the plugin, you decide how many ad blocks to show and how many ads per block. The plugin does the rest.
Other options include:
- Setting the color
- Choosing a variety of ad block sizes to randomize
- Ad positioning
- Pages where you DO NOT want ads
- Ad visibility for certain users
In addition to these options, version 2.0 of the plugin also allows you to turn off AdSense injection for an article by including noadsense in content (enclosed in an HTML comment). I’ve used that option on this page in fact since I am also displaying and AdSense signup ad above.
[Get the Wordpress Google AdSense Injection plugin from Dax Herrera]











Jamie
I read that you where able to pad your ads in the plugin, so that the ads didn’t touch blog text. Is it possible to get a copy of the Adsense Injection with your improvement?
Thanks,
Randy
No problem. You just need to modify the function ai_pickalign. Below is the code I modified. I believe this function begins around line 295.
The default version has floats but no margin or padding. I added a margin in specifically, but you could easily assign a style class instead and tweak it through your main stylesheet.
function ai_pickalign($tag){ if($tag == "left") return '<div style="float: left;margin:5px;">'; if($tag == "right") return '<div style="float: right;margin:5px;">'; if($tag == "center") return '<div style="text-align: center;margin:5px;">'; else return ai_pickalign(rand(0,10)<5?"left":"right"); }I modified the margin code a little bit, so the margin is only applied on one side of the banner, like this:
function ai_pickalign($tag){
if($tag == “left”)
return ”;
if($tag == “right”)
return ”;
if($tag == “center”)
return ”;
else
return ai_pickalign(rand(0,10)
Could not paste the code into the previous post, here is the style string for first two DIVs:
float: left; margin-right: 10px;
float: right; margin-left: 10px;
[...] back I wrote about Dax Herrera’s Google AdSense plug-in for Wordpress. I happened to be out trolling the treasure troves of plug-ins for a different site when I came [...]
[...] Wordpress AdSense Injection – Random Google Ads on Your Blog … [...]