Friends don't let friends see adverts

This post has been a long time in the writing. Ever since I started advertising on my blogs my strategies have been tweaked continuously so consider this post a snapshot description of what I’m doing with Adsense advertising now. This is a long post, but read through it. The plugin I use to do most of this stuff is linked near the end.

Last year at the IT@Cork Web 2.0 conference, Gavin mentioned that he earns enough off his blogs to pay for his hosting, and I thought to myself that it would be handy to have an extra bit of cash to do likewise. I didn’t do anything about it until July when I signed up for an Adsense account and put some ads on the site. Things were slow that month but they’ve steadily improved to the point that it’s a reasonable second income now.

At last year’s WordCamp in San Francisco, one of the talks was about monetizing your blog. It was a fascinating talk with a great discussion afterwards and I brought home some good ideas:

  • Don’t show adverts to your friends. They are the people who visit your blog and leave comments. They’re not going to click the ads anyway.
  • Position matters. Right underneath the post title and above the content is the best place on a blog to put an advert. (Thanks Matt!)
  • Go as wide as you can.
  • Experiment with ad colours, borders and sizes. Don’t accept the Google defaults. Blend your ads or make them stick out. It all depends on your blog.

Since then I’ve developed my ad serving strategies further:

  • I love when people comment, and I’m honoured when people subscribe to my blog. Therefore I won’t show my RSS or email readers adverts. If you like what I do enough to subscribe I won’t burden you with advertising. You’re my friend.
  • Don’t show adverts on the homepage.
  • Adsense Injection is great for putting adverts directly into posts.
  • Monetize your archive. Any post older than a month gets adverts.
  • Don’t show adverts to Digg, Delicious and Stumbleupon visitors.
  • Identify where most of your “just passing through” traffic is coming from and show them adverts, except for social bookmarking websites of course.
  • If my blog showed you adverts, I’ll tell you “Don’t like adverts? Leave a comment and they disappear.” below the comments form. At least one person has commented favourably about that.
  • Fill the competitive ad filter with low paying URLs. If you’re still showing ads from helium.com then you’re missing out. If your daily eCPM isn’t at least $5 you’re not making the most of your advertising. Subscribe to notspam.org to see which MFA and low paying sites go into my competitive ad filter. I’ll talk about the competitive ad filter in more detail in a future post.
  • Set an hour long cookie for users from search engines. Blogs have a notoriously low attention span for most visitors but if they click to the front page, show them a few more ads.
  • I use Kontera too but the returns from that have been very disappointing. One of my posts has an AuctionAds unit in it. You’ll see that no matter what because I’m testing it for a few weeks and the post in question is almost always only hit by visitors from Google.

I run advertising on my photoblog, In Photos dot org too but the rules there are a bit different:

  • Each post has a big image, pushing the text description below the fold. That’s not ideal for displaying adverts so I use the left sidebar to show a 600px high Adsense skyscraper unit.
  • Show the sidebar advert even on the homepage. It’s not an ideal location so better give it as much exposure as possible.
  • It’s difficult to attract visitors to a photoblog. I wrote 11 seo tips for your photoblog to outline some of the ways I draw traffic in. The biggest mistake is definitely not writing about your photography. If there is no text, how can the search engines figure out what your blog is about?

I’m not the only one only showing adverts to selective visitors. Recently Ben Gillbanks had a great post on increasing Adsense earnings that says some of the same things I summarised here.

I haven’t tried it yet, but the who sees ads plugin from Ozh does most of the same checks I do. That plugin won the WordPress plugin competition so congratulations to Ozh on winning!

The No Adverts for Friends plugin

Announcing my shiny new, rough as anything No Adverts for Friends plugin! This plugin adds new commands that you can use in your templates. Use them to surround your Google Adsense or other advertising code.

The No Adverts for Friends API:

  • is_regular_user() – returns true if the visitor has left a comment or is logged into your blog.
  • is_whitelisted_site( $url ) – returns true if $url is in a pre-defined list of friend sites like Digg, Delicious and StumbleUpon.
  • is_old_post() – returns true if the current post is over a month old.
  • is_searchengine_user() – if a user comes from one of the listed search engines or this is an old post return true.

Each of the API calls depends on the one before it returning a favourable value. For example, is_old_post() won’t return true if is_regular_user() returned true, no matter how old the post is.

Example usage:
<?php if( is_searchengine_user() == false ) { echo "Google adsense code goes here"; }?>
Edit single.php in your current theme and add that code somewhere within the loop. Now either visit an old page on your blog or use a Google search query to bring you to your blog. Hopefully you’ll see the text “Google adsense code goes here”. Replace this text with the Google Adsense Javascript.

Download

Install

  1. Rename both files to .php and place friendsadverts.php in your plugins folder. If you use WP-Cache copy wp-cache-phase1.php into plugins/wp-cache/ overwriting the file already there (make a backup first!)
  2. If you use WP-Cache copy the $nevershowads and $passingthrough arrays from friendsadverts.php into your wp-config.php. They’re needed by WP-Cache which kicks in well before plugins are loaded.
  3. Activate the “No Adverts for Friends” plugin from your plugins page and modify your templates using the new API.

Well, you’ve read this far. If some of the advice in this post helps you, if you like this plugin, if it improves the user experience of your regular visitors and maybe even increases your advertising revenue please consider uncommenting the add_action() command at the start of friendsadverts.php. The donnchas_happy_happy_notice() function prints a message in your blog’s footer saying you use this plugin and links back here.

Thanks John for bugging me to write this up. Hopefully I’ll see you at next year’s WordCamp!

Comments

comments

"Friends don't let friends see adverts", 5 out of 5 based on 1 ratings.

88 Replies to “Friends don't let friends see adverts”

  1. Heiste – I think it’s a bug somewhere. I saw it too last night but after I deleted my WP-Cache folder the regenerated page was fine. When you posted a comment it cleared the cached copy of this page on my server and you saw the proper one again.
    Annoyingly, no error appeared in php_errors so I’m not sure why it happened.

  2. I don’t get enough traffic to do tests and be sure about the result, but I was wondering do you think that lots of ads to new visitors would make them less likely to revisit?

    I have never seen any ads here either, but then about I use very strong ad blocking. It is amazing what using *ads* as one of the filters does πŸ™‚

  3. Michael – I’m sure it would turn off some people visiting again but there’s so little chance a visitor from Google will subscribe or bookmark the site that I think I’m losing little.

  4. It just occurred to me that the Landing Sites plugin could be used usefully in this regard…

    Add a conditional so that if visitors turn up *only* from search engines they get to see the ads, everyone else (bookmarks, Digg, SU, rss) gets none of that…very simple to set up.

    d

  5. Dotme – that would be fine if I knew them all but I don’t.

    The definition of “friend” here is a little broader than the normal “meet you at the bar for a drink” type definition! πŸ™‚

    This way is much better.

  6. I saw a 500% increase in AdSense revenue after implementing my own Landing Sites tip inspired by your post. Admittedly, it was only $1.26 the day before. Better than a poke in the eye though, and $5 a day could amount to $1500 a year taking holidays into account etc

    db

  7. Hi,
    i just stumbled upon your plugin and it sounds promising. i will try it and see how the people react.
    i also liked your thoughts about how and where to place ads on the page. guess i’ve a lot to change around my page. πŸ˜‰

    greets

  8. You can show me ads all day long. I realise you have costs to run your blog. Why shouldn’t you make a few bucks to cover your costs?

  9. I’ve been looking for a way to do this. Finally I stumbled on this page via the admin page for wp-super-cache. This is awesome it seem to solve every part of advertisement I need to have. I will download it and test now. Let you know later on if I love it. Can this plug work for my blog featured by WordPress MU?

  10. Hey Donncha,

    Hope you’re having a lovely Christmas!

    Thanks so much for this. I’m not a coder myself as you know, but I can stumble around existing code a little bit, so I hope you don’t mind that I stole some of your code and inserted it into Adsense Injection’s code so that I now have a plugin which automatically inserts ads into posts older than 1 month but recent commenters won’t see them…

    I think it all works, see BifSniff blog for it in action at the moment. It’s a work in progress but I haven’t found any issues yet…

    Thanks again, it’s taken me a long time to get around to having a solution I’m happy with – wouldn’t have been possible without your brilliance πŸ™‚

  11. Hi
    You make some interesting points there.
    I am too new to blogging to comment on that score, however I pay my hosting costs and quite a bit more from just a couple of pages on my photo website. Around 20% of that revenue comes from Adsense link units “below the fold” on pages with single pictures, against an eCPM for those units of around $3.00.
    In fact I have recently discovered that link units in pure HTML pages earn about 50% more than the same units in PHP, and more than ads. I do wonder where that leaves my blogs?

    In terms of photos to go into the blog, as an experiment I have simply written a script which generates the formatted photo content with text descriptions. I simply copy the source into a blog content page – experiments at http://myeasierway.com/cgi/wp/?cat=8.

    Jerry

  12. I operate 4 blogs: one family, one hobby (geeking), and 2 business-related.

    Blogging is so cheap that I just absorb the costs elsewhere. I guess if I suddenly became a celebrity blogger I might be tempted to monetize the blogs.

    I liked the spoof article that was titled “how to be a 6-figure blogger”. The punch line was “get a 6-figure job and blog at work”.

  13. I’ve put your example code in my single.php file and I see the line “Google adsense code goes here” whether I visit the page from my blog or from Google. What am I doing wrong?

  14. You have some good advice, but I don’t understand why you wouldn’t show ads on the home page, or to visitors referred from search engines and social bookmarking networks. The home page is the most visited page; not putting ads there is going to reduce your income. Don’t you deserve to be paid back for your hard work?

    The “Blogs have a notoriously low attention span for most visitors” isn’t the fault of the medium; it’s because many blogs aren’t interesting or useful. They can hold attention just as well as a traditional website, depending on what you write/code/photograph.

    I don’t mind ads myself; the Internet is one humongous advertisement. Google AdSense isn’t doing its job if advertising is a burden to your readers, though. Ideally the ads would compliment what you write by being contextually relevant and a resource to your visitors. Often it isn’t so, unfortunately.

  15. Man, This plugin sounds awesome. I am gonna give it a try. I was on my way learning more on Adsense and found this one.

    I had thought I was making good from Adsense, but my eCPM is way below $5 πŸ™ That means I have to optimize, and have lots to learn πŸ™‚

    Subscribed via feed πŸ™‚

    (I love to see the Subscribe to comments tick box below the comments box. Its a great way to keep track, thanks for adding it here πŸ™‚ )

  16. Hi,
    I love the concept of this plugin, but need some help.
    I want to display ads to everybody but visitors from 2 websites.

    I am guessing I need to insert url’s here:
    $nevershowads = array( ‘stumbleupon.com’, ‘del.icio.us’, ‘digg.com’ );

    But what do I need to insert in single.php to make it the way I want?

    Also, I would need instead of
    { echo “Google adsense code goes here”; }

    Please answer with code in comments or email me. I will be happy send few bucks by paypal if this takes more than 1 minute.

    Thanks a lot in advance,
    Marko

  17. Just to add missing line in previous comment

    Also, I would need instead of
    { echo Ò€œGoogle adsense code goes hereÒ€; }

  18. Does this work on 2.8+? I’m trying it on a site of mine using the is_old_post and even the search engine like the example, and the test text shows regardless if it’s a new post or old post. Thanks!

Leave a Reply