Ad Injection plugin for WordPress

Ad Injection is a free WordPress plugin that 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.

ad injection plugin for wordpress 1 450

PayPal – The safer, easier way to pay online.

Download

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.

Features

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.

ad injection plugin for wordpress 3 450

Widget support

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.

ad injection plugin for wordpress 4 450

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.

ad injection plugin for wordpress 2 450

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.

ad injection plugin for wordpress 5 450

Inject PHP and JavaScript

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.


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.

168 Comments on “Ad Injection plugin for WordPress”

  1. Hi Rajesh, That is one of the next features I’ll be working on. I think I will start by implementing this feature for widgets, and then for the other ad types afterwards. If you have any more feature requests let me know, there is quite a good chance that they might get done!

  2. Hi Rajesh, version 0.9.4.1 of the Ad Injection plugin which I’ve just submitted now supports blocking ads on specific category or tag types.

  3. Hi admin !

    I just installed your plugin on a 2.9.2 installation but did not had the time to test it completely.

    Though I can install it

    Do you think I’ll have any trouble ?

  4. It might work on 2.9.2 but I have only tested it on 3.0+. Please have a go and feel free to let me know if it works. In the new year I will start testing Ad Injection on some older WordPress versions.

  5. Hi Leon, It should be compatible with WP Robot, but I haven’t tested it. Please let me know if it works, and if you have any problems. If there are any problems I’ll see what I can do to fix them. Thanks.

  6. Both v 0.9.4.1 and 0.9.4.2 are throwing errors on install.

    Permission denied in /ad-injection-admin.php on line 152

    Warning: fwrite(): supplied argument is not a valid stream resource in /ad-injection-admin.php on line 154

    Warning: fclose(): supplied argument is not a valid stream resource in /ad-injection-admin.php on line 156

    Warning: fileperms() [function.fileperms]: stat failed for /ad-injection-admin.php on line 162

    Warning: chmod() [function.chmod]: No such file or directory in /ad-injection-admin.php on line 165

    If I try to save any settings, it throws even more errors.

    I’m using WP 3.0.3 and changed the ad-injection directory to 777 – but still not working.

  7. Hi Kristof,

    Thanks for reporting this problem.

    If this is the first time you’ve tried to use the plugin then it sounds like your web host might not like having files written to it. I’d really like to find out what is going wrong when you try to use the plugin as I want it to work for as many people as possible.

    Here’s a few questions for you:

    1. Which ad insertion mode are you using? (mfunc, direct_dynamic or direct_static). Only mfunc needs to write to the files from the main settings page*. The other two modes load the adverts from the WordPress MySQL database. If you aren’t using the dynamic features (restricting by referrer or IP) you could try switching to one of the other two modes. If you switch to one of the other modes please upgrade to 0.9.4.3 as this version might have less warnings for you.
    *(although if you save an Ad Injection widget it writes to the file system in all modes at the moment)

    2. You mentioned setting the permissions of the ad-injection directory to 777. Did you also try this with the ad-injection-data directory? This should be in the plugins directory as well, and is where the mfunc mode saved adverts go.

    3. What web host are you on? If I know this I might be able to see if there are any known problems/workarounds with your host.

    4. Was this plugin previously working for you?

    I want to get these warnings fixed for you, but after today I’ll be on my Christmas holiday, so it might have to wait until 5th January, although I should be on email, and approving comments on this blog in the mean time.

    Cheers.

  8. Hi David,
    Ad Injection will work fine in W3 Total Cache as long as you aren’t using the dynamic features (referrer and IP ad restrictions).

    I don’t think these work in W3 Total Cache at the moment. W3 Total Cache does support some kind of ‘mfunc’ tag but I don’t think it is 100% compatible with WP Super Cache’s mfunc tag, even though it looks quite similar.

    Testing (and making the dynamic features work) with W3 Total Cache is on my TODO list, and I hope to be able to start looking at this sometime in January.

  9. Hi forum newsgroup – I have just tested Ad Injection on WordPress 2.8.6 and it works fine. Therefore it *should* work on 2.9.2 as well. But let me know how you get on.

  10. Hi –

    Looks like v 0.9.4.4 worked – no more error messages. I am though, snow contending with the plugin not being able to write to the directory. I manually created an “ad-injection-data” directory and chmod to 777 but not solving the issue. I had a similar issue with another plugin but can’t recall how I solved it. I’ll keep thinking it over.

    Have a great holiday

  11. On Archive pages, I get the error:
    Call to undefined function adshow_display_ad_file() in ….. /wp-content/plugins/ad-injection/ad-injection.php(304) : eval()’d code on line 4

    How can I fix this?

    Thanks!

  12. Hi John,

    Thanks for reporting this. I think I know what the problem is and have submitted a fix. Please upgrade to version 0.9.4.5 of Ad Injection which has a fix that I think will solve this. You will however have to clear your WordPress cache to allow the adverts to be re-written to the archive pages where this error is occurring. Please let me know if this fix works.

  13. Hi there,

    I have a plugin conflict with vbbridge:
    Cannot redeclare get_userdatabylogin() in /../wp-content/plugins/functions_vbbridge.php

    This is the problem line in vbbridge:
    function get_userdatabylogin($user_login) {

    How can I change the adij code in order to let it work with vbbridge (I definetely need vbbridge to work too….)

    thanks
    marco

  14. Hi Marco,

    I was doing something wrong by including a file that I shouldn’t have, and vbbridge was doing something wrong by declaring a function without checking if it was already defined.

    I’ve fixed Ad Injection now with version 0.9.4.6 so Ad Injection won’t cause this problem, but it is possible that other WordPress plugins could break vbbridge in the future as vbbridge still has the error in it.

  15. I can get the top and bottom ads to show but not the random ones. I’ve checked the debug stuff and can’t see where the problem is.

  16. Hi mgray,

    I’ve had a look at your website and there is something interesting going on – either due to the Thesis theme or the way PHP is working on your server.

    The debugging on the HTML pages claims that all ads have already been used up, and yet the random ads are obviously not there.

    I’ve added the following update which should fix your problem.

    global $adinj_total_rand_ads_used;
    if(is_page() || is_single()){
    $adinj_total_rand_ads_used = 0;
    }

    Let me know if you still have any problems.

  17. help please

    your plug in doesnt currently do this and hopefully it will in the future… but basically i want my adsense ads to show everywhere EXCEPT a certain location (like in the state of California)

    Is there a way to achieve this?

  18. Hi Andrew,

    Thanks for you comment. This kind of restriction is something I have very briefly thought about before. I can see why some people might want this restriction.

    It is technically possible. You can get a database linking IPs to cities from MaxMind http://www.maxmind.com/app/geolitecity , although there are limits to the accuracy of the data.

    And this feature would only work in direct_dynamic mode as it would require a database query for each page view (the only practical way of looking up the location is to have the IP data in the MySQL db).

    It is something that I might do in the future (it is possible I could do something in 2011, although I can’t promise anything), but there are a lot of other features I want to implement before doing this.

    I’ve made a note of this in my long range TODO list.

    Cheers.

  19. I have placed three ads in my sidebar, and on single post pages, the 3rd ad always shows up blank. All 3 ads work on the home page and multiple post pages. I’ve double checked my global and sidebar settings and everything should be good. The ads are Google Ad Word Image ad. Tried multiple sizes, nothing changes, always the third ad is blank on single posts. Am I doing something wrong?

    WP version: 3.0.4
    Ad Injection: 0.9.5.2

    Love your product BTW.

  20. Hi Mike,

    Thanks for your feedback.

    I’ve had a look at your website and I think I know what is going on.

    Google’s AdSense TOS state that only three ad units and three link units may be placed on a page. On your front page you only have the three sidebar ad units installed so they show correctly.

    On your post pages you also have a top ad unit displayed. Therefore Google is only delivering the first three adverts. If you look at the HTML source you’ll see that the Ad Injection plugin has injected the four ad units into your page, but Google is only allowing the first three to show.

    You’ll have to decide which three adverts are most important to you. If you want four you’ll have to include one from another ad provider (if that is allowed by both ad providers – check each set of TOS carefully). Or alternatively you could make one a AdSense link unit instead.

    Hope this helps.

  21. Please add this vital feature:

    1. ads should not be displayed to users who visit a particular page in blog.
    It means after visiting that page he should not see ads on any page,what so ever he do.whether he again tries to come from search engine.

    To achieve this what i think is :
    a. create a field in settings page to enter url to be monitored.

    b. know the ip address of visitor who visits that page.

    c. add that ip address instantly(automatically) to block ip list.

    Now that visitor will never see ad even if he come from search engine till his ip changes.

    d. to add further intelligence you can use a combination of ip and cookie to trace the same user.
    For ex. if the IP address of blocked visitor changes,and next time he visits the site,cookie stored in his browser from previous session tells that he is blocked so his new ip is again added to blocked ip list,irrespective of him visiting the monitored url or coming from search engine.

    I hope that you please add a,b,c or if possible d to your plugin.
    It will really help me and many others.
    Thanks a lot for such a great plugin.

  22. Thanks very much for your Ad Injection suggestions.

    Being able to place an ad above the title is a really good idea. I’ve added it to my TODO list. Hopefully I’ll be able to do something about that in the next few months.

    You idea about being able to permanently block certain visitors is interesting, but would be quite tricky to implement in full. I can’t honestly see myself adding the feature in full (A->D).

    A cookie based version of A->C is something I would consider in the future, but I couldn’t see it being worked on any-time soon (probably not in the next 6 months).

    Sorry about that, but thanks for the feedback.

  23. Hi Admin,

    Thanks for the plugin. I’m interested with A/B split testing. How to get report of the testing? I need that to know which ads get the best CTR.

    thanks

  24. Hi Samuel, you haven’t said which ad provider you use so I’ll use AdSense as an example.

    With AdSense there are two ways you can do this:

    1. Create a separate channel for each ad variant (using Google’s AdSense interface). e.g. banner1 and banner2.

    2. Or if you use the new AdSense interface it will automatically record the performance of each ad saving you the trouble of having to create channels. Go to Performance Reports and then using the drop down box on the left select ‘Ad units’

    For both:
    Then set each to rotate at 50%. Once you have a sufficient number of clicks (I’d suggest at least 100 clicks, but 1000 would be much better) you should be able to see which ad is the best. Then you can test the winning ad against a new one.

    You can do split testing with more than 2 ad variants, but I’d only suggest doing this is you have high numbers of clicks. You need a lot of clicks to get an accurate indication of which ad is best.

    What ever ad program you are using the CTR data will be provided by your ad provider – this isn’t something that Ad Injection will help you with.

    Hope this helps.

  25. Hi Admin, thanks for your answer.

    I tried to activate the plugin, turn on the ad and fill 2 adsense code into for the top post / page for A/B split testing. Each one rotate 50%.

    I setup for homepage only but the ad did not display. Did I miss something in setting?

    many many thanks,
    Samuel

  26. Hi Samuel, the best thing to do is turn on debug mode and then in the HTML source you should hopefully see a ADINJ DEBUG block which will give you the reason why then ads aren’t displayed.

    Looks like your front page is actually of a ‘page’ type rather than a ‘home’ type (the WordPress definitions of what is a ‘home’ page is a bit confusing* – as is the Ad Injection UI). Try unticking the ‘page’ restriction and see what happens.

    I’ve just submitted 0.9.6.3 which attempts to clear up the differences between ‘home’ and ‘front’ pages, both in the UI and in the debug messages.

    Hope this helps.

    * The front page and home page can be different! See
    http://codex.wordpress.org/Conditional_Tags#The_Main_Page

  27. Thanks for this useful plugin.

    Can you add an ad blocker detection?
    For example on this webpage: http://www.playtv.fr/television/france-2 (a French public TV channel), if you have an ad blocker (like AdBlock), you will be redirected to a page asking to disable your ad blocker on this site because it is financed by the advertisements.
    Is it possible to do a similar thing?

    And updating your plugin is good, but maybe you’re making too quick updates ;)

  28. Hi Thomas, Thanks very much for your idea, that’s an interesting one.

    Ad Injection has support for alternative content (at the moment it is only be displayed if the specified referrer or IP address conditions are met) so I could potentially add an option that displays the alternate content if Ad Blocker is installed.

    I don’t think I’ll get round to doing this any time soon, but it is now on my list of future features.

    And sorry about updating the plugin too often :) Recently there has been a lot of new features and bug fixes going in. I expect the level of updates to decrease very soon as I’ll be starting work on another (very different) plugin.

  29. Reviewed a few and your plugin looks to be the one i’ll be going with. I do like that some of the other plugins include Google’s Adsense Search integration for your wordpress site as well.. it would be nice if yours also included this so I wouldn’t need 2 plugins.

    keep up the great work!

  30. Hum, this plugins is perfect. But i’ve think at two things : first : do you can remove the limit of ads rotate, five to as much as we want. And, a code systeme for integrate an ads where the plugin can’t add publicity, like header and other side of many template. Example : {pub1} for call the publicity where the code is.

  31. Hi Yogzel, Thanks for your feedback. I would like to be able make the plugin accept more ads, something I hope to do in the future. Out of interest how many ads do you need to rotate?

    In the mean time you could probably use Ad Injection with either Google Ad Manager or OpenX Ad Server to allow you to rotate more adverts.

    Also a method of inserting ads into any location using either codes or hooks is definitely something I want to do. Perhaps in the next few months I’ll get round to that. Thanks.

  32. Looks like useful plugin for me with one need. I suggest to have “show ad by Author” restriction. So if I have multiple authors posting content on my blog, I can show author’s ad code on his posts with impressions shared.

    Hope you would implement this.

    Thanks

  33. Hi Vinay, Thanks for your suggestion. I like that idea and I hope to be able to do it soon for widget ads (hopefully in the next month). I’d also like to be able to do it as well for top/random/bottom adverts but that will be more complicated to implement so it will take longer (hopefully I can do it later this year).

    In the mean time if you needed to assign different ads to different authors you can use PHP in the ad code box to differentiate by user. Here’s a quick example:

    <?php 
    $author = get_the_author();
    if ($author == "john"){ ?>
    This is John's Ad.
    <?php } else if ($author == "paul") { ?>
    This is Paul's Ad.
    <?php } ?>

    Note this will only work in direct_dynamic and direct_static modes. It won’t work in mfunc mode!

  34. Currently busy building a new website for http://www.numaga.com. Your plugin seems to do the job well in posts and pages, but I was actually looking for a way to insert banners into my header, right below the search box. Is there a way to do this with the plugin? That would be really neat, thanks!

  35. Hi Numaga, Yes that is something that I want to be able to add more support for. If your theme has a widget area in the correct place then you will already be able to insert an Ad Injection widget unit there.

    I’m guessing however that you don’t have a conveniently placed widget area!

    The difficulty with inserting ads into header/footer areas via a plugin is that there are no standard WordPress hooks to do it – this is because the design of a header/footer is theme specific. When I do add this feature it will require adding a very simple line of code into your theme at the correct place. You will then be able to manage the ad location via the plugin.

    In terms of when I will add this feature, it will probably be in the next 2-3 months. In the mean time you will either have to directly add the ad to your theme, see if you can find another plugin to allow you to do this, or create a new widget area in your theme…

    If you can do some simple programming then you can add a widget area to the correct part of your theme. Then you can use Ad Injection to add the ads to this area. There’s a tutorial about doing this here – http://buddydress.com/2010/04/add-a-widget-anywhere-in-3-simple-steps/

  36. I’m a beginner, so I’ll probably sound stupid, but I’d like to place ads at the bottom of each post on my blog. I installed your plugin and pasted this code in “optional bottom advert” section of the setup page:

    [Ad code – snipped]

    Do I need to do something else to this code to make it work instead of pasting it in like this? Sorry so dumb, but it seems like it needs to be something more than this. (This is what my ad company provided me)

    What I’d really like to do is have the ad appear IN BETWEEN posts on the main page, but I don’t know how to do that either.

  37. Re: The Damsel in Dis Dress – After an email exchange we got to the bottom of the problem. There is a bug in Ad Injection that occurs if only the bottom ad is selected in mfunc mode. I have the fix already, and it should be released on Friday, along with a load of new features :)

  38. I have one more question/request :)

    I’m currently using the category filter so I can make sure my “normal” ads are not displaying on the same page as NSFW content. The problem with that is is that there are no ads showing at NSFW pages at all now. As we all know, NSFW content is very popular on any blog so I’m really missing a huge amount of visitors that I can’t target with ads now..

    Would it be hard to implement a feature so I can “not show” the “normal” ads ads in 1 category and “do show” the NSFW ads in another category?

    It would require something like this:

    “optional top advert 1 (single post and pages only)”
    “optional top advert 2 (single post and pages only)”

    “optional bottom advert 1 (single post and pages only)”
    “optional bottom advert 2 (single post and pages only)”

    and of course 2 extra fields, doubling the Category and tag conditions so I can set which ads to show and which not to show in that same category.

    Kind regards,

    Chris

  39. Hi Chris, You can already do this from the UI for widgets, and I am intending to add this feature to the UI for the top/random/bottom ads (but it will be a while as the way I’m intending to do it is a bit tricky).

    In the mean time you can achieve this really easily with some very simple PHP (you can insert PHP into the ad boxes which lets you do some really powerful targeting of the ads). I know this is a much needed feature so I’m going to add this information to the FAQ for the next release. Below is my intended FAQ text with examples which I hope will give you the answer.

    Don’t forget to disable your category filter if you are filtering out a category that you want to show ads on via this method.

    = How can I show different ads for different categories? =

    If you want to show different ads for different categories using widgets you can set up filters for the different ads from the widget UI. If you want to show different top, random, or bottom adverts on different categories you can use some very simple PHP in the ad box (this will also work for the widgets as well if you don’t like the UI method).

    Note this will only work in direct_dynamic and direct_static modes. It won’t work in mfunc mode!

    Example 1 – one category specific ad and a general ad

    
    Japan advert
    
    General advert
    

    Example 2 – Two different ads in two different categories. Pages which aren’t in either category have no ads.

    
    Cheese advert
    
    Milk advert
    

    See http://codex.wordpress.org/Function_Reference/in_category for more information on in_category.

    You can do the same for tags using has_tag. See http://codex.wordpress.org/Function_Reference/has_tag for info.

  40. Thanks for the quick reply once again RML. Anyway this goes outside my book as I have very little PHP knowledge. You said “you can use some very simple PHP in the ad box”. Are you referring to the ad box where I add my ad codes –> like the “optional top advert” for example?

    I tried that but it didn’t work, it showed both ads in all categories and the php code was visible in the posts as well. Maybe I done something wrong and need to give it another try, but if I need to add that small piece of code you stated above in a certain PHP file, which php file is it?

    If i can’t get this work, I’ll just have to be patient and wait for the implementation in a future update.

  41. Today I see 0.9.6.6 but I cannot find the changelog. It was the same a few days ago when 0.9.6.5 was showing in updates but it took a while to see the changelog.

  42. Re: Numaga comment
    We figured out that the problem was that the PHP tags had been corrupted. A space had made its way inbetween the less than symbol and the question mark. So ‘< ?php’ was being used instead of ‘<?php’. Fixing the three PHP tags solved the problem.

    For anyone else trying to do this the PHP code does go in the same box as where you put the advert. No extra files are involved.

  43. Hi Dlinger – that is very strange. I can only guess that there is a problem on wordpress.org at the moment as the version history should update automatically. Hopefully they’ll fix the problem soon. For reference here is the text:

    = 0.9.6.6 =
    * Widgets can be conditionally included on pages by category, tag, and author.
    * Widget ad pool size increased to 10.
    * Fix for using just bottom ad in mfunc mode.
    * Less JavaScript on admin pages.
    * Global author exclude option.

  44. Hello,
    i tried to target my ads by country (using Country Filter plugin) and a simple if-else code, but i wasn´t able to make it work even with direct_static (i have WP Super Cache, so i tried this one).

    Could be something that i made wrong or this is the kind of thing that is not supported yet?

    Code used:

    <?php if (function_exists(‘isCountryInFilter’)) { ?>
    <?php if(isCountryInFilter(array("br"))) { ?>

    other code

    <?php } else { ?>

    adsense code

    <?php } } ?>

  45. Hi Julio, I’ve tried your code, and it is working great for me in the direct ad insertion modes.

    I’m guessing this problem is caused be caching – either in your browser, by a WordPress plugin, or a network cache that you are using.

    A quick and easy way to see if the ad is really updating is to stick the current time above it. Try putting <?php print strftime(‘%c’);?> at the very top of the ad code box.

    Then try to work out what cache is preventing you from seeing the updated page. Certainly turn off any WordPress cache plugin, and clear its cache. If you use FireBug with Firefox you can tick the ‘Disable Browser Cache’ button in the Net pane. Firebug may be helpful as well for checking the timestamps of the pages you are seeing.

    The problem with your menu may well be caused by your ad code. All Ad Injection does is to insert the code you tell it. But it will also surround the ad code with a div containing information about margins, padding and alignment if you enable these options.

    Often if the right sidebar ends up below the content it means that the content and sidebar have become too wide to be shown side by side. There is probably an element (could be an ad) which is too wide. Again Firebug is great for debugging these kind of problems.

  46. Hi Anand, see my reply to Vinay’s comment above for an answer. If this doesn’t help send me more details of what you are trying to do.

  47. First of all thanks for the wonderful plugin. The latest version of your plugin 0.9.7.1 is not working properly on my site. It’s simply not showing the top and bottom ads. Thought of letting you know as others may also be facing the problem. Do check out.

    And thanks again.

  48. Hi Amiya – thanks for reporting this. The problem is now fixed (as you confirmed to me by email) in version 0.9.7.3.

  49. I need a solution similar to this plugin but it needs to support multiple users (injection of affiliate id into ads) and impression rotations based on author ad sharing percentage. If you can code a plugin for this, at a reasonable rate, (or know someone that can) please send me an email. I don’t particularly want to go through Freelancer or sites like that. Thanks.

  50. Hi iwalkfunny. Thanks for the suggestions. You can already do ads by author with ad rotations using the widget ads.

    If you are willing to put a bit of PHP in the ad boxes you can do ads by author for the top/random/bottom ads. There is a code snippet in an earlier comment showing how to do this. The top/random/bottom ads support ad rotation as well.

    If you wanted the widget functionality on the top/random/bottom ads it *may* (I’ve never tried this) be possible to directly inject widget areas into the post, which could then be configured via the widget area (this would require you to do some PHP mods to your theme).

    If you give me more details of exactly how you want the ads to work I can let you know how likely it is that Ad Injection will be able to do it (either now or in the future).

    In the next 2-3 months (maybe) I’m planning on adding ad ‘pre processing’ support which would allow attributes like the publisher/affiliate IDs of a template ad to be adjusted before being injected into the page. This would make it easier to do author sharing for a large number of authors.

  51. Hi Lisa, Ad Injection will only put ads on pages generated by WordPress. The printable pages on that site you linked to are generated by a custom script. If you generate your printable pages using a custom script then Ad Injection won’t help you.

    If however you use a plugin that generates printable pages using the WordPress engine then Ad Injection might work, but it depends on what the printable page plugin does with the page content.

    I have verified that Ad Injection will work and inject ads using the WP-Print plugin. If you are using a different plugin you’ll have to check yourself.

    Hope this helps.

  52. Hey there! I love how this is all set up. Very clean. I’m sure this was asked but I just dont have the time to read through all of the posts, but is there a way I could add all of the ads in the footer where I’d like it? I would love to use your plugin if I could. This is more for a City Hall site. Really doubt they would like to have ads running through the middle of the site but they have some companies wanting their ads on the site. Let me know! Thank you!

    p.s. ill donate if you have to do extra work to make it work :P

  53. Hi Adam, Thanks for your comment. By the footer I’m guessing you mean the area that is right at the bottom of the page? Not the area right below the content where the current ‘bottom’ ad can be placed?

    The problem with footers is that they can be quite theme specific. There is a hook that can be used called ‘the_footer’ but not all themes use it, and some themes don’t use it correctly.

    I am planning on adding support for a ‘footer’ ad using ‘the_footer’ hook – maybe in the next month (for free!) – but how well it will work will depend on your theme. I’ve had a few people asking for this – so I definitely want to add this feature.

    If you can’t wait that long another option is to add a widget area into the correct place of your theme’s footer area. This would allow you to use Ad Injection widgets to insert the adverts.

    There is a link to some information about creating a widget area in your theme on one of the previous comments here: https://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/#comment-5076

    Hope this helps.

  54. Yeah that would be cool. As long as I had the code that makes your others work I should be able to figure out the rest on where I want it positioned in the theme.

  55. Hi Matthias, Yes when Ad Injection reaches a more stable state I will add proper localisation support. At the moment I’m changing Ad Injection too often – any translation would be out of date very soon.

  56. Wow! This is really amazing – like a full Swiss Army Knife of tools.

    My only thought is that you call it “Ad Injection” but it could be “Anything Injection” and I can think of all kinds of uses that have nothing to do with ads… as well as the fact that it’s amazing for ads.

  57. To follow up on my previous comment… One possible use. If I have a blog that tends to end up with long, long blocks of text, which I have been known to do, I could imagine just having 10-20 topical images available just to break things up a bit even if I don’t want to sell actual ads.

    Or I could use it to stick in an author resource box at the bottom of articles on a multi-author blog that has ads, without needing an author box plugin (assuming each author has a category or tag.

    Or [feature request] with some tweaking to associate given “ads” with given categories (instead of just rotating) and using your category filters, I could stick an appropriate image, text block or who knows what at the top of each category[/feature request]

  58. Hi Tom, Thanks for your comments. Yes as you have spotted you can inject anything, it doesn’t have to be an ad. You can inject other text, images, JavaScript and PHP.

    Thanks for the feature request – this is something that I’ve had a few people asking for. It is something that I am planning on adding, but it won’t be soon – but hopefully in the next six months.

    It may initially take the form of a ‘content pre-processor’. It might allow you to define a template ad in the ad boxes, and then create rules that will allow the ad/content to be modified depending on the page categories, tags, authors, etc. Later I might allow you to separately define completely different ads/content for different category types, but that is some way off.

    In the mean time if you are willing to write some very simple PHP into the ad boxes you can do this right now. Here is a very simple example:

    <?php if (in_category(‘japan’)) { ?>
    Japan content
    <?php } else { ?>
    General content
    <?php } ?>

    BTW – The specific ads by category/tag/author feature is already supported by the widgets, so one possibility which I think would work for the author box would be to have a widget area at the bottom of your page. The is a link to a page describing how to add new widget areas to your theme in one of the above comments.

  59. Hi Pascal, This is a good idea. I’m going to put it on my TODO list. Not sure when it will get done though – but you aren’t the first person to ask, so hopefully it will be done!

  60. I recently sent you a request to add centering functionality to the sidebar widget for Ad Injection. I was very frustrated that my ads were all left justified in the sidebar space.

    I am amazed by your lightning fast response! It took what, maybe two days, and you released an update with exactly what I asked for. I just loaded it a few minutes ago, adjusted my sidebar widgets and BAM! Great ad placement thanks to you.

    My site is relatively new but, be assured, I will be publishing an article soon on using your plug in. The support you give is as exceptional as the product itself.

    Many Thanks,

    Editor in Chief and Webmaster, worldfreenews.com

  61. Great plugin. This solves every problem I have had trying to get adsense to display properly on individual pages vs posts!

    Thanks!

  62. Great plugin! Thank you for all your great work on this!

    I have a feature request for this that I have not been able to find in any other plugin. Could functionality be added to block/hide ads on a specific role level, or for paid subscribers/premium members? I have a need to support the site for free users via ads, but give the option for users to pay a small monthly or yearly fee for some premium content, including a removal of the ads.

  63. HotJoint – this plugin does not support impression/click stats. That is something that your ad provider will almost certainly do for you. I am not planning on adding impression/click tracking to the plugin.

    Jordan – that is a really great idea. Thanks very much for suggesting it. I think I will definitely be adding that feature. Perhaps it will make it into the plugin by the end of April or during May.

  64. If there’s more than one random ad slot on a post, the same ad is displayed in each slot, even if multiple ad variation have been entered.

    I’d like to see each random ad slot display a randomly selected ad, independent of each other.

    Another addition I’d like to see is the option to place the top ad after a specified paragraph (like with random ads).

    To do that currently, I need to use random ads. But I also like having an ad in the middle of my content. With the plugin as it is now, that second ad shows the same as the first ad as I described above.

    Otherwise, Ad Injection is a brill plugin.

  65. Hi Gary, thanks for your suggestions. You have some good ideas there.

    1. Picking a random ad from pool for each random position – this is something I definitely want to do, if you are using your own ads rather than ads from someone like AdSense I can see this being very useful.

    2. Top ad after specific paragraph / different middle ad – I can see that being useful, but I think I’ll put that lower down on my list than the first one.

    But once feature 1 is implemented you’ll be able to get a similar effect by selecting a starting position for the random ads, and then choosing to use different ads for each position. If I added two options to the ‘different ads’ feature – one to randomly select an ad, and the other to select them in order, you’d get this effect by putting the top ad in position 1 and the random ads in position 2 and above.

    All these ideas are now on my list, so hopefully I’ll be able to work on them later in the year.

    Thanks!

  66. I don’t have any bugs or feature requests…just wanted to give you some props!

    I’m about to officially launch my site, so I’ve been pouring over plugins for ad management. After reading all 79 comments on this page, I’ve decided to go with Ad Injection. I’m very impressed with how quickly you respond to everyone and how open you are to adding new ideas to your TODO list. The fact that this plugin is actively in development is a huge draw too.

    NIce job! I’m installing this plugin on my site now.

  67. I love how easy it is to add ad with your plugin! the ads appear exactly where I want them and the ability to manipulate them is fantastic! Unfortunately, I’m getting an error when I enable it (at the top of every post):

    Warning: preg_match_all() [function.preg-match-all]: Compilation failed: support for \P, \p, and \X has not been compiled at offset 1 in /var/www/vhosts/our_web_site/httpdocs/wp-content/plugins/ad-injection/ad-injection.php on line 799

    Line 799 appears to be the define for WORD_COUNT_MASK

    Any thoughts?

  68. Hi Liane, You’ll get this error if you are using a version of PHP which is less than 5.1.

    These flags are related to word counting of non-Latin languages (e.g. Arabic). So if your website is either using Latin characters (e.g. English), or isn’t using the word counting restriction you could hack Ad Injection to remove the warning. Changing:

    $length = str_word_count_utf8(strip_tags($content));

    to

    $length = str_word_count(strip_tags($content));

    should work.

    However upgrading your PHP version would be a much better solution. Once WordPress 3.2 is released later in 2011 you’ll have to use PHP 5.2 so your blog won’t work at all with the future WordPress unless you upgrade soon. Sometimes you can alter which version of PHP is being used by making a simple change to your .htaccess file. Which web host do you use?

  69. Thanks for the quick response. Alas, I only have control over the templates, not the server, so I’ll have to get someone else to deal w/the php upgrade.

    In the mean time, the workaround worked like a charm!

  70. Hi, thanks for your guide. I finally worked out how to use the Ad Injector. It takes some fiddling around but is kind of amazing when you work it out. A good way is to test by using the colored ad boxes first if you’re not sure. (Test ads). Thanks, Martin

  71. Love the look of this plugin.

    Here’s a question — is there a way to implement an A/B split test, comparing the same ad setup between two different locations within a blog post? For instance, comparing the performance between the same ads, one located at the top of the post, and the other after the 1st, 2nd, or 3rd paragraph?

    Thanks!

  72. Hi Greg, that’s a good idea, but there’s no way of automatically A/B testing the same ad at different positions with Ad Injection.

    You can easily compare the performance of different ads by tracking them separately (by using AdSense channels or similar).

    But tracking the same ad in different positions isn’t something the plugin can help you with. The only way you could do it with Ad Injection would be to spend some time measuring the performance of your current setup, change the setup, and then measure again.

  73. Thanks. I know how to set up different channels within adsense, but I’m having a hard time finding a straightforward way to set up an A/B test that will compare the influence of ad position on the page.

    Appreciate the help. Nice plugin, too.

  74. Great plugin – thank you!

    Here’s a couple ideas I have:

    1. Just like there is a URL whitelist (‘Show ads only to search engine visitors’), it’d be great to have a URL blocklist as well. For example, I like being able to only show ads to search engine visitors, but I would really like to be able to disable showing ads to Google Image Search visitors. In most cases, Google Image Search visitors don’t click on ads, so by not showing them ads in the first place you would be able to keep them from lowering your CTR, and possibly affecting smart pricing if you are using Adsense.
    2. Override for ‘Show ads only…’. I would like to have an override that would allow you to show ads to a non search engine visitor, if they have hit the current page from another page on my site. An an extension of my example in #1: Generally Google Image Search visitors not only don’t click on ads, but they also don’t browse the site. In the cases where they do browse the site – I’d like to show them ads on the second page they visit on my site.
    3. Geo-targeting. For my needs it doesn’t need to be as granular as #23 Andrew above, but I would like to be able to segment my traffic by country. Example 1 – show Ad #1 to United States visitors while showing Ad #2 to everyone else.

    These are features I’d be willing to pay for — just sayin’…

    Thanks again for a great plugin!

    GS

  75. Hi GS – thanks for your good suggestions.

    1. Good idea. It is on my list now!

    2. You can do this today if you add your own site URL into the list of search engines. That will cause ads to appear once a visitor to your site goes to a second page. Although it is titled as ‘search engines’ it is really a list of referrers. Maybe I should clarify that in the UI.

    3. See the FAQ ‘How can I show different ads to people in different countries?’ on the WordPress page for Ad Injection for details of how to do that. You’ll need to install another plugin alongside Ad Injection and use some PHP. I’ve no plans to add support for this to the UI for now, but I think the extra plugin/PHP solution is easy to set up.

    Hope this help.

  76. Just what the doctor ordered! Thanks for your help, and for such a quick response.

    GS

  77. Thanks for all your help with this. Really — great support. I’ve made good use of the random insertion. I just installed WPTouch Pro, and wondered if its possible to exclude mobile user agents from seeing the ads? Some of the ads I use are too large for the mobile WPTouch version, so using mobile ads are more suitable.

    Thanks for your thoughts! Again, really nice.

  78. Another quick question — is it possible to rotate between having two ads, one displayed after paragraph 2, and the other displayed after paragraph 4 (for instance)?

  79. Hi Greg,

    The exclusion by user agent feature is already on my TODO list – other people have mentioned the issue of running full ads on mobile devices as well.

    For your second comment I have started writing an update which would randomly pick an ad from the pool for each ad position (e.g. pick for p2, re-pick for p4, etc). Your suggestion seems slightly different but is a good idea. I think if I have the option to sequentially load them from the pool that would do what you want.

    Although I’ve started working on this it could be a while (many months!) before the feature appears due to my very limited time right now.

    Thanks a lot for the ideas!

  80. Wow! You’re all over it.

    I think using the current configuration, the idea would be to have ads assigned to different positions on the page, then randomly select one of those ads and inject it into the post. That way, you could compare a 336×280’s performance after paragraph #2 vs paragraph #4.

    Kudos for all your work on this!

  81. Adding a blog and this plug-in works great. Added a widget with the buddydress widget code and now have a top banner ad. Is there any integration around time or payment? I will be selling the ads to run monthly and want to make the enable/disable, payment and upload more automatic.

    Thanks again.

  82. One other quick question, is there a way to see the number of clicks on each ad? I added WordPress’ site stats, but the ad clicks do not show up.

    Steve

  83. Hi Steve, thanks for all your suggestions. All the features you are asking for are very advanced and I wouldn’t expect to be able to add them (at least not this year!).

    You might want to consider using Google Ad Manager or OpenX Ad Server in conjunction with Ad Injection. I think this will allow you to do the time, payment, and statistics integration that you want.

  84. Hi,

    Is there any chance you can add the ability to exclude/include ads by post id?

    Better yet have the ability to turn on/off ad injection from the post edit.

    Thanks

  85. Hi Arif, Excluding ads by post id is a good suggestion which I might be able to do at some point.

    If all you want to do is to exclude ads from selected posts (and if you can’t use the tag/category exclusions to do so) you can add a <!--noads--> tag directly to the post content. This will stop all ads from appearing on that page.

  86. This is a great plugin, and I’m interested to contribute in translation for this. I guess the support is not available. Correct?
    Well, you got my email, just let me know when you it’s ready.

  87. Hi Dhany, Thanks very much for you offer to translate the plugin. Right now the plugin is not correctly set up to be translated, but at some point in the future when I’ve got it to a stable point (i.e. after I’ve added most of the features I want to add) I’ll add the translation tags to the plugin and will get in contact. Thanks a lot :)

  88. Hi,

    first of all, your PlugIn is just great!!

    I have some wished / questions:

    1. On my Frontpage I see no Ads at all. I thought that I could get random ads between the listed posts see http://www.escamoteur.de

    2. It would be great, if there was a possibility to easyly display Image banners stored in WP media storage

    3. What do I do if I need more than 10 Alternative Ads?

    4. It would be helpful, if you not only could prevent inserting Ads in the last paragraph, but in the n-th paragraph like you did with the first ad on a page. If you use Bottom Ads it look quite ugly if you have a really short last paragraph with an random ad before and the bottom after

    5. Instead of setting “Always put first ad after n-th paragraph it would be nicer if you could set “Not before n-th paragraph” so that the position of the first add would vary

    6. An option to define how many paragraphs between ads would be helpful.

    7. Selecting the Number of adds bases on word count is fine, but it should be able to select more than 3000 Words and perhaps an additonal rule for the 4th ad. Alternatively it could help so set the number of allowed ads for certin posts with in-page tags, as some posts just don’t fit into the pattern and look ugly with too many ads (compare posts with a lot white spaces / pictures vs. posts with a lot of text)

    8. Direct support for country dependent ad selection would be great, or coould you explain a b it more how to do it with “Country Filter”, the short statement in the FAQ didn’t really help.

    I know, a lot of wished, but my birthday is near ;-)

    All the best
    Tom

  89. Hi Tom, thanks for all your great suggestions. I hope that at least some of them will make it into Ad Injection this year. I’ll go through them one by one:

    1. On the front page (and archives) the ads will only appear on the posts – not between them. I wish there was an easy way to make ads appear between posts – but I haven’t found one yet. Ads will only appear if your front, home or archives if show the full post – not if you show excerpts. Your front page is showing excerpts, therefore you won’t get any ads appearing (except for widget ads if you configure them).

    2. Cool idea.

    3. You can use a 3rd part ad server like Google Ad Manager / OpenX in conjunction with Ad Injection. Or you can write PHP into the ad slots to serve whatever number of ads you like. You could for example have 20 ads in slot one, and use PHP to print them randomly.

    4. Very good idea. I hope to be able to add that – maybe this year. In the mean time you can use the <!--adend--> tag in the page to mark the end point for the random ads.

    5-6. Both good ideas that I hope I can do.

    7. That setting used to go up to 20000! I’ve must have changed it by mistake. In the next update it will go up to 20000. If you want to make the change now alter line 396 of ui-tab-main.php to be:

    $ad_limit_settings = array(ADINJ_RULE_DISABLED,100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);

    8. I don’t think direct support for this will ever be in Ad Injection, but you can combine Ad Injection with another plugin (e.g. Country Filter), or an ad platform like Google Ad Manager or OpenX to achieve this. At some point (hopefully this year) I hope to start writing some tutorial about advanced usage of Ad Injection. Filtering ads by country is on my list of potential topics to write about.

    9. There is no way to donate right now. However if you want to show support then you could do something like; adding a link to this page; tweeting a link to this page; recommending the plugin to a friend; or report a bug. All totally free :)

    Thanks for the suggestions and support!

  90. hey great plugin but I use it not for ads but for split-testing widgets (opt-ins). Quick q – is it possible to show the number of displays for each opt-in…? I tag subscribers depending on whether they opted-in to form1 or form2, but I don’t have an easy way to see total displays. would be cool if you could add this feature – should be pretty easy.

    thanks!!!!

  91. Hi Richard, There is no way in Ad Injection to track the number of views. All you can do is to set the ratio of views for each ad slot. If you want to do tracking you’ll have to use a 3rd party tracking solution – e.g. you could use an image bug in the widget.

  92. On random ads (which is all I’ve tested) there seems to be a bug where it won’t show ads on very short posts–10, 20, 30 words or so. I have “No ads if shorter than:” disabled but it doesn’t change anything.

    I tried to post the debug info here, but it’s not taking it. Email me if you would like to see the debug info.

    Please let me know if there’s a fix for this.
    Thanks!

  93. I am totally new to the whole techy scene. So, I have been so delighted to have stumbled onto your plug-in which is so easy even I can use it! It has been up and running flawlessly since March.
    This week I got on and played with another plugin for an unrelated purpose. I don’t know if I did something or if it is coincidental. But now my ads are gone. I don’t know that the ads disappeared immediately when I was messing around. I just noticed it yesterday and nothing I have been able to do with debug or the settings is bringing them back. I uninstalled the new plugin that I had been experimenting with just in case.

  94. I bit the bullet! Uninstalled and reinstalled Ad Injection. All is well again. Thanks for this!

  95. I love this! It’s just what I was looking for to implement AdSense at my site. Great job – truly the best of the ad plugins for WordPress.

  96. Feature request : Add the ability for multiple authors inserting their own Adsense code. There’s zero reliable plugins that do this, kinda surprising. I’d be willing to pay for a plugin that does what this does, plus revenue sharing.

  97. Hi Tim, thanks for the suggestions. Author revenue sharing is a good idea. I probably won’t have time this year though. Perhaps 2012?

  98. Looking at this plugin after install it does everything I need bar one thing…

    The only way to stop adsense from showing in a particular post is to add the <!–noadsense–>/<!–noads–> code into a post, a lot of work when you have a big site! Is there another way to do it similar to adding the post ID like the whydowork plugin? (Which only has a little box you have to hunt around in if you change your mind on a post)

    Also, do the ads floated to top right etc automatically word wrap with the text?

    Thanks for your time, great plugin from what I have seen of it so far. Please contact me directly if I’m mistaken on the above or when it is implemented and I’ll definitely make the move to your plugin.

  99. Hi Chris, a good way to stop ads from showing on a group of posts is to exclude them via a specific tag or category. If there is no tag or category that these posts share you could create a specific noads tag that you add to these posts.

    Yes the text should word wrap around ads that are floated to the left or right.

    Hope this helps!

  100. Hi Chris, I’ve just released 0.9.7.11 which has UI support for restricting ads by post/page ID. Hope this helps!

  101. Excellent work ! One problem i can’t solve: how to assign random ads to certain categories one-by-one. And a question: is there a way to increase the number of random ads ? (my blog contains several categories)

  102. @reviewmylife

    Hi,

    Does this work on premium theme?Any premium theme suggestion that this plugin will work on?

    Thanks

  103. Hi Ed – if you want to target ads to categories you will have to do it with PHP. See this comment for how to do this. You’ll need to use direct insertion mode.

    Hi Marcus – the plugin should work with any premium themes as long as they are coded in the standard WordPress theme way.

  104. Extra info from Arif sent via email:
    Some review plugins and themes (woothemes) utilise shortcodes to insert buttons, tables, review tables etc. When adding the shortcodes to ad injection, it doesn’t render the button. Attached is a image of what I’m describing. I tested the use of shortcodes with WP-Insert and that worked out fine.
    ————–

    Hi Arif, Thanks for the details. I understand the problem.

    What is happening is that these shortcodes are being processed before Ad Injection is inserting the adverts.

    You’d want the shortcodes to be processed after the page content has been completely rendered so that it picks up the shortcodes in the ads.

    I’ve had a look at http://codex.wordpress.org/Shortcode_API and it may be possible for Ad Injection to optionally trigger WordPress to parse the shortcodes again after the ads have been inserted if a box is ticked. This would only work if the plugins used the WordPress shortcode engine, rather than their own shortcode processing framework. I don’t know if your (woo) theme does anything special that may affect this.

    Would you be able to send me a list of the shortcode plugins you are using? I’d be interested to see how they work.

    This might not be something I can fix soon, but I am interested in investigating this. I’ll have a look at WP-Insert to see how it handles the shortcodes.

  105. Hi Lesley – this plugin won’t work in Typepad – it is WordPress specific. And I’m afraid I have no plans to expand it to Typepad for now.

  106. this plugin caused my blog sidebar to slide to the bottom of the page! how do i fix it? is there a way to fix this?

  107. Hi ladyboy, if your sidebar has moved that is probably because the adverts you are using are too wide for your theme’s layout so with these wide adverts the sidebar can no longer fit next to the content. I’d suggest you try a smaller advert and see if that helps.

  108. Hi. Thanks for your plugin!

    I’m trying to use it “w3 total cache” and OpenX.

    I’ve created a Zone at OpenX and copied the code to a ad injection widget.

    My first ad are being displayed but, I can’t make my Banners Rotate.

    Looks like a OpenX cache. Do you know something related to this?

  109. Hi Bruno – Here’s some quick questions/suggestions: Are you using Ad Injection to rotate the ads, or are you using OpenX? Also have you tried seeing if it works with W3 Total Cache disabled? You might find the problem easier to debug if you disable W3 Total Cache first, and then re-enable it once it is working.

  110. Hi,
    Awesome plugin! Haven’t placed it into production yet just, testing it.

    Just a suggestion, would it be possible to only enable ad rotation on only certain lengths of posts.

    For instance, disable ad rotation on post less than 300 words and enable it on those longer than 500 words.

    This would enable rotation of 360×280 with 160×600 on longer posts.

    Thanks

  111. Hi,

    Thanks for your answer.

    I’m using openx to rotate the banners and I have disabled W3 total cache.

    Still have no luck show all ads… any clue? thanks again!

  112. Hi Bruno, if you are using OpenX to rotate the ads, and the ads aren’t rotating then this sounds like an OpenX problem. You should try contacting OpenX support if you can’t isolate the problem yourself.

    One suggestion for isolating the problem: Remove all the WordPress dependencies by creating a static HTML page, and put some OpenX ads on that. That will give you a quick way to test any changes you make to your OpenX setup. Good luck!

  113. I love your plugin, but was wondering if you had a pointer on one thing. I’m using the “Show ads only to visitors from these websites” feature which works great for all of the default options. I’ve tried, however, to add social networks (stumbleupon, reddit, facebook, twitter) even with their respective URL shorteners and the ads never show. Am I doing something wrong or is this a limitation of the plugin?

    Thanks again!

  114. Hi Nick – I’ve just tested Facebook and Twitter and they both work. For Facebook I used the referrer ‘facebook.com’ and for Twitter I used ‘t.co’.

    I noticed that if you use Firefox and the HTTPS Everywhere plugin the referrer seems to get stripped from Facebook. Are you using this plugin?

    As Facebook and Twitter work for me I’m guessing you might be doing something wrong – maybe try using the referrers that I suggested above.

  115. Hi, I’m trying to use your plugin in order to mimic the behavior of archdaily.com where it displays adsense only to visitors from search engine. However, this plugin doesn’t seem to work with w3total cache.

    My scenario :

    1. Access the web address directly. At first, it works, no adsense under the title.

    2. Access the web from search engine. Click a post. It displays adsense under title.

    3. Access the web address directly again, click the same post as step no 2. It displays the adsense when it shouldn’t since I don’t access it from search engine.

    Did I setup the plugin wrong?

    Thank you.

    PS : I didn’t mean to spam, just remove my website after you test it. Thx

  116. Hi Jason, it sounds like it is working correctly. What isn’t obvious from the UI (I have made a note to add something to the UI so this is clearer) is that this feature sets a one hour cookie so that once someone has visited from one of the listed referrers they will keep on getting ads for the next hour.

    If you want to test your site as a new visitor (your step 3) you can either clear the cookies for your site, or test using the private browsing mode of your browser.

  117. Hi rml,
    not sure whether you’re still checking the WordPress forums so I’m posting my question here:

    I have “top ads” activated for my home page. The home page shows extracts of the 10 most recent posts.
    I’ve set the maximum number of ads on the whole page to 5.

    This works, however the ads are injected for the first 5 post extracts. Is there some way to distribute the ads more evenly across the page, e.g by having them displayed for every second or so post?

    Thanks for your help.

    Steve

  118. Hi Steve, yes I do check the WordPress forums – I subscribe to the RSS feed for the Ad Injection tag, have Google Alerts set up for the keyword, and I manually check it :) I was out all day yesterday though so I couldn’t answer until today.

    Onto your suggestion: That is a really good idea – I like it. I had been thinking of adding a similar feature to spread ads evenly though the paragraphs of a post but hadn’t thought about doing this with multi-post pages as well. I’ll definitely put that on my TODO list. There are a few things for me to think about:

    1. Should I have a tick box to ‘spread ads evenly through the posts’?
    2. Should there instead be an option to set the gap (number of posts) between ads.
    3. What if ads are blocked on one of the pages that should have the adverts – should the advert go on the next page? e.g. if the ads are on every other page but page 5 is blocked should the sequence be 1,3,6,8,10 instead of 1,3,7,9?

    I’m going to think more about these, but I’m sure this feature will definitely get done. Maybe in the next 2-4 months.

  119. Thanks and my apologies for double posting.
    I can only imagine how much time you dedicate to this great plug-in…

  120. Hi, I would like to display 10 different ads on a page in the right column. I would like the ads to change position so that each one spends 10% of its time in each slot.

    I naively thought this would be really easy with your (very impressive) plugin or possibly another ad plugin. I now realise most ad rotators rotate ads in a single position. So although there may be 10 positions and you could rotate ads in them all. You can’t easily rotate 10 ads and make sure each one is always on screen but in a different slot.

    Maybe I’m being daft but if you can give me any pointers I would be eternally grateful.

  121. Hi Tim, you are correct that ad plugins will tend to do rotation based on a single position, with no linking between different position. Ad Injection is the same.

    The way I’d probably solve this is to use one widget, and then put some custom PHP in there to handle the rotation myself.

    If you look at the ‘Randomly picking from a pool of ads’ example on advancedhtml you’ll find code to pick one ad from a pool of text file ads. You could easily modify this code to successively print out each ad from the pool in a random order.

    1. Randomly select one of the ads.
    2. Print it.
    3. Remove it from the array.
    4. Repeat.

  122. Thank you for an incredibly quick and helpful answer. I spent last night pondering this and had come to a similar conclusion. I now need to use my not very good PHP skills to complete the task above! Thank you for your contribution to the Open Source community.

  123. Hi, I found your plugin and probably will use it (need change from Quick Adsense because of some setting problems.) But I have important question:

    Is it possible (maybe I didn’t fing it) or will be possible to set max number of ads for whole webpage? Not only max num of Top / Bottom / etc. but max number of all kinds of ads on one page?

    E.G.: In Google AdSense i can display only 3 ads on page. And I need to set max 2 ads for Top, max 2 ads for Bottom AND max 3 ads to display on one page (doesn’t matter in which part of page.) Do you thing about feature like this?

    P.S. Thank you for your work, it seems to be very good and powerful plugin. Before Christmas, if I will found it comfortable, I will send you little donation :)

  124. Hi Lukas, there is no single setting to restrict the total number of ads to 3. But you can set up the restriction by making sure that the max number of individual top/random/bottom/footer ads on the page is 3 or less. The restriction are on an ‘ad type’ basis.

    I may add the setting you have requested in the future – I’m aware of a few other people who would find it useful, and I might also add some kind of indicator to the UI to make it easier to see how many ads are configured for each type of page.

  125. Thanks for quick response, I did more tests yesterday and despite of missing global max setting (which can be solved as you wrote) it seems to be very good for my sites – better then any adsense plugin I tried before. Thank you from Czech Republic!

  126. Amazing plugin! The only reason I’m not using in all my sites is because I have some specific ad placement needs.

    One suggestion: if I manually add the code for an ad placement somewhere else (e. g. footer ad code on the sidebar), the original footer ad should be disabled and not appear duplicate. That would solve all of my problems :)

    Oh, and maybe creating custom ad position inside the plugin, without the need to create external text files, that would be amazing.

    Thanks for the plugin!

  127. Hi Peçanha,

    Adding a line of PHP either side of your ad (in the ad box) should allow you to limit it to making one appearance on each page. Here’s an example:

    <?php global $top_displayed; if ($top_displayed !== 1) { ?>
    [Your Ad here]
    <?php } $top_displayed=1; ?>

    It would be nice to be able to position the ads anywhere without needing to edit the template, but unfortunately this isn’t (easily) possible. WordPress only allows content to be directly injected at certain points in the page.

  128. Hi! Thanks for nice plugin!

    How about feature to insert ads between post in main/archive/search blog roll? I would like insert same ads blocks after first and before last posts in blog roll.

    Thanks!

  129. Hi ?, This is a feature that I would really like to add to the UI, but unfortunately WordPress has no hooks to allow content to be inserted between posts. Content can only be inserted in the post. Until they add support for this your only option is to modify your theme template. If you do this you can use the Ad Injection template ad feature to insert the adverts. Hope this helps.

  130. Hi Curated, yes you can use that method to add a bottom ad block in between posts. Thanks for the link, I think I’ll add that to the FAQ. You’ll find examples of how to use template ads in the ‘test adverts’ section of the Ad Injection UI.

  131. RML, thanks for a great plugin!

    One suggestion: It would be nice if your plugin allowed adding a word or a phrase like “Paid Ads / Advertisement” directly above or below the inserted ad. Here’s why:

    Sometimes the advertisements *must* be clearly separated from the editorial content. Google ads no longer have that label “Ads by Google” in the corner (instead, they have a small green triangle in the corner that expands into “AdChoices” upon mouse over). So the burden of properly labeling ads is on the webmaster.

  132. Hi Yakov, you can already do this by adding your ‘paid ads’ header to the ad text box. You can put it either before or after your ad, and then you can use HTML/CSS to align it as you like, and set the font.

  133. hi,

    is there a way to make an ad appear first more than the others? becoz now, i have put 3 ads and the ad that i like most to appear does not appear until the other two appears first.

  134. Yes, all you have to do is to set the rations for the ads on the ‘Ad Rotation’ tab. If you set the ratios to 2, 1 and 1 then the 1st ad would appear 50% of the time, the 2nd for 25% and the 3rd for 25% for example.

  135. @reviewmylife

    its not about ad ratio but my question is about loading adsense first with the highest click through ratio. scenario is, there are 3 ads appearing in different parts of the webpage. the sidebar ad and the ad before comments ad appears first before the banner ad at the top of the page using your plugin. is there a way to make the banner ad appear first before the sidebar and before comments ads?thank you

  136. Just wanted to say ‘thanks’ for Ad Injection. Great plugin, and I haven’t even begun to get ‘clever’ with adverts yet.

    As the widget has such a wide – and easy to use – range of options for defining where and when the widget is displayed, and the actual “text” box allows things other than straight-forward adverts, I’m planning to use it in preference to installing other additional plugins that allegedly do that!

    Fab! Definitely one I’ll recommend others to use … even if they don’t actually need an advertising function! :-)

  137. Hi, after update to 1.2.0.8, problem^

    Warning: Cannot modify header information – headers already sent by (output started at
    www/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:342) in
    www/wp-content/plugins/ad-injection/adshow.php on line 270

  138. I’ve just submitted 1.2.0.10 which should fix it properly. Sorry for any inconvenience.

  139. Hello,

    After reading all your comments here, it looks like you’ve put in alot of time and effort on this great plugin of yours.

    I had one request, and was wondering if this was possible (whether through an update on your part, or by some tweak or hack I could do on my end).

    Although I’ve only tested your plugin in test mode so far, it seems you plugin puts 15 pixels of space above (and possibly below) the spot where you want your ad to go by default.

    I see why this would be important in most senarios and circumstances, and why it should and is your defualt setting.

    I was wondering if there were a way to have no space above the ad, as in, where I place the ad, it appears at that exact spot?

    The reason I wanted to do this is I’m using one of the ads as a template ad, and placing the ad not in the post (where it’s good to have that default space) but in a spot within the template where the extra space just looks really funny and akward.

    If you could update if this isn’t already a feature that would be great, but if there were a different way on my end to cause the ad to function this way, I could do that.

    Thanks

    P.S. I also sent a message to you about this to your suggestions page.

  140. Hi Josh, Ad Injection doesn’t insert any extra spacing into the page, other than what you tell it to add. The spacing will be defined by the CSS for your page (whether explicitly defined, or default settings). You should be able to find what the margins/settings are set to by using FireBug and FireFox. You can then adjust the CSS as necessary. Hope this helps.

  141. Hi, Great plugin! Works like a charm. The only thing I wish I could do was block it from working on mobile and iPad. The Google ads are too big when displayed on WPtouch Pro. I tried blocking m.facebook.com in the settings (most of my traffic is from Facebook), but that didn’t work. I can block facebook.com and it blocks it on desktop, but still not on my iPhone. Any ideas?

  142. Hi Jack, there is no easy way to do this right now. You could modify Ad Injection to add this support, or if you are using direct insertion mode with no caching plugin then you can put code to block the ads into the ad boxes (you can put PHP in them).

    This is one of my most requested features so will probably be the next major feature I add. Hopefully in the first half of this year.

  143. Hi,

    thanks for your advice about the spacing issue. I was wondering if you had any advice on how to stop template ads from showing up on certain pages (like privacy policy, which is against TOS, which is why it’s an issue I need to find a solution for).

    I noticed in the template dashboard of my wordpress admin area, there is a note you put there that you are looking into a solution for this possibly already.

    Just wondering if you had found a solution for this, or even if you knew of a workaround I could add in of some sort. (like some php code or something that could cause it to exclude adsense from those pages).

    Thanks a bunch man.

  144. Hi Josh, the latest version of Ad Injection 1.2.0.10 supports the full range of filters for template ads. You’ll find them in the ‘filters’ section on the main page. The easiest way to remove the ads from the privacy policy is probably to use the page id filter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Do NOT fill this !