On: 2007/06/28
Shorter URL for this page: http://ozh.in/kr

Warning: hefty explanations and documentation. On a rush? Give the demo a try. Chances are you'll understand right away what and how. Then download. Then please read here.

Current version: 2.0 for WordPress 2.5+ See below for older versions.

You most certainly have two types of visitors on your blog : some returning readers, and a majority of first time visitors. Returning readers come to your site for its content and for what you write. First time visitors, and mostly search engine visitors, come because they are looking for something particular, look at the page, and leave.

The first obvious thought that comes to mind when you want to monetize your blog is: "I'm going to put ads and banners everywhere". By doing so, you won't add any value or service to regular readers, who are not likely to click on your ads. By doing so, you'll also probably won't do justice to your finely handcrafted pixel polished WordPress theme. By not serving ads to your regular visitors, chances are you'll both lose little money and show your readers you're treating them differently.

Therefore, the second obvious thought about blog monetization is : "I wish I could display a lot of ads to those coming once never returning readers, but not bother my regular fans". Enter Who Sees Ads, the ultimate ad management plugin.

Who Sees Ads : the Ultimate Ad Management Plugin

Who Sees Ads ?

So, who sees ads ? Now it's up to you.

Who Sees Ads is an advanced ad management plugin that lets you decide who will see your ads, depending on user defined conditions. The association of an ad and these conditions is called a context: a set of circumstances you define, that will eventually display or not an ad.

For instance, you could consider the following criteria: Is the visitor a regular reader? Does this visitor come from a search engine? Is the visitor currently reading a recent post, or something really old?

Live demo

The plugin is active here, to display an ad on top of the right sidebar. Depending on the context, you could see it or not. Its display rules are:

  1. display if visitors comes from a search engine
  2. don't display if the visitor is a regular reader
  3. always display

The ad behavior is defined by the first rule that is matched. Visit the main page of my blog: as I've defined a "Regular reader" here (someone who has read at least 2 pages over the last 10 days), you're now a regular reader, hence rule #2 apply and you don't see the ad any longer. Now go to Google and click on the first result to come back here: rule #1 now applies, and you'll see the ad.

Define Contexts

Ad code + Display rules = Context

You already probably have the Ad code : it can be plain HTML (a text link, a image banner) or Javascript (your Adsense code). Let's define the display rules.

Who Sees Ads offers a very intuitive and powerful visual interface to create your context and pick display rules, in which you naturally select and order them with your mouse. The interface also offers a convenient way to duplicate, rename and delete your contexts.

Have a look and play a bit with this demo. You'll love it.

Display Rules

Possible rules

By default, you can pick or mix any of the following rules :

  • If Visitor comes from a search engine, display / don't display
  • If Visitor is a regular reader, display / don't display
  • If Post is older than XX days, display / don't display
  • If Visitor is logged in, display / don't display
  • If Date is between specified date interval, display / don't display
  • If Ad has been showed less than XX times, display / don't display
  • If This visitor has viewed this ad less than XX times, display / don't display
  • If All previous conditions fail, try another context
  • If Any condition, display / don't display

The ad behavior will be eventually decided by the first rule which is matched. For instance, if you want to display an ad only for search engine visitors, you'll pick the following :

  1. If Visitor comes from a search engine, display
  2. If Any condition, don't display

If no rule is matched, nothing displays, so the second rule in the above example is actually optional.

I made up a list of example display rules, be sure to check them.

Advanced Display Rules

Advanced custom PHP rules You can use PHP functions and make your own custom advanced display rules. Want to display something on home page only ? if (is_home()) display will be your custom display rule.

You can use PHP built-in, WordPress internal, or your own functions. Your brain is the limit.

Please note: you obviously need to know a bit of PHP in order to use the advanced display rules. By default, they are not enabled. If you want them active, edit the beginning of the script and set $wp_ozh_wsa['iknowphp'] to true. This requires your agreement on being on your own if you break your site or if ads don't show as expected.

There are two advanced custom display rules :

  • If ( condition ), display / don't display
  • If !( condition ), display / don't display

The if and if not rules are working the same, I just thought it could be more convenient in some cases to use an if not rather than an if, and this way you also have two custom rules for the price of one :)

Again, check the example display rules to get an idea of how powerful it is.

Features

Simple and Effective Ad Management

Even if you're not using Who Sees Ads to fine tune display rules, it will make your life easier. Pasting <?php wp_ozh_wsa('google-336-280') ?> in your PHP templates such as sidebar.php is a lot easier than cut and pasting 10 lines of javascript, especially if you decide later to change the javascript across multiple files.

Use it inline or in PHP templates

Create contexts and display ads either in your PHP files on within your posts and pages :

  • <?php wp_ozh_wsa('mybanner') ?> in your PHP files such as sidebar.php
  • <!--wsa:mybanner--> within posts and pages

Visual interface

If you haven't tried it already, play with the demo. It's not functional of course, but it will show you own the interface lets you visually create contexts, and easily rename, duplicate and delete ads.

Help Wizard

A togglable introductory help contains a handy wizard that will assist you, creating your two first rules. Click on the image for a screenshot of the Wizardry.
Wizard !

Posting help

Within the Post/Edit interface, you'll find a convenient drop down selection to easily insert context you will have created (if you create just one context, the select is replaced with a button)
Editor button

Google Adsense and Yahoo Publisher Compliant

Per terms of use, YPN (TOS) and Adsense (TOS) impose a maximum number of ads in a page, as follow (as of writing):

  • YPN: 3 ads per page
  • Adsense :
    • 3 ads
    • 2 search boxes
    • 3 link units
    • 3 referral units

Who Sees Ads fully complies to these restriction, and will display ads of a particular type up to the maximum number allowed.

Google Adsense and Yahoo Publisher Compliant, part 2

Per terms of use, YPN and Adsense don't allow ads on error pages such as 404 pages, and on pages that are not viewable by their system.
Who Sees Ads also complies to this policy, and ads won't be displayed on 404 error pages, and on draft posts a publisher is previewing.

Admin Clicks Safety

Admin Click Safety Admin Click Safety is an option that will prevent you from accidentally clicking on your own ads (Adsense or Yahoo Publisher), replacing them by a placeholder when viewed by the blog admin.
Regular visitors, of course, will see actual ads if applicable. Days of "oops I clicked it!" are over.

Widget support

Who Sees Ads is now supporting widgetized themes for easier ad management.

Custom Preferences Hacking

Advanced users with some PHP editing knowledge can now define a custom set of preferences or behaviors that will override Who Sees Ads' defaults. The plugin comes with an example my_options_sample.php file. Rename it my_options.php, edit it, and never lose any change you'd make when you upgrade the plugin.

3rd party plugin compatibility: Adsense Deluxe and Adsense Manager

For those who are already using Adsense Deluxe or Adsense Manager to manage your Adsense ads, you can seamlessly make the transition to Who Sees Ads and give it a try without uninstalling them. Instead of pasting the actual Adsense code when you create a context, just enter something like the following examples, depending on what plugin you're using:

  1. <!--adsense#mybanner-->
  2. adsensem_ad('mybanner')
  3. adsense_deluxe_ads('mybanner')

Please note: compatibility with these 2 plugins has been implemented to allow easy testing before adopting. I personally find Who Sees Ads much more powerful and efficient, and don't see the point of using it side by side with another ad management plugin. I will not continue support of these plugins if their code evolves and changes so that it breaks with my plugin.

Rotating Ads

You can define only 1 context and assign it as much ad code as you want. You just need to specify your custom code separator in my_options.php and you're done. Example, defining the string *** CODE *** as a separator:

  1. <img src="banner1.jpg" alt="Banner 1" />
  2. *** CODE ***
  3. <img src="banner2.jpg" alt="Banner 2" />
  4. *** CODE ***
  5. <img src="banner3.jpg" alt="Banner 3" />

Completely dynamic

The content managed by Who Sees Ads and whether it should display or not is processed dynamically on every visit for every visitor, to ensure maximum efficiency and make sure each visitor receives the treatment it deserves. The drawback of this aspect is that the plugin is not compatible with cache plugins, which generate each page once and serve the same static file to each subsequent visitors.

Download

Download the plugin :
ozh-who-sees-ads.zip
Extract and upload to your blog, preserving directory structure if any.
Note: download counter here and stats on wordpress.org may differ and reflect the number of downloads before this plugin was hosted on the plugin directory

PHP Template usage

The regular PHP call you will insert in your PHP templates is the following:

  1. <?php wp_ozh_wsa('myad'); ?>

However, you can pass an additional parameter to turn off output and have the ad code returned instead:

  1. <?php $code = wp_ozh_wsa('myad', false); ?>

By default, the plugin returns an HTML comment when no ad has to be displayed, for instance:

  1. <!-- WSA: rules for context 'myad' did not apply -->

A complete example of how to use WSA with your own functions would be something like:

  1. <?php
  2. $code = wp_ozh_wsa('myad', false);
  3. if (strpos($code,'<!-- WSA') !== false) {
  4.     // plugin returned actual code, do something with it
  5.     ...
  6. } else {
  7.     // plugin returned no code to be displayed
  8. }
  9. ?>

Examples and advanced use

The obvious usage of this plugin is to display ads with rules as :

  • Display ad when user comes from a search engine
  • Don't display ads to my regular readers
  • Display ads on old stuff, don't display on fresh posts

But you can also :

Greet your returning visitors

You can display ads, or really anything. For instance, display something only to your regular readers: a "welcome back" message, or a special offer you don't want them to miss.

Geo target !

In conjunction with my own IP to Nation plugin, you can easily target visitor from a particular country. For instance, you've always wanted to display Yahoo Publisher ads to American visitors only, as Yahoo suggestscompells? Easy, your context simply has to use the following custom if rule:
if (wp_ozh_getCountryName(0) == 'United States'), display

Check the example display rules for more ideas of usage.

Older version

Who Sees Ads is still available (yet not maintained any more) for WordPress 2.3.3 and earlier. Note that I strongly recommend always running the latest version of WordPress.
Download: Who Sees Ads 1.3.3 for WordPress 2.3.3-

Question?

If you have a question, read all the comments: the answer *is* there.

Shorter URL

Want to share or tweet this page? Please use this short URL: http://ozh.in/kr

Metastuff

This page "Who Sees Ads ? Manage your Ads, Control Who Sees Them" was posted on 28/06/2007 at 10:04 pm
Watch this discussion : Comments RSS 2.0.

826 Blablas

  1. Steven says:

    Progress, but would still like to be able to control ads by category..helpful for a large CMS that has for example a travel and gadget category – separate ads would perform best..

  2. […] get to see the email subscription form at the top of the page and that was with the help of "who sees ads" […]

  3. .wired says:

    Doesn't work with WordPress 2.7… The Drag-function is corrupted and some more. I did the mistake and overwrote the settings I had with an brand new, so now I'm alone on the road…

  4. Ozh says:

    .wired: works perfectly fine on WP 2.7.

  5. .wired says:

    @Ozh: Yeah, you were right! It didn't work because of some incompatibilities with an other plugin (position yourself)
    Thanks ;)

  6. […] Ozh, uno dei realizzatori di plugin più interessanti ed in gamba. Permette di stabilire delle regole […]

  7. Milan says:

    Per terms of use, YPN TOS and Adsense TOS impose a maximum number of ads in a page, as follow (as of writing):

    YPN: 3 ads per page
    Adsense :

    3 ads
    2 search boxes

    3 link units
    3 referral units

    Who Sees Ads fully complies to these restriction, and will display ads of a particular type up to the maximum number allowed.

    This doesn't work. I tested it by inserting php code in index.php of theme just before endwhile so that ads are displayed after every post. Code for both ad and link units is outputted, though ads on page are shown only for first three since Google automatically does this (but you could receive some warning from them (or even to terminate account).

    You should either fix this issue or change description in documentation. (this works in AdSense Deluxe)

    Another thing I want to ask you is about use with WP Super Cache. I read somewhere in this comments that this plugin shouldn't work with it. Did you tested that and are there any new informations about this? Is there way that this works in special conditions, like when there is rule to display in any condition?

  8. […] WordPress Plugin "Who Sees Ads ?" ist dieses nützliche Plugin, dass Werbung zielgerichtet einblenden kann. Die Einrichtung geht sehr […]

  9. […] a next step I implemented the WordPress Plugin “Who Sees Ads ?” to differ from searchengine-traffic and the core audience. Now the ads are only visible for […]

  10. Jacob says:

    If you were to add one more line to the end of your plugin:

    1. add_action('widget_text', 'wp_ozh_wsa_filter');

    , then the ads could be displayed as widgets by using the WordPress standard Text widget and using the same "" tag in the widget text as you would in the post text.

  11. Ozh says:

    Jacob » Nice suggestion! I'm uploading 2.0.2 right now.

  12. […] along the line I read about the "Who Sees Ads?" WordPress plugin and how you can set it up to control who sees your Adsense […]

  13. mariano says:

    Hey Ozh, Im getting the "this is not tested on WordPress 2.7" alert on my blog… is there a way i can help you testing it so i can upgrade without a problem ;)

  14. Ozh says:

    mariano » wtf is this "not tested message?". I'm always running the latest WP and all my plugins are compatible with latest release, unless explicitly advertised. WSA runs fine on 2.7.

  15. mariano says:

    Hi Ozh,
    yeah, i assumed that but… here's a screenshot
    http://www.uberbin.net/wp-content/uploads/2009/01/picture-2-416×300.png

    Its really weird and i wouldnt upgrade it with this "alert" on my new blog :S

  16. Ozh says:

    mariano: trust me. I'm running it fine. The readme says "Requires WordPress Version: 2.5 or higher" and it's true.

  17. mariano says:

    I do trust you :)
    If this message had appeared on any other plugin.. i wouldnt upgraded nor contacted the author ;)

  18. […] sounds complicated but there is comprehensive documentation on the Who Sees Ads website and it's really quite intuitive. The second way to show an ad is to insert a line directly […]

  19. […] næsten aldrig og hvis de gør, så konverterer de elendigt), så har jeg installeret WordPress plugin’et Who See Ads. Med dette plugin kan du suverænt styre hvem der ser dine Adsense reklamer. Dvs. at du kan […]

  20. Manuel says:

    It's a nice plugin. The only problem I have with it, is that in my wordpress posts, it aligns all the ads to the left – there is no way around it, it seems.

    Also, I only get it to show 3 Google ads (2 normal, 1 link) instead of the 6 I planned (3 ads, 3 link units)

  21. Wagner Reis says:

    This plugin is amazing!

    Try put conditional AND and OR in new version

    Thanks from Brazil!

  22. tonka says:

    Since WP2.7 **** ROTATE **** isn't working anymore.

  23. […] sein, da ich ein wenig verfolgen möchte, ob die eingeblendeten Links zum Content passen. Wenn ich Who Sees Ads aktiviere, bekomme ich sie selbst leider auch nicht mehr angezeigt. Die Werbung habe ich […]

  24. Love this plug in but since I upgraded to v2.0 **** ROTATE **** doesn't work any more and I can't seem to get *** CODE *** to work either.

    I'm using wordpress 2.6.3

  25. Upgraded to 2.7 and neither **** ROTATE **** nor *** CODE *** seem to be working. I'll need to downgrade the plugin until it's fixed.

    Also may I suggest you keep the old format of **** ROTATE **** in the next version so we don't have to edit all our ad codes?

    Thanks for listening.

  26. Ok last post on this, honest!

    To get everything to work again I had to downgrade the plug in then downgrade to WordPress 2.6.5 and finally ensure the "my_options.php" file is enabled and specifying the correct rotate code.

    HTH…

  27. […] solution for WordPress users is the Who Sees Ads plugin. This has the ability to display ads for search engine traffic only. There are many other options, […]

  28. […] solucionar este problema podemos utilizar o Who See Ads que é um plugin gratuito para o WordPress que permite gerenciar a publicidade de seu blog de forma […]

  29. Tony says:

    This looks like it might be close to what I am looking for, the way to display a different rotating ad block (using CJ Smartzones) based on the country the visitor is from (using IP lookup).

    Looking forward to checking this out ASAP.

  30. Eddie says:

    Hi,

    I've just upgraded to WP 2.7 an got the following errors:

    1. Warning: Invalid argument supplied for foreach() in .../wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 458
    2. Warning: array_keys() [function.array-keys]: The first argument should be an array in .../wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 853
    3. Warning: Invalid argument supplied for foreach() in .../wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 853

    What could it be?

    Thanks,
    Eddie

  31. […] For a more detailed documentation, demo of the interface, and examples of advanced usages of the plugin, please visit its official page: Who Sees Ads […]

  32. […] Ozh’ Who Sees Ads – Allows you to set several options for when an add gets displayed.  Some of the most interesting ones are if the reader comes from a search engine, was published between certain dates, is older than X number of days and more. […]

  33. Gaza says:

    Hi there, this plugin has some great options!

    In the advanced rules option would it be possible to include or exclude say, a specific post tag and what would be the php function for this?

    Many thank's for this Great Plugin

  34. […] Who Sees Ads – Rendre l'affichage des annonces ou d'autres éléments sous condition […]

  35. Ozh says:

    Gaza: read all comments

  36. Eddie says:

    @ Ozh

    Can you please give me just a short tip about what to look for with this error described below?

    Thanks,
    Eddie

  37. Ozh says:

    Eddie » No idea. WP 2.7 doesn't contain anything new that affects WSA. This error is not related to your upgrading if it worked before.

  38. tonka says:

    Hi Ozh,

    WP 2.7 doesn't contain anything new that affects WSA? But why is **** rotate **** not working anymore?

    Take a look at Rory The Green Host's Commment too. He's got the same problem.

    Best regards

  39. Ozh says:

    To all: the rotate stuff *does* work with 2.7. I am using it. Check that updating the plugin just didn't delete your my_options.php file.

  40. john says:

    Great plugin! I have an ad that include PHP script I use to set the channel in adsense, looks like:

    1. google_ad_channel = "";

    When I insert that ad into a context it doesn't parse that line as php. I did enable php processing in your plugin if that makes a difference.

    Is it possible?

  41. john says:

    Shoot – the code didn't show up right. Anyway, I am just doing a php echo within the ad utilizing logic to grab custom channel. Can Who Sees Ads process this php?

  42. Ozh says:

    john: ad code must be client side stuff (HTML, javascript..) but not server side code (eg PHP).

  43. john says:

    Ah that's a bummer, I guess I'll have to decide how important those custom channels are for me. I am able to do this logic in a widget using the Executable PHP widget plugin – too bad I can do it in a widget but not utilizing your great rules.

  44. Tomas M. says:

    Hi, Ozh, any chance WSA will work with Super Cache? Because now Super Cache would show the first cached page (if first user was from google, it would show add also to regular readers, which would come next)

  45. SLogan says:

    I get an Internal Server Error when I just try to activate the plugin. Is there so much action going on right away that it brings down my php/mysql?

  46. Ozh says:

    Tomas M. » No, doesnt work with caching plugins.

  47. Ozh says:

    SLogan: definitely not.

  48. Matt says:

    Ozh, You've got a great plugin, unfortunately some of the things are a little over my head. I'm basically trying to set up an alternate ad, when adsense doesn't appear.

    Is there any possibility that you will add a feature for alternate adds? If not, could you give me a newbs version of how to do this?

    thanks

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.