Here is my free Ad Injection plugin for WordPress. I’ve been using it for a while now on a number of websites, so I know it works for me, but it would be great to get some feedback on whether it works for you.
Ad Injection injects any kind of advert (e.g. Google AdSense, Amazon Associates, ClickBank, TradeDoubler, etc) into the existing content of your WordPress posts and pages. You can control the number of adverts based on the post length, and it can restrict who sees adverts by post age, visitor referrer and IP address. Adverts can be configured in the post (random, top, and bottom positions) or in any widget/sidebar area. There’s support for A:B split testing / ad rotation. And the dynamic restrictions (by IP and referrer) work with WP Super Cache, W3 Total Cache and WP Cache.
Update 1st March 2011: New support for top, random and bottom ads on archive and home pages.
Update 21st January: Now has support for ad rotation, A:B split testing and alternate content.
Update 13th December: Now with widget support so you can add your adverts to any sidebar or widget area.
Download Ad Injection plugin for WordPress for free from this link. Or just search for Ad Injection from your WordPress install and WordPress will automatically install it for you.
Automatic advert injection
The ads can be injected into existing posts without requiring any modification of the post. The injection can be done randomly between paragraphs, and there is an option to always inject the first advert at a specified paragraph (e.g. the first or second). Randomly positioning the adverts helps to reduce ‘ad blindness’. Two additional adverts can be defined for the top and bottom of the content. Widget adverts can be defined as well for your sidebars.
Widgets can be added to your sidebars, or other widget areas on any pages. The same ad display restrictions that you setup for your other ads will also apply to the widgets.
Ad rotation / split testing
You can define multiple adverts for the same ad space which are rotated according to the ratios you define. Works with random, top, bottom and sidget/sidebar ads.
Ad quantity by post length
The number of adverts can be set based on the length of the post. It is a good idea for longer posts to have more adverts than shorter posts for example. Adverts can also be turned off for very short posts.
Ads on old posts only
Adverts can be restricted to posts that are more than a defined numbers of days old. This prevents your regular visitors from having to see your ads.
Category, tag and post type filters
You can configure the adverts to only appear on specific categories, tags, or post types, or block the adverts from specific categories, tags or post types.
Search engines only (dynamic feature)
You can specify that ads should only be shown to search engine visitors (or from any other referring websites) so that your regular visitors (who are unlikely to click your ads) get a better experience of your site. You can define which search engines or any other referring sites see your adverts. A visitor who enters the site by a search engine will see ads for the next hour.
Block ads from IP addresses (dynamic feature)
IP addresses of people who shouldn’t see your ads can be defined. These could be the IP addresses of your friends, family, or even yourself.
Not tied to any ad provider
The advert code can be copied and pasted directly from your ad provider (Google AdSense, adBrite, ClickBank, etc) which will help you to comply with any terms of service (TOS) that state their ad code may not be modified.
Flexible ad positioning
Easy positioning options are provided for left, right, center, float left, and float right. Extra spacing can be set above and below the ad. Or if that isn’t flexible enough, you can write your own positioning code using HTML and CSS.
You can specify a specific paragraph for random ads to start from, or if you need per-post control of the random adverts you can insert tags into the post source to say where the adverts should start and end.
Works with WP Super Cache, W3 Total Cache and WP Cache
The dynamic features that require code to be executed for each page view (i.e. ad rotation, search engine visitors only, and ad blocking based on IP address) work with these caching plugin! This plugin will automatically use the dynamic mfunc tag to ensure that the dynamic ad features still work when caching is on.
Displaying the adverts (even with the dynamic restrictions) whilst caching with WP Super Cache requires no MySQL database access. If you use WP Super Cache 0.9.9.8+ you can use the fasted mod_rewrite caching mode, on older version of WP Super Cache you’ll have to use the slower legacy caching mode – I recommend you upgrade.
As the plugin will inject whatever content you like into the page you can write your own ad rotation or a/b split testing code for the ads you inject. PHP code can be automatically executed, even when using a compatible caching plugin.
Full documentation is available on the WordPress Ad Injection page.
If you do get any errors please use the ‘Report a bug or give feedback’ link on the plugin to send me the error details. If things go so badly wrong that you can’t even get to the settings page please send me an email via this contact form.