Dax

Adsense Injection

May 21st, 2006 · 463 Comments

doctor.JPGAdsense Injection!

DOWNLOAD v2.0

DOWNLOAD v1.9

I was looking for a simple simple Wordpress plugin that just inserted Adsense code randomly into a pre-existing blog. All the ones I found would only replace an Adsense comment with Adsense code. That’s great if you want to go through every article you have and post little adsense tags, but for a site that has some bulk to it, it sucks.

It also increased banner blindness by keeping the ads in the same place time after time.

My new Adsense Injection plugin just takes a random paragraph (or br tag) break in your article and inserts adsense code. It does one per story on multi-post pages (home, archive, category) and let’s you pick how many to show on single post pages. It lets you pick how many total ads to show at any time as well (0-3) and it lets you set the formats and colors you want it to randomly select from.

I’m using it on this blog if that gives you an idea of how it works.

Version 2.0 Let’s you show YPN ads as well as Google, although I can’t test it because they wouldn’t give me an account in their precious beta launch. : (

If you want to keep ads from displaying on specific posts, use the tag in the post HTML somewhere. I do that on a few posts on this site. Go look for them. It’s like a treasure hunt where no one wins!

If you want to keep ads from displaying above a certain point in a post, use the tag in the post HTML where you want it to start.

Here’s an example of how to fill out the Adsense Injection Options page. Use your own adsense ID.

adsense-example.gif

UPDATE 2.0
Checkboxes for
Do not show me my own ads
Put google_adtest=”on”.

I guess you can screw up your stats by looking at your own ads. Lame.
You can now pick either YPN ads, Google Ads or randomize them.
adsensestart tag now exists for people with images and whatnot
You can ad multiple ads on single page posts to really cram ads down people’s throats. Yeehaw!

UPDATE 1.9

Added a center alignment option. I also made the plugin work for people who don’t use the wysiwyg editor. It splits the post on <br instead of the paragraph tag. Giggidy gee.

UPDATE 1.8

Bit of a stupid paragraph tag ruining bug fixed today. If you were having problems before, this should fix it.

UPDATE 1.7

Put a new ad size in the code. Also, Danny from k2xl.com had the cool idea of putting a tag in a post or page that would prevent AdSense ads from being displayed. Now, if you put <!–noadsense–> in a post or a page, no matter what the other settings are, no ads will be displayed in that post anywhere. Category pages, archives, the home page, there just won’t be any ads on it. Thanks Danny! Awesome idea!

UPDATE 1.5

New version doesn’t mess up paragraph tags if they have class attributes.

UPDATE

Apparently my site couldn’t take the stress of a global Wordpress Dashboard link. Dang. Thanks for the link! Hope it works now!

UPDATE 1.4

Apparently running AdSense in your feed is against their TOS. Apparently this plugin also displayed ads if you were running your feeds in full text. I don’t do that because then they just get scraped by spammer dicks. This new update removes Ads from your feed if you were running full text. It also gives you the new 200×200 block

UPDATE 1.3

I think a lot of people are really going to like this update.

I added a set of checkboxes in the admin panel that will let you opt out of displaying adsense ads on certain types of pages:

The Home Page
Static Pages
Post Pages
Category Pages
Archive Pages

If you want to NOT display ads on your home page or on static pages, then just go click the corresponding box in your Options>Adsense panel. That oughta keep your grubby mitts out of my code!

UPDATE 1.2

I added the one huge banner, I think it’s 460, for everyone who likes running banners instead of little boxes that disrupt blogposts.

I also added an Admin only checkbox on the options page so you can preview your Adsense Injected blog for yourself without letting your users see. It actually previews your blog with Adsense for anyone with a user level above 8 — but if you know what that means you can probably change it on your own.

Tags: Wordpress Plugins

463 responses so far ↓

  • 1 Aaron Pratt // May 22, 2006 at 5:58 pm

    Sent you the interview and now you post two more interesting things, will have to update the questions? Adsense injection soulds pretty neato!! Check your email please…

  • 2 Christyk // May 29, 2006 at 1:13 pm

    Dax, this plugin kicks butt!! Quick, simple and works like a charm. I found my way here from Jensense. Thanks so much for this.

    If I may humbly submit wish items… Padding around the ad blocks as they run right into the surrounding text and - maybe? - option of rotating in some type of affiliate ads from maybe Amazon or eBay or such.

    Thanks again!!

    Christy

  • 3 hammer // May 29, 2006 at 1:20 pm

    Hey Christyk, Thanks!

    Both of those are good ideas.

    I think I’ll put the adsense in a div tag so you can specify your own margins, and maybe put a “Custom Code” text box in the settings so you can put in your own eBay or Amazon or misc affiliate stuff. I want to keep it as simple as possible.

  • 4 Thilak // May 29, 2006 at 5:06 pm

    Works great !!

    Thanks for creating such a wonderful plugin hammer.

  • 5 hammer // May 29, 2006 at 5:31 pm

    Cool.

  • 6 u // May 29, 2006 at 5:43 pm

    u got cool lookin friends, u lucky.

  • 7 CypherHackz // May 29, 2006 at 6:22 pm

    Inject Adsense in Your Post…

    Dax has created Adsense Injection a plugin for wordpress where it will put adsense script randomly in your post. The ads will change places each page view. It is really useful to reducing ads blindness spot in your blog.
    You can check the plugin in a…

  • 8 maxpower // May 29, 2006 at 6:42 pm

    Awesome idea, thank’s for sharing!

  • 9 Tony // May 29, 2006 at 6:46 pm

    Great plugin. In the future could you make an option to only have it work on the single page instead of the index page too? I love it but I only want it to work when people click to read the full article.

    Thanks, keep up the great work.

  • 10 Success Coach // May 29, 2006 at 8:59 pm

    Fantastic idea! I was looking for something this. I will try it soon. I second the comment about adding some extra padding.

    Thanks.

  • 11 Webmaster & SEO Blog // May 30, 2006 at 1:08 am

    AdSense Injection, aLinks und eBay Relevance Ads Plugin…

    Für Adsenser gibts ein neues Wordpress-Plugin: AdSense Injection. Damit können Adsense Anzeigen in einer festgelegten Anzahl an Beiträgen eingeblendet werden. Auch die Positionierung der Anzeigen kann per Zufall gewählt werden.

    Magst du keine A……

  • 12 unique // May 30, 2006 at 2:58 am

    Thx for the nice plugin! I have no adsense on my Blog because nobody clicked it but I will try your plugin soon!

  • 13 Dave G // May 30, 2006 at 4:14 am

    Nice work on the adsense injection. Come let the others know at the BV forums as I am sure they would love to use it :)

    Dave
    http://blog.brightonvibes.com

  • 14 ProWeblogs // May 30, 2006 at 5:50 am

    Plugin para WordPress AdSense Injection…

    Via ProBlogger, via JenSense, via mouse, via adsl me entero (al fin) de este plugin de concepto fantástico. La idea del plugin es permitir alternar código de anuncios AdSense en diferentes posiciones del blog para combatir la ceguera AdSense. El plu…..

  • 15 hacker not cracker // May 30, 2006 at 5:57 am

    Cool. I look forward to seeing later developments of this plugin.

  • 16 Brady // May 30, 2006 at 6:02 am

    Great idea to randomly place the ads, and a great plugin. I’ve edited the code slightly for it to output YPN ads instead of Adsense. Thanks for writing this!

  • 17 Jack // May 30, 2006 at 6:54 am

    its very interesting idea, lets see how it affects your earning. maybe next month u can writing about change in revenue generation after putting in this plugin.

  • 18 Quick Online Tips // May 30, 2006 at 7:02 am

    Wordpress Adsense Injection : Randomly Insert Ads in Blog Posts…

    Ad blindness is a common problem, which makes your visitors ignore your similar looking and always single position google adsense ads. Adsense Injection wordpress plugin will let you insert ads randomly in your post, reduce ad blindness and increase cl…

  • 19 hammer // May 30, 2006 at 9:40 am

    Tony: Yea, I could make something like a single page checkbox. I’ll throw that on the list.

    Jack: I made a dollar today if that helps! I had no Adsense displayed before and no way to put Adsense up because there was no plugin to go back and force Adsense into posts. You had to go back and edit each one. I agree with you though. I think some randomly bouncing ads will help fight banner blindness.

    Thanks for the feedback!

  • 20 Marcos // May 30, 2006 at 11:15 am

    Amazing plugin. Works like a charm!

    I just edited it to keep a 16px margin to the left/right to separate from the content of the post.

    style=”float: left; margin-right: 16px;”

    Also wanted it only to show text links:

    google_ad_type = “text”;

    If you have time, could add those options in the plugin configuration page.

    Thanx again ;)

  • 21 Martin // May 30, 2006 at 2:25 pm

    Hej,

    very nice plugin. I´d like to see more flexibility with the position of the ads on the website. A option to turn them off for the frontpage for example and a option to keep a distance between the ads and the text in single.php

    Would be nice if marcos would tell everyone how he edited the plugin to keep a margin. Let us now please :P

    thanks a lot
    Martin

  • 22 hammer // May 30, 2006 at 3:21 pm

    Yea, that’s a good point Martin. If anyone changed or added anything and thinks their code would be good in the plugin, email it to me or post it here!

    Thanks!
    dax[at]webguerrilla.com

  • 23 Marc Macalua // May 30, 2006 at 5:28 pm

    Sweet! I’ve been looking for something like this for ages. Thanks Dax

  • 24 hammer // May 30, 2006 at 5:40 pm

    Cool! Glad it helped you. I’ve got a bunch of other pretty simple and not so simple Wordpress plugins here. Take a look.

  • 25 Marc Macalua // May 30, 2006 at 5:54 pm

    A little help please:
    1-where do I insert my AdSense ID/channel?
    2-where do I set style=�float: left; margin-right: 16px;�

  • 26 Ryan // May 30, 2006 at 6:51 pm

    Thanks for the awesome Adsense code.

    I changed a couple of things that may help others…
    1) I wrapped the code in a table as I couldn’t figure out how (or where) to add the style=”float:left; margin-right:16px; and
    2) I wrapped that code to ensure that Adsense ads aren’t being displayed in WP’s preview area.

    One addition I’d like to see is the ability to control Adsense to NOT display ads on certain predefined WP articles/pages (maybe by using a tag - eg. , or writing the URI of the page/article).

    Anyway, for the changes I’ve made what was once…

    $retstr = ‘

    Is now…

    global $wp_query;
    if (!$wp_query->is_preview):
    $retstr = ‘

    ‘;
    endif;
    return $retstr;

  • 27 Keyword-Marketing.biz // May 31, 2006 at 5:58 am

    Wordpress-Plugin: AdSense Injection…

    Das Wordpress-Plugin “AdSense Injection” erlaubt es AdSense-Anzeigen bei einem per Zufall ausgewähltem Absatz eines Beitrages anzeigen zu lassen. Pro Beitrag ist so die Anzeige von einem Anzeigen-Block möglich.

    AdSense Injection…

  • 28 ricemutt // May 31, 2006 at 1:36 pm

    Thanks for creating the plugin! I added before and after the default code in $retstr to give it some padding so the ads are more inline with the text in my posts, so the code now looks like this:

    $retstr = ”;

    The numbers behind the margin go top, right, bottom, left, so you can adjust those to your liking.

    Seems to work great. Thanks again!

  • 29 ricemutt // May 31, 2006 at 1:45 pm

    Oops. Forgot div tags and such don’t show up in the comments. I’ll try to find another way to show what I did.

  • 30 hammer // May 31, 2006 at 1:58 pm

    Use this HTML Encoder

    And then Buy My Moustache.

  • 31 Forkqueue // Jun 1, 2006 at 12:48 am

    Excellent plugin, one of those things I’ve been meaning to do for ages but been too damn lazy to get around to!

  • 32 Ricemutt // Jun 3, 2006 at 11:45 am

    Ok, one more try. Thanks for the HTML encoder. Will have to bookmark that one. Nice moustache too, but it’d look funny on me since I’m a girl!

    Anyway, here are the div tags I put in to put margins around $retstr in the file:

    $retstr = '<div style="margin: 15px 10px 10px 10px";><script type="text/javascript"><!–

    [rest of code in between excised]

    </script></div>';

    The numbers after the margin go top, right, bottom, left, so you can customize those to your liking. Hope that works. If not, feel free to drop me a line.

  • 33 ricemutt // Jun 3, 2006 at 11:47 am

    Not sure what’s going on — here’s my last try to post the margin div tags:

    $retstr = '<div style="margin: 15px 10px 10px 10px";><script type="text/javascript"><!–

    [rest of code in between excised]

    </script></div>';

  • 34 Mike Ralph // Jun 5, 2006 at 4:21 am

    Thanks for this, really good.

  • 35 Cristian Mezei // Jun 6, 2006 at 5:58 pm

    So thanks a lot for the great work. It’s almost perfect.

    What it lacks, and what would make it perfect (for me at least), is the option to NOT show ads before the more tag (the tag that breakes the post), so that the ads won’t show in the frontpage and category pages (which look very weird).

  • 36 Cristian Mezei // Jun 6, 2006 at 5:59 pm

    PS: The 1-2-3 ads option doesn’t work for me. Only one ad is shown in each post, no matter what my setting is.

    Just to let you know.

  • 37 Cristian Mezei // Jun 7, 2006 at 7:20 am

    Hey Dax, can you approve my comment ? Maybe it was taken as spam by Askimet or something :)

  • 38 hammer // Jun 7, 2006 at 4:55 pm

    Cristian. Yea. I agree it could use that feature. The problem with all the features I have is where to put them.

    The 1, 2, 3 option is meant to work on a multi article page. One article per post. No matter what the plugin will only insert 1 ad into each post. The 1, 2, 3 option is there in case you used up 1 of your ad units as a banner or something.

  • 39 Cristian Mezei // Jun 11, 2006 at 10:09 pm

    The problem with all the features I have is where to put them.

    Hmm .. In the same admin page under options ? :)

  • 40 Mutty // Jun 11, 2006 at 10:15 pm

    Nice, but some way to keep the ads off the front page would be great.

  • 41 eLm0s // Jun 12, 2006 at 3:06 pm

    Hey, great plugin, but how does it work?
    I added it to my plugin list, and its there, but after that.. what do I do?
    thanks.

  • 42 hammer // Jun 12, 2006 at 3:40 pm

    Activate it. Then go to the Options > Adsense panel and check the Adsense sizes that you want to display.

  • 43 Mike // Jun 14, 2006 at 6:47 am

    Hi,

    Any instructions on how to install and what i need to change to add my own adsense code into it? Maybe I am missing something?

  • 44 Robertino // Jun 18, 2006 at 3:44 pm

    Hi Hammer or anyone else can help a poor begginer.
    I uploaded the njection plug in and is all fine, activate it but do not know how to use it. I noticed there is an option for editing but do not know what to enter and where…all i want is basicsto have my AdSense ads on my blog pages. I know nothing about programing language but could foloow simple instructions for editing and could learne fast, or perhaps am too old :-)NOT.
    Thank you so very much and will be waiting for help. you may also email me at robertinodeniro@yahoo.com

  • 45 Robertino // Jun 18, 2006 at 4:12 pm

    UPDATE…..
    It;s working wonderful. I did it. A big thanks for Hammer. Also inerested in your mustache Hammer since mine is geting gray… You are a genius hammer. Can I offer this plug on my resouce page which I am planning to build?
    Have a Wonderful Day!
    Regards,
    Robertino

  • 46 Robertino // Jun 18, 2006 at 6:26 pm

    NO It is Not working. I was basicaly pasteing my AdSense HTML code entirely on every post. I did not touch/edit the Plugin :AdSense Injection” as I have no idea where and what to edit. Pease heeeeelllpppp! What exacly is the plugin supposse to do? and how can I edit it with my Adsense code? Guess these are the questions. I would appleciate very much anyone’s help here. Thank you !
    :-)

  • 47 kulimboy // Jun 19, 2006 at 5:38 am

    It works perfect for me except for a post that have large dimension image on it. Sometimes it make the picture move to the bottom of the post. Adsense injection very suitable for post that have many text and not picture.

    However, thanks for the plugin, it has increase my ctr rate..

  • 48 Chris Bose // Jun 19, 2006 at 7:27 am

    I want to thank you for a great time-saving plugin which works perfectly. I made the div alterations from the comments with no problems at all.

    Much appreciated!

    I understand why some commenters are asking foor more features.
    Please keep it simple as it is. Then it will never fail, which is more important than having lots of features which only a small percentage of users will want anyway.

  • 49 Robertino // Jun 20, 2006 at 5:18 pm

    Hi again guys!
    Anyone can help me edit the injection plugin which is installed and activated on my site but do not know where and how to editit to show my Adsense ads.
    Thank you!

  • 50 hammer // Jun 22, 2006 at 1:41 am

    Hey Robertino,

    You just have to enter the elements of your adsense code into the Options > Adsense page.

    ID, colors. That should do it.

  • 51 Steve // Jun 22, 2006 at 6:31 pm

    Wonderful. Just what I needed.
    Thanks,
    Steve

  • 52 David // Jun 24, 2006 at 9:08 am

    Really awsome plugin I was looking for something like this.
    Thank you!

  • 53 warez-vip // Jun 27, 2006 at 7:39 am

    Os ultimos dois dias foram uma explosao na cabeca do Daniel Padua

  • 54 warez-vip // Jun 29, 2006 at 8:24 am

    As you can imagine, other members of the list have failed to resist the open goal.

  • 55 LZZR // Jul 2, 2006 at 9:36 am

    It seems just implemented both features requested here: namely flexible margins and AdSense not appearing in prewiev plus some other features - take a look here

    2 Dax: Thanks a lot for the Plugin - just could not stop myself from getting my dirty hands into your code. BTW chesk $11.77 and $77.77 bids on your auction.

  • 56 LZZR // Jul 2, 2006 at 11:56 pm

    Adsense Injection MOD…

    Dax Herrera had written a great Adsense Injection Wordpress plugin that injects Google ads in Wordpress.

    The only problem that it tends to break the code if a post does not begin with a <p> tag.
    This prompted me to start modding the plugin and …

  • 57 jaja // Jul 6, 2006 at 6:53 am

    wow this is a cool plugin! Thanks hammer! but i have observed that it garbled the starting lines of some of my post.

    what can i do about this? –>http://recipe.gotblab.com

  • 58 David // Jul 7, 2006 at 12:22 am

    Very interesting ads location: http://doctor-news.com

  • 59 taufix // Jul 9, 2006 at 8:50 pm

    Thanks for posting this, I really appreciate it. I didn’t noticed this plugin inside WP plugin directory.

    I’m starting a new blog about myself and Tech Stuff Gadget -> SimplyBuzz.com

  • 60 andy // Jul 20, 2006 at 1:01 pm

    jaja-
    the code does delete the first few letters of the post, really f***** everything up at first w/ my tables. you can eliminate this by fixing the following peace of code in adsense-injection.php.
    Scroll down towards and bottom and find the following line:
    $content = substr_replace($content, $replacewith.”", $pickme, 3);
    Replace the 3 at the very end with 0. This should fix it, I am not sure why it was a 3 in the first place, but haven’t seen any problems.
    Good luck.

  • 61 hammer // Jul 21, 2006 at 9:56 am

    Hey andy, that 3 is to replace theparagraph tag. If your paragraphs don’t start withor you’re using some custom tables in your posts, the plugin will definitely mess up your site.

    jaja, what is the problem on the link you posted?  Sorry I didn’t answer.  I’ve been gone since the 3rd.

  • 62 Geld verdienen im Internet // Jul 22, 2006 at 5:01 pm

    Adsense Plugin für Wordpress - Adsense Injection…

    Seit heute hat meine Pluginliste Nachwuchs bekommen. Das Adsense Injection Plugin für Wordpress.

    ……

  • 63 typ // Jul 25, 2006 at 2:18 am

    I’ve set everything up and would like to dock the ads below my content instead of on top of it. Is there an easy way to do this?

  • 64 hammer // Jul 25, 2006 at 10:00 am

    Yea, replace line 257 (the line that has substr_replace in it) with

    $content .= $replacewith;

    I think that’ll work

  • 65 new cellular phone // Jul 26, 2006 at 9:10 am

    I use this plugin in my cellular phone website. This rocks !

  • 66 mario // Jul 27, 2006 at 11:25 am

    Sounds good! Lets watch the CTR ;-)

  • 67 tqm_z // Jul 29, 2006 at 2:00 am

    Mmm… this plugin maybe my headache pain killer.
    Testing how it will works.

  • 68 hammer // Jul 29, 2006 at 8:35 am

    Well I hope so!

  • 69 Tony // Aug 1, 2006 at 5:32 pm

    Any progress on having the injection just show up on the single.php and not on the index.php

  • 70 hammer // Aug 1, 2006 at 5:41 pm

    Tony, if you want it to show up only on single post pages, change the line that says this:

    add_filter(’the_content’, ‘ai_the_content’);

    towards the end of the plugin, to a line that says this:

    if(is_single())
    add_filter(’the_content’, ‘ai_the_content’);

    You can do the same thing for the home page using if(is_home())

    Lemme know if that works.

  • 71 Baby-Ang3L ♥ // Aug 4, 2006 at 3:37 am

    I use the
    if(is_single())
    add_filter(’the_content’, ‘ai_the_content’);

    and its not working. >.

  • 72 tqm_z // Aug 4, 2006 at 5:50 am

    I found somehow that this plugin didn’t use channel, or probably my mistake. I can’t see any ctr from this plugin yet in http://www.simplybuzz.com/adsense/

  • 73 hammer // Aug 4, 2006 at 10:47 am

    tqm_z: I just looked at your blog and your adsense ads seem to be showing their channel just fine. Am I missing it?

    Baby-ang3l: Hmmm…is the plugin turned on at http://heroluvelisa.kawaiisite.com/ ? You can put an echo “test”; statement in the ai_the_content to see if it’s even getting called on single pages.

  • 74 Tony // Aug 4, 2006 at 4:57 pm

    Yeah I tried changing the code and it didn’t work. I even used echo to insert some text and got nothing.

  • 75 hammer // Aug 4, 2006 at 5:14 pm

    My mistake. Sorry Tony.

    At the beginning of the ai_the_content function put the following line:

    if(!is_single()) return $content;

    That will keep ads off every page but single pages.

  • 76 matrixmonkey // Aug 18, 2006 at 7:34 am

    hiya daz love the plug in but .what licence is it under as i was looking to mod it to suit my needs

  • 77 MatrixMonkey's WebLog // Aug 18, 2006 at 6:08 pm

    Biggnuts » Adsense Injection » Mod…

    I needed a word-press plug-in for google ad-sense that :~

    Didn’t require a masters in quantum physics to understand
    Easy to use and update for the users (not admins)
    Allow the user to update the colours to match the theme they are using *sav…

  • 78 woofer // Aug 30, 2006 at 2:58 pm

    Can I forget your plugin to show Ads at the ABOUT page? Look at my site, at the bottom there is a list of authoes and this plugin make it look ugly with ads. Sad.
    But plugin is really great!

  • 79 hammer // Aug 30, 2006 at 3:24 pm

    You can, but you’d have to do it by hand. Try sticking the following code in the beginning of the ai_the_content function

    function ai_the_content($content){
    if(strpos(getenv(’REQUEST_URI’), “about”) !== false)
    return $content;

  • 80 Michael // Aug 31, 2006 at 12:04 pm

    Thanks for this great Tool!

  • 81 hammer // Aug 31, 2006 at 12:19 pm

    Thanks Michael, glad it works for you.

  • 82 woofer // Aug 31, 2006 at 11:57 pm

    2hummer: thanx man, it works!!!

  • 83 Mark // Sep 2, 2006 at 4:51 am

    Great Tool! Thanks a lot ;-)

  • 84 lee // Sep 4, 2006 at 5:07 am

    Hi, Hammer! This is a great tool! I’ve found it months ago, but have just applied it on my new blog. Thanks.

  • 85 Carmen_N // Sep 7, 2006 at 3:08 pm

    I learned about this plugin from Jensense and it’s truly turned out to be a wonderful time-saver. It installed in seconds and was really easy to configure and get going. Thanks :)

  • 86 hammer // Sep 7, 2006 at 4:53 pm

    Cool. Thanks Carmen! Let us know what kind of adsense boost you get!

  • 87 Gadget Reviewer // Sep 7, 2006 at 9:07 pm

    Wonderful. I would recommend to display Adsense Ad only at single post.

    “At the beginning of the ai_the_content function put the following line:

    if(!is_single()) return $content;

    That will keep ads off every page but single pages. ”

    Works !

  • 88 gururise // Sep 8, 2006 at 11:12 am

    somehow your plugin does not work on posts that are fetched from a syndicated feed. I am using feedwordpress plugin (see: http://projects.radgeek.com/feedwordpress/) and all the syndicated posts do not have an adsense ad; however, posts I write myself do. Any ideas?

  • 89 gururise // Sep 8, 2006 at 11:14 am

    I forgot to mention my wordpress blog can be seen at: http://www.mortgagetricks.info

    Any ideas why syndicated posts do not show adsense ads?

  • 90 hammer // Sep 8, 2006 at 11:45 am

    mortgagetricks.info, huh? Nice.

    I’m not familiar with how the feedwordpress plugin works, but I would guess it bypasses the content call in Wordpress’ backend. Adsense Injection operates in the the_content hook. If that isn’t called, the new content won’t be injected.

    Your imported RSS content links back to the source right? It looks like they implemented their own content publication system outside of Wordpress’.

  • 91 Make Frickin' Awesome Money Online // Sep 10, 2006 at 3:40 am

    Adsense Injection…

    Have you noticed the cool way my adsense ads roll in at totally random places on my blog, thus eliminating ad blindness? The Adsense Injection Plugin is an absolutely must have for wordpress adsense publishers! Seriously!

    ……

  • 92 Martin // Sep 11, 2006 at 1:09 pm

    Nice work, it works fine for me. Many thanks

  • 93 Peter // Sep 14, 2006 at 2:43 am

    Very nice plugin. One problem.

    This plugin should work only on posts , NOT ON STATIC PAGES, it makes bug on my static pages i use on page menu.

    Any chance to solve that.

  • 94 hammer // Sep 14, 2006 at 7:34 am

    Thanks! I don’t know if I’d call that a “should”. If you want it to not work on static pages, put this code in the beginning of the ai_the_content function:

    if(is_page()) return $content;

  • 95 Amol // Sep 14, 2006 at 2:37 pm

    Hey big B! This one rocks! I am your fan now.

    However I have a suggestion for the plugin : We could have a checkbox in the panel to put the adsense into “test mode” during developmental stages of the blog.

    Thats it. Thanks again man!

    Cheers!

  • 96 hammer // Sep 14, 2006 at 2:43 pm

    Dude, that’s actually a really good idea. Lemme through that in.

  • 97 hammer // Sep 14, 2006 at 2:57 pm

    Ok, Amol. There you go.

  • 98 amol // Sep 14, 2006 at 4:12 pm

    Hey! That was real quick. Is this a miracle?

    Thanks. Its wonderful.

  • 99 Peter // Sep 15, 2006 at 6:39 am

    It works: if(is_page()) return $content;

    GREAT !!! THANKS.

  • 100 hammer // Sep 15, 2006 at 10:11 am

    Okay, since the number one question seems to be HOW DO I GET ADS TO NOT SHOW UP ON SUCH AND SUCH PAGE, I added the functionality to the plugin. Knock yourselves out.

  • 101 Amol // Sep 15, 2006 at 2:27 pm

    This is awesome! I now have it on all the 5 blogs of mine.

  • 102 hammer // Sep 15, 2006 at 2:31 pm

    Thanks! I now wish I would have embedded hidden links!

  • 103 Brad // Sep 20, 2006 at 12:39 am

    Wow, this is a great project. You should Add in an optional 5% AdSense adds directed to you option in the next releace. I would like to see more plugins like this one in the future.

    -Brad

  • 104 hammer // Sep 20, 2006 at 4:54 pm

    Hey Brad,

    Yea, I’ve seen that in a few Adsense plugins. I’d rather have the beer karma.

    If you really want to give me something, go buy one of my books ^_^!

    Edgar N Vective

  • 105 Joe // Sep 21, 2006 at 7:05 pm

    Nice plugins, thanks for sharing this with us. The ad block, however, is too dissolved with surrounding text. Any workaround to add some spaces around the ad block?

  • 106 hammer // Sep 21, 2006 at 9:34 pm

    You can edit the Adsense code it inserts on line 242. Add a <div class="adsense">Adsense Code Here </div> and then add the class to your style sheet.

    I think that will work. I suck at css though.

  • 107 eric // Sep 24, 2006 at 8:49 pm

    hmmm, it only seems to show up on the first post on the page. any help?

  • 108 hammer // Sep 24, 2006 at 10:05 pm

    Because Google only allows 3 ad units. You already have two on your sidebar. The code is injected correctly.

  • 109 LiewCF // Sep 26, 2006 at 12:55 pm

    the v1.3 is great! I also added the new AdSense format(200×200 small square) to the plugin. :)

  • 110 peter // Oct 1, 2006 at 12:54 pm

    Your Plugin is fantastic, but i have a problem i have a little bit entrys what can do a little bit to adult (google don´t like content like what´s is a vagina) ;-) in the text content for adsense and i want exclude some entrys, it´s would be great if i can click “deactive adsense injection” on single post example id 755…

  • 111 peter // Oct 1, 2006 at 1:20 pm

    Some other idea, would shold be me help it´s if i have a own single template for “non-adsense” entrys, but how can i deactive injection in a own template? Are the checkbxes for the template categorys or how are works?

  • 112 LiewCF // Oct 2, 2006 at 8:23 am

    I discovered a problem. The plugin also show AdSense ads in WordPress feed(full-text feed). I have no choice but disable the plugin so that it does not violate AdSense program policies.

    Could you update the plugin to hide adsense ads in feed? Thank you.

  • 113 hammer // Oct 2, 2006 at 10:01 am

    Thanks LiewCF. I fixed it.

  • 114 LiewCF // Oct 3, 2006 at 12:07 pm

    thanks for the update :)

  • 115 LiewCF // Oct 4, 2006 at 9:06 pm

    I have a feature request. Could it be set that the adsense ads only displayer if a post is longer than X words?

  • 116 hammer // Oct 5, 2006 at 9:50 am

    You can make that change pretty handily yourself buy putting the following line right after the function ai_the_content line

    if(strlen($content) < 500) return $content;

    Just make 500 whatever number of characters you want. That way the function will just return the untouched content if it is less than 500 characters.

  • 117 LiewCF // Oct 6, 2006 at 8:18 am

    thank you, i did it few hours ago. :)
    Another feature request: How do I make sure the ads do not display at the top of the post?

  • 118 Search Engine Marketing // Oct 9, 2006 at 6:23 pm

    So thanks a lot for the great work. It’s almost perfect.

    What it lacks, and what would make it perfect (for me at least), is the option to NOT show ads before the more tag (the tag that breakes the post), so that the ads won’t show in the frontpage and category pages (which look very weird).

  • 119 hammer // Oct 9, 2006 at 11:48 pm

    Can’t you do that with the Don’t Show checkboxes?

  • 120 Dave Zan // Oct 11, 2006 at 2:20 am

    I want to be among the legion of people who have thanked you for coming up with this plugin! For a long time I’ve been tinkering around trying to input my vertical adsense ads within the post, but your plugin has saved me that trouble.

    Just tested it now and it’s doing what I’m hoping it would do! Keep up the good work!

  • 121 Ste // Oct 13, 2006 at 8:41 am

    Hello all… Found a small bug near line:

    $content = substr_replace($content, $replacewith.”"

    BTW, there’s a way to print banner not before the first row but in the middle of post, or after N chars ?

  • 122 hammer // Oct 13, 2006 at 3:43 pm

    Fixed it. Thanks Ste.

  • 123 Geschenke // Oct 16, 2006 at 8:27 am

    Great!

  • 124 intilinux // Oct 16, 2006 at 10:35 am

    Adsense Injection in italian language
    http://www.intilinux.com/wordpress/42/adsense-injection-italiano/

  • 125 Stefano // Oct 18, 2006 at 7:21 am

    IMHO this plugin is really good. But…I think that there’s a needed to introduce CENTER alignment. Also, On my blog, manytimes post layout got bad because banner injection interrupt lines and makes alignment bad on line before and after plugin. For example:

    TEXTTEXTTEXT. TEX

    T BANNER

    TEXTTEXTTEXT

    Latests word/words go down with banner… This can be solved?

  • 126 Keith // Oct 25, 2006 at 5:00 am

    Whoever did this plugin, is a genius!

  • 127 hammer // Oct 25, 2006 at 10:46 am

    Thanks Keith. Yea, you’re right Stefano. I’ll get on that. I’ve wanted to use a center option myself from time to time.

  • 128 paul // Oct 27, 2006 at 12:20 pm

    hammer, thanks for this great plugin! is there any way i could incorporate author adsense (http://www.kinkydress.com/php-scripts/author-adsense/) with yours? The problem seems to be that the php line post_author; $google_id = kd_get_google_id($id); echo
    $google_id; ?> for the google_ad_client isn’t showing as php, but rather html. is there a short function that i could add within your plugin to account for this? i’m no coder.

  • 129 fangsang // Oct 29, 2006 at 1:07 am

    well done

  • 130 mark // Oct 31, 2006 at 4:06 pm

    Guys need help, I have the following error:

    Fatal error: Call to undefined function: add_action()on line 197
    How to solve this problem?

  • 131 hammer // Oct 31, 2006 at 4:10 pm

    Where are you putting the plugin file? It belongs in www/wp-content/plugins/adsense-injection.php

    Then you activate it in your Wordpress dashboard.

  • 132 mark // Nov 1, 2006 at 6:47 am

    I have copied it to www/wp-content/plugins/adsense-injection.php, then I have activated it through Wordpress plugin menu, but nothing happened.

    Thank you!

  • 133 arsgeek // Nov 2, 2006 at 9:07 am

    Hey! This sounds like a great plugin. I’ve put it in the plugins directory, enabled it, set up all the options and I see. . . nothing.

    Any ideas? I’ve got it running now and you can check the site if you’d like to see it. I don’t see it on the homepage, in individual posts or anywhere. I’m running WP 2.02

    Many thanks for developing this!

  • 134 hammer // Nov 2, 2006 at 2:54 pm

    Okay. I added a “center” alignment tag. Try it out, it’s pretty cool.

    arsgeek, I don’t think you filled in the client-id segment right. The code is all there in your HTML source, but you have your email address for your client-id instead of the number Google gives you. The fields in the Options panel should match the code Google generates.

  • 135 mike // Nov 2, 2006 at 4:18 pm

    Hey.

    I activated this plugin, but when I put my code in my post like

    I dont see it, whats the problem ?

  • 136 hammer // Nov 2, 2006 at 4:37 pm

    You gotta urlencode your tags.

    What code is it that you put in?

  • 137 Mike // Nov 2, 2006 at 4:46 pm

    It works now :)

  • 138 Mike // Nov 2, 2006 at 5:11 pm

    But can I affect on adsense displaying ?

    Can I use some code that I can put in my post wherever I want ?

    For example - In my first post I dont want to use ads, but in my second post I want to use two types of ads.

  • 139 hammer // Nov 2, 2006 at 5:24 pm

    Yea, put <!–noadsense–> in your post

  • 140 Mike // Nov 3, 2006 at 6:23 am

    I put in my post, but there is showing adsense.

  • 141 Festival News // Nov 3, 2006 at 10:45 am

    Awesome. Have just got the plugin and looks good so far.

    Keep up the great work.

  • 142 arsgeek // Nov 3, 2006 at 11:01 am

    Hi Hammer - thanks for the prompt reply and the ‘head-slapping’ moment.

    I’ve included my Google Adsense ID # (in many permutations, such as ca-pub-### or pub-### or just the number) and I’m still not seeing anything.

    Any other insight would be great.

  • 143 hammer // Nov 3, 2006 at 11:44 am

    Try this arsgeek

  • 144 Jay // Nov 3, 2006 at 11:56 am

    Hi,

    Awesome tool. My ad clicks just went 50% higher day on day. Thanks much.

    I just made one change to the code, i.e to not show ads on posts that have less than 5 in them. It kind of looks like I’m bankrupt when an 300×250 ad comes on a 2-5 liner post :)

    BTW here is the code.. ignore first 5 lines and last line, only included for location reference..

    while(strpos($content, $repchar, $lastpos+1) !== false){
    $lastpos = strpos($content, $repchar, $lastpos+1);
    $poses[] = $lastpos;
    }

    //dont display adds if the post is less than 5 lines
    if(sizeof($poses)

  • 145 Jay // Nov 3, 2006 at 12:02 pm


    //dont display adds if the post is less than 5 lines
    if (sizeof($poses)

  • 146 Irina // Nov 6, 2006 at 7:50 am

    Hi,

    your AdSense plugin is great and so easy to handle. Thank you for sacrificing your time to the WordPress community.

    Though I have a little bit of an issue to make it look good on my blog.

    In each post at the beginning I have a floating post pic with two or three paragraphs surrounding it. Below is something like a stats box. This is always the excerpt shown at the front page of the blog.

    I don’t want to display ads anywhere in the beginning section as the floating pic and the surrounding paragraphs look weird if an ad is stuck between them. The feature “Don’t show ads on front page, search, category pages” is great, but as soon as I click on the full-post view the ads often show up somewhere in the beginning and destroy the layout of the post.

    What would be a nice addition to the plugin is something like a noadsense-placeholder e.g.

    [noAdSensehere]beginning section here with no ads between[/noAdSensehere]

    you could put in to the post. This would be the perfect compromise between ads and no ads. :)

    I would have done it myself, but unfortunately I’m not very common with PHP.

    Anyway, good job. ;)

  • 147 Amol // Nov 11, 2006 at 5:53 am

    Hey Hammy,

    You r D best! Its great to see your plugin become famous. It would be cool if you could make one change to the “test mode”. While in test mode, it should add — google_adtest=’on’; — to the adsense blocks code. This way the impressions arent counted and do not affect your earnings (false impressions decrease the amount per click that you earn).

    Thanks again for your hard work :)

  • 148 Amol // Nov 11, 2006 at 5:56 am

    The comment above mine IS spam! Kick his butt HARD.

  • 149 Leonard // Nov 11, 2006 at 7:54 am

    I’ve been hearing quite a lot about Acme’s Adsense Deluxe and so decided to use it. Problem is, the php file does not load. And fortunately I found you! Thanks for this great plugin.

  • 150 Ajay D'Souza // Nov 14, 2006 at 12:47 pm

    When you say post should now be sent as br, instead of paragraph with v1.9, do you mean that the entire post structure has been modified if I install the plugin?

    I like my posts being autoformatted with the paragraphs when I don’t use the WYSIWYG.

  • 151 Samer Kurdi // Nov 20, 2006 at 3:59 pm

    This is a great plugin. I’m experiencing a weird error though.

    The adsense injection ads are showing just fine in firefox, firefox2, and IE7, but not IE6. In IE6 the ads are there, except all the text is the color of the background. You can click the ad, you just cannot see it.

    You can see this for yourself on my site (www.freewaregenius.com); you have to click into one of the posts though.

    Please help…. this plugin seems to have made some difference in my previously nonexistant clickthrough rate.

  • 152 Richard // Nov 21, 2006 at 1:44 pm

    Thanks

  • 153 tips4blogger // Nov 28, 2006 at 2:58 pm

    Adsense Injection Kein Template Coden Einfach Easy Folge 5

    i{content: normal !important}Hallo heute ist der fünfte Tag und ich stelle das fünfte Adsense Wordpress Plugin aus meiner laufenden Serie Adsense Wordpress Plugins « 7 Folgen vor.
    In diesem Post dreht sich alles um Adsense Injection.
    Viel zu…

  • 154 CelebrityBlogger // Nov 30, 2006 at 1:20 am

    Awesome plugin, I look forward to getting it working!

    I selected 3 ads, and chose to display on all pages except “post”. But, I am only able to see 1 ad on the homepage, and no ads elsewhere (category pages).

    Any Ideas?

  • 155 Bierflesje // Dec 6, 2006 at 12:26 am

    Hi, thnx for the plugin!
    Is there a hack/way to put the ads at the bottom of the posts?
    I have a lot of posts with only one picture or video in it and the option ‘left-right-center and random’ all put the add on top.

  • 156 reallybites // Dec 9, 2006 at 11:32 pm

    What’s the code to put for not wanting to display adsense on certain post? dosen’t work for me.

    It will be great if you include the post pages on the homepage to the “Don’t Show on These Pages” too.What I meant is i don’t want adsense to show on the post (post pages) at the homepage of my blog.

  • 157 anon4 // Dec 16, 2006 at 12:43 pm

    Great plugin! I had hundreds of posts so this really helped. I can’t wait after a couple days to see if revenue has increased or not. Thanks!

  • 158 Kaustubh // Dec 18, 2006 at 11:37 am

    i installed this plugin at cyberdevils.com .. but not working for me.. added everything right.. dont know whats wrong

  • 159 dynn // Dec 18, 2006 at 8:46 pm

    thanks for sharing.

  • 160 John T. Pratt // Dec 20, 2006 at 1:08 pm

    awesome plugin - I’ll be recommending it to all my readers! Thanks again for the hard work!

  • 161 hammer // Dec 20, 2006 at 5:12 pm

    Gah! Sorry for not getting back to all these questions. If the plugin doesn’t work for you, you can email too at the address on my contact page.

    To answer the questions I saw, the plugin doesn’t require you to change any structure of your posts. It works with paragraph tags or br tags if you don’t use paragraph tags.

    For everyone who’s gotten it to work, great!

  • 162 hammer // Dec 21, 2006 at 1:10 pm

    I just posted a new version, 2.0, that has lots of stuff people wanted. Give the new description a read and download it.

    It’s got YPN. I don’t have YPN so I couldn’t test it, but I assume all the formats are there.

  • 163 matrics // Dec 22, 2006 at 2:14 am

    I’m currently using this on my T-Shirt Blog and I’m quite happy with it. Nice job!

  • 164 hammer // Dec 22, 2006 at 10:23 am

    That yellow background you have for your ads is really cool.

  • 165 borasque // Jan 6, 2007 at 11:22 am

    found a bug at 1.9
    //FIXED BUG
    //$content = substr_replace($content, $replacewith.$repchar, $pickme, 2);
    $content = substr_replace($content, $replacewith, $pickme, 0);

  • 166 Martin Ø. Jensen // Jan 11, 2007 at 5:19 am

    Hey

    I have a little language problem with the plugin. My site is in Danish, but the Google Annonces on my frontpage is in english. But when i click on one of the topics the Ads is in Danish. It is only the frontpage which are in Danish. I looked at the code, but it is similar on all the pages even the language isn’t. Any ideas of what to do? You can see the site at http://www.hundeeksperten.dk. Remember it is in danish, but at you can see the Ads are English on the frontpage.

  • 167 Knox // Jan 11, 2007 at 5:36 am

    hey there nice plugin..
    but too bad it messed up my template..
    but hey good job :D

  • 168 Martin // Jan 13, 2007 at 3:43 pm

    Great ideas for a plug in I am going to try it out now.

  • 169 Swaminathan // Jan 16, 2007 at 12:09 am

    Hi

    I loved the adsense injection plugin, and had a thought…

    Would developing something like this for clickbank products be too much of a pain?

    If you would like to contact me on this, you can mail me.

  • 170 Ann // Jan 20, 2007 at 10:42 am

    Wow! Cool.. i have been searching for something like this and I found it! Great work!

  • 171 mark // Jan 22, 2007 at 7:30 am

    hi,

    adsense injection is a great plugin, but how can i realize to have 3 adsense ads on a static page?

  • 172 Armen // Jan 26, 2007 at 4:24 pm

    Really excellent plugin. Well done!

    However, some people might not appreciate the swear word in the plugin list discription.

  • 173 Armen // Jan 26, 2007 at 5:29 pm

    Just realised that adsense isn’t appearing on individual post pages. Can’t figure out why, I haven’t selected that in the settings.

  • 174 éÂ’æ–¹ // Jan 29, 2007 at 8:24 pm

    éž常好çâ€Â¨Ã¯Â¼Å’谢谢ï¼Â
    Thanks!

  • 175 GG // Feb 3, 2007 at 4:40 am

    Great, Thanks!

  • 176 Thierryyyyyy // Feb 8, 2007 at 10:53 am

    Can you add in your plugin a metadata (a custom field) that would forbid adds to be added in the post ?
    Thank you

  • 177 David // Feb 9, 2007 at 12:39 am

    haiya

  • 178 topfmodel // Feb 15, 2007 at 1:36 am

    It works very fine

    Lot of THANKS.

  • 179 Dosh Dosh // Feb 17, 2007 at 8:54 pm

    Does this work for Wordpress 2.1?

  • 180 Gay // Feb 19, 2007 at 4:34 am

    I’d like to give it a try, just started blogging with Wordpress and I’m still learning how place my adsense at the same time keeping my sidebar look great. Thanks.

  • 181 Gay // Feb 19, 2007 at 3:05 pm

    Hi, I’ve finally set it up but it keeps on breaking my posts like this - http://mikrobyo.com

    Can anyone help? I know a lot has probably undergone the same thing, but most of these are gobbledygook for me. Thanks in advance.

  • 182 Michael Swart // Feb 21, 2007 at 1:34 am

    Adsense Alternative - People who are sick and tired of the Google AdSense are coming here to see ads NOT by Google.
    http://super-e-store.com/Popular/FAN/

  • 183 TIMMGuru SEO // Feb 26, 2007 at 8:49 am

    Make Money with Your Blog using Adsense…

    If you have other ways to make money with your blog, don’t use Google Adsense or Yahoo Publiher Network or any other PPC programs. The most obvious reason is that you are giving away your traffic for that few cents. If your readers are aware of t…

  • 184 Joshua Ziering // Mar 2, 2007 at 4:14 pm

    If you dont like your ads all up in your contents “grill” you can edit the tag to add padding using inline CSS

    Just add this after float:right or whatever:

    padding:5px;

    LOVE THE PLUGIN, You’re a god.

    Incorporate a way to do the horizonal leaderboards and I will deem you a greek god.

    Hint: If you split your pages with More, you can serve more ads.

    Thanks.

    Josh

  • 185 graeme // Mar 4, 2007 at 8:42 am

    Wow! I’m impressed. This is a really neat plugin. Got it working first time. Not on my blog though, on another one.

    Only one request please. Don’t know if this is possible in the plugin. Can you make it so it puts a 3px padding around the ads, so its not right up against the text.

  • 186 graeme // Mar 4, 2007 at 8:46 am

    Oh, thanks Joshua for the solution. Didn’t see it 2 posts up

  • 187 graeme // Mar 4, 2007 at 8:49 am

    function ai_pickalign($tag){
    if($tag == “left”)
    return ”;
    if($tag == “right”)
    return ”;
    if($tag == “center”)
    return ”;
    else
    return ai_pickalign(rand(0,10)

  • 188 Ronald // Mar 12, 2007 at 7:02 am

    Great Plugins! But I think it’s better if you added new rule like which posting will display the ads . like posting 1 then 6. or more … not like this, the ads display on posting 1-3. who visit the site we’ll be bored, cause ur site full of adsense :)

    thanks

  • 189 LiewCF // Mar 15, 2007 at 2:12 pm

    Anyone tested the v2.0 plugin on WordPress 2.0.9? I cannot get it working… Thanks.

  • 190 Martin Fitzpatrick // Mar 15, 2007 at 5:27 pm

    Hey fella,
    I’ve created Adsense Manager plugin for Wordpress myself. Currently it allows positioning using comments, inline markers & widgets, but it’d be interesting to add your functionality to it (i.e. ad per paragraphs). You cool with that? :)