On: 2007/06/28 Viewed: 171815 times
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. Syed says:

    How can I filter based on Operating Systems? I've learnt to filter based on browsers from the comments section, but, didn't find anything for Operating Systems.

    I want to show a banner to MAC users browsing on Safari only. Please help.

  2. Ozh says:

    Syed » Same principle, except you check for a part of the user-agent string that contains (usually) a hint for the OS used.

  3. Black Viper says:

    I am having an issue with "lambda_37″ being inserted in the source code directly after applying this modification. It is in the widget code, IE 8 does not view source after line 74 on my home page. Chrome, however, displays this:

    div id="ad-wp-north-1″ class="lambda_37 suf-widget"

    Firefox 3.6 shows a stylized questionmark before the lambda_37

    As a side note, I could not cut and paste what chrome displayed into this comment, I typed it out.

    I spent about 2 hours looking through your code trying to find the problem and failed. Please advise.
    This is en-US if it matters. Thanks in advance.

  4. Black Viper says:

    I just spent some time looking through the comments and on page 66 someone else from the US "Shelly" has this issue from Sep 2009:
    http://planetozh.com/blog/my-projects/wordpress-plugin-who-sees-ads-control-adsense-display/?cp=66#comment-96130

    Also in her widget area. I looked further and could not find a fix.

    The lambda character or whatnot is being injected somewhere.
    Using WSA v2.0.3 and WP v3.0.5.
    Thanks in advance.

  5. Black Viper says:

    I have done all I can in the last 13 hours to figure this out. I installed, reinstalled, both this plugin and WP auto re-update, checked/optimized/repaired all DB tables, researched sprintf() to look into my themes call that is in question, etc. I contacted the theme author and no reply yet to get a bit more direction. Lots of stuff that I tried is in here:
    http://www.aquoid.com/forum/viewtopic.php?f=4&t=4069#p17177

    This corrupted output only happens with this plugins widgets.

    I ran out of options and giving up. WSA is exactly what I want and I do promise to PayPal something your way if I can help you help me figure this out. In the grand scheme of things, it is "working" as I have it set up and tested, but crashing Chrome attempting to cut and paste source and blocking IE 8 from displaying most of the source at all is a show stopper for me.
    I thank you in advance.

  6. Black Viper says:

    I went back to the default Twenty Ten theme and the issue is still there. I then changed back to Suffusion and the issue is currently on line 71 of my sites home page source code.
    Thanks again in advance.

  7. Ozh says:

    Black Viper » I can see the problem in the classname. What I don't get is why it's such a big deal, actually :) I'll have a look at this but, given it's about widgets which I pretty much hate and only implement in my plugins for others (I don't use them), I don't plan to invest too much of my free time in this. Seriously, I hate widgets :)

  8. Black Viper says:

    You are brilliant! You gave me the idea of not using… well, your widget code and using a widget that comes with my theme, I believe, that can put in any HTML that I want in a widget, of which, I used only and it works perfectly! As far as I am concerned, at this point, I am good to go. Bug for future reference in widget code?
    Liquid refreshment of choice via email incoming. :)

  9. Ozh, the widget code isn't really necessary if the theme allows PHP or Exec-PHP is used. The template stuff works fine. I wonder how many people actually use the widgets as is anyway.

  10. Ozh says:

    RT Cunningham & Viper: I'm updating the plugin anyway. My widget code sucked more than how I dislike widgets :P

  11. eileen says:

    I need help regarding how to wrap text around google ads using who sees ads.

    Thank you.

  12. Eileen, I'm assuming, but you can try this.

    Before the ad:
    After:

    Use left if you want the text on the right and right if you want the text on the left. To adjust the padding, it works from top to left, clockwise.

  13. Oops, maybe Ozh can change those left brackets for me?

  14. Ozh says:

    RT Cunningham » they've been eaten.

  15. Okay, let's try this again.

    Before the ad: <div style="float:left;padding:0px 5px 5px 5px;">
    After the ad: </div>

    Use float:left if you want the text to wrap on the right and float:right if you want the text to wrap on the left.

    To adjust the padding, it works from top to left, clockwise.

  16. Uzair Khan says:

    Does this plugin provide a reporting feature? I looked in the database table thinking I can pick the stats myself but it seems the plugins stores all its information in a single field inside the options table. Any guidance in this regard would be really appreciated. Thanks.

  17. Ozh says:

    Uzair Khan » there is no reporting. Data stored is only what shows in the interface (name, rules, code to display ad)

  18. tstportal says:

    hi there. I'm having some PHP errors. When I make a new context, with rules, the plugin is fine. Then if I want to edit an existing context, it won't let me edit (drag) the rules, and when I hit save context it gives me this error:

    Warning: Invalid argument supplied for foreach() in /home/domain.com/public_html/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads_admin.php on line 1393

    this JUST began, and I didn't upgrade anything else to cause a conflict. Do you have any advice? Thank you.

  19. fher98 says:

    Hi Ozh,

    Im currently using advertising manager (aka adsense manager), read that you support them also, but when i input the ad code like:

    [ad#MyAD]

    Y get [ad#MyAD] words on the sidebar, not the ad itself… and with , it gets commented en the source.

    is there a way to make this work?

  20. fher98 says:

    Ozh,

    Dont know why, but now it seems to be working just find… sorry and thanks!

  21. chocky says:

    hey can u please tell how do i block the ad after one user clicks the ad.i mean i dont want the user to click the same ad more than one time in a specific time frame..how to do that :?

  22. Ozh says:

    chocky » Out of the box, you can't.

  23. chocky says:

    that means i have to spend 27 dollars for buying that script.anyways :roll:

  24. Mike says:

    Ozh, any plans of extending features to allow revenue sharing with adsense? This is the only adsense plugin that doesn't suck, and the one with revenue sharing was abandoned.

  25. Ozh says:

    Mike » no

  26. Mike says:

    Ozh » :( aww

    Thanks anyway, awesome plugin.

  27. fher98 says:

    Hi guys!

    Question here! For the ads at the bottom of a page, lets say a large rectangle before the comments, what config would be the best or has work better for you and the ctr?

    thanks

  28. Ozh says:

    fher98 » I'd say that ads down the page don't work well. The best IMHO would be ads "blended" in the content (ie same bg & font colors as your content) and anyway hidden for regular visitors. People who have read your content down to the bottom care about your content obviously, not your ads.

  29. katoey says:

    will this plugin still work work for the present version of wordpress? i see that this has not been updated since 2010.

  30. Chris says:

    Question, Would it be possible to target a specific registration field as a rule? This way I could target ads to users from certain areas or with particular interests depending what questions I ask during the registration process. Any thoughts on how I could approach this?

  31. caroline says:

    I can´t see ads anymore on my website. If I click on "Who see ads" settings, wordpress admin area I only see a white page. What can I do?

  32. David says:

    Since the latest update to wordpresss ( versin 3.3 ) your plugin now longer works. Do you intend to update this plugin at all?

  33. Ozh says:

    David » works fine on all my 3.3 installs running this plugin

  34. Moody says:

    Hey ozh

    after the update to wordpress 3.3 the drop down selection within the post/edit interface is not shown any longer – whats wrong?

    could you please help?

  35. David says:

    I have the same issue with this plugin as "Moody."

    I had to reset up the "rules" for this plugin as the ability to change a rule with anything already set up would not work.

  36. dee says:

    Excellent plugin which completely meets the needs of mine. There are so many rules to choose. I have been looking for this kind of plugins for a long time and finally I find this one that is what I want. Thank you very much, Ozh.

    It is perfect to use this plugin together with the other ones that makes you easy to paste ad codes to anywhere using the html code thus you do not need to edit the php files.

  37. promiller says:

    I have the same problem than Moody. The WSA selection doesn't work in the post editor.

  38. Matthias says:

    i also miss the dropdown in the editor.

    Ozh can you correct that?

  39. David says:

    I keep getting this error message whenever I do anything with this plugin:

    "Warning: Invalid argument supplied for foreach() in /home/dac/public_html/FORTYFITANDFABULOUS.COM/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads_admin.php on line 1393"

  40. Rafael says:

    Hello, after upgrading to WordPress 3.3 plugin "ozh who sees ads" crashed, it does not appear in the issue of posting. Is there any update?

    Congratulations on your work and a hug from a Brazilian friend! ;)

  41. Md Jannatul Nayeem says:

    Please tell me what I have to do if I want the following condition.

    If someone clicks the same ad more than twice then the ad will be disabled.

    It helps click booming Google adsense.

  42. ichi says:

    I have the same problem than Moody and promiller .

    :(

  43. Lavanay says:

    Please update this plugin to make it compatible wih wp3+

  44. dfc says:

    I'm trying to display a Cincopa slideshow inside the ad code, but it's not working. Does php inside the ad code normally not work, or is it something about the cincopa code?
    Thanks, great plugin.

  45. Ozh says:

    dfc » Read the doc please.

  46. dfc says:

    Heh, yea I'm trying to understand it but I only know just enough php to break stuff.

  47. erik says:

    hello Ozh,
    do you plan to update the plugin or should we move to an other one?

    thnaks

  48. Pasham says:

    Hi Ozh,

    I set the active rule of my website http://www.pashamtechnology.com as "Search Engine visitor display and regular do not display".

    But through search engine my ads are visible only on the first page, if visitor browses other pages the ads are not visible.

    My website shows only 3 ads 1 on the header and 2 on both the side bars. If a Search engine visitor lands on the Home page then ads are visible only on the home page. I want the ads to be visible in all the pages (categories, pages & posts) as the visitor may surf the website for his related information.

    Please help me as I have tried a lot to make my ads visible in all the pages through search engine.

    Regards,
    Pasham

  49. caroline says:

    I heard Who Sees Ads is no longer maintained by the developer anymore and is getting more and more out of date. Is this true? I really like this plugin, but I don´t want to take any risk. Which Plugin what is up to date and solid I could use instead of Who Sees ads?

  50. Hisky says:

    Hi Ozh!

    Thanks for this great plugin. Worked for me long time now.
    But i start using ebay Partner Networks ads and got a major problem:
    One ad works great with WSA. Even two ads in one WSA field work great.

    But as soon as i insert a second WSA code with one more ebay ad the banners wont work. The first banner code is written down as normal text and only the second one appears.

    Any idea!?

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.