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 ?
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:
- display if visitors comes from a search engine
- don't display if the visitor is a regular reader
- 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
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 :
- If Visitor comes from a search engine, display
- 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
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.
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)
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 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:
- <!--adsense#mybanner-->
- adsensem_ad('mybanner')
- 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:
- <img src="banner1.jpg" alt="Banner 1" />
- *** CODE ***
- <img src="banner2.jpg" alt="Banner 2" />
- *** CODE ***
- <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
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:
- <?php wp_ozh_wsa('myad'); ?>
However, you can pass an additional parameter to turn off output and have the ad code returned instead:
- <?php $code = wp_ozh_wsa('myad', false); ?>
By default, the plugin returns an HTML comment when no ad has to be displayed, for instance:
- <!-- WSA: rules for context 'myad' did not apply -->
A complete example of how to use WSA with your own functions would be something like:
- <?php
- $code = wp_ozh_wsa('myad', false);
- if (strpos($code,'<!-- WSA') !== false) {
- // plugin returned actual code, do something with it
- ...
- } else {
- // plugin returned no code to be displayed
- }
- ?>
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
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
Eddie » This is an ImageManager problem, which basically includes the javascript it needs whatever page we're on and which makes WSA (and potentially any other plugin using prototype) break. I've contacted the author with a few bugfixes and suggestions, but he didnt bother to reply. I *think* you can fix this with removing the bundled prototype.lite.js library and replace it with the full prototype.js, then edit accordingly line 99 of the main plugin file (imagemanager-plugin.php). It might fix things, although I've not tested it.
Thank you so much for this! Everything is working fine, but I am trying to get the ads to display for a specific category on my WordPress blog. I tried this…
in_category(Actors) and this
in_category(8) (thinking category id)
It didn't work. Any help would be appreciated.
Oops…actually I found it with a little more digging…thank gawd for Google. Also this helped a lot
http://codex.wordpress.org/Conditional_Tags
it's
is_category('8') or is_category('Actors')
Nice plugin! I'm very impressed. This looks like a good way to reward your regulars and try to increase click through rates on those ads. Thanks a million!
Hello Ozh,
very cool plugin!
But there is a problem with the plugin IImage Browser from: http://fredfred.net/skriker/index.php/iimage-browser
When Who Sees Ads is activated i cant use the iimage-browser in the editor.
Do you have a idea?
thank you
Trust
TrustAdverrt » Don't know exactly why it doesn't work, and to be honest I don't want to fix other's code :) I see that your plugin has an option to replace the button with a link. It's almost working, you need to edit line 106 and replace 'post.php' with 'post-new.php'
I love you Ozh! This work!
Trust
Hi and thanks for a fantastic plugin :)
I'm having a small problem, though. I've set up a context that is:
If from Search Engine, show ads
If regular reader, don't show ads
For any other condition, show ads
I've defined a regular reader as someone who's read 5 pages in 10 days.
If I visit my site via a search engine, I see the ad. However, if I then visit another page in my site, I don't see them. It's like it's treating me as a regular reader after only visiting 1 page.
I've cleared out my browser cache and there still seems to be a problem.
Any ideas?
Follow up to my last message:
I've noticed it seems to treat me as a regular reader as soon as I hit my home page. i.e. if I access a post (not the front page) of my site through a search engine, then navigate to another (not front) post within the site, the ads show, but as soon as I access the home page, the ads disappear and stay "disappeared" (!).
Hope this helps.
Mark
Mark » this is the intended behavior and everything works as expected on your site. When you come from a search engine, you see ads. Then, if you load another page, you're not coming from a search engine any longer. You're coming from your own site. So rule #1 doesn't apply. If you're a regular reader, you don't see ads (rule #2). If you're not, you see them (rule #3). I've just visited your site, directly and from google, and it works perfectly.
Hi again,
Yes, I think it was me being an idiot :(
Everything does seem to be working fine. Thanks for taking a look for me.
Mark
I'd love to see an option like "Allow use of PHP code" because it gets stripped out in the current version of WSA (or am I missing something here?).
Great plugin!
Simon » You're not missing anything, I didn't implement this on purpose. Too many security implications and too many breakage potential with newbies :)
To use PHP code you can easily hook the plugin in using its internal function (there's even a function to determine if the ad code is PHP code or not)
Its good
I'm writing an adsense blog, and find this one unique.
I have put in practice a more manual way to avoid clicking you own ads.
Like this one.
Hei!
Did anyone know a solution for the ImageManager-problem? It isn´t just the javascript its more. ImageManager works fine with prototype.js but only without the who-sees-ads-plugin. And if i exclude all who-sees-ads-javascript, the ImageManager doesn´t work further. So i think its more.
Thanks!
Markus
Ozh, I loaded the newest version 1.3.3, my wordpress site is 2.1.3. Whenever I do anything (just entering the page) on options/whoseesads page in the admin console, I get this error:
Fatal error: Call to undefined function: wp_parse_args() in /homepages/45/d88109300/htdocs/dusk/wordpress/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads_admin.php on line 1559.
I tried to put the add on one page using the editor, nothing is showing up.
Any ideas what I am doing incorrectly?
Larry » Outdated WP install. I'll bump the minimum version up, it seems it needs 2.2 at least, maybe newer. Anyway, I always develop plugin for the latest version as of coding.
Hi!
Thanks for the plug-in. Seems great not to bother our regular readers with ads.
perhaps this is a silly question, but how can I tell if the name are being displayed properly?
my rules are:
display if from search engine
don't display logged in
don't display if regular user
else display
I can logout, and click a link from a search engine, but I can't get past the regular user thing to test it.
I'm not sure what to do.
Jason » a value stored in a cookie decides if you're a regular or new user. To make yourself a new user, simply clear the cookie. Firefox: Tools / Options / Privacy → Show Cookies then delete the one you want.
Hi Ozh ,
I have used this plugin on a client domain , we are using WP 2.3.1 , and Who Sees Ads version 1.3.3, but currently the ads codes , such as adbrite etc are turning up as codes in the recent comments box . how to get around this problem ?
thanks
arindra » Don't know the "recent comments box" but it seems you're not using it the way you should
hi Ozh ,
thanks for looking in already :) but it's not on the site you have looked probably . can i email you somehow ? i don't want to post the url here , if thats ok :)
arindra » Well, mail me at ozh at this domain or using the contact form if you want, but chances are I won't be able to help. I don't know the plugin "comment box" you're using, your theme, etc…
Thank you so much for this awesome plugin you've worked to make! I use SemPro WordPress CMS and the latest upgrade has your cool plugin. A great thing it is! If Denis adds a plugin, then we all know it's gonna work perfectly!
This Plugin is very powerful.
But since activation i have some trouble with the Plugin Add Quicktag by Frank Bueltge. Quicktags which i added with that plugin are now less of function.
Therefore the Plugin's Author analyzed his code in conjunction with your WSA-Plugin. He detected WSA only accept its own quicktag but any other/following quicktags…
Is it possible to analyse?
Duerrbi » Is everything fixed if you change the hook priority on wp_ozh_whoseesads_admin.php, last line ? (instead of 999 put 1 for instance)
I changed the Line to
(is that right ?)
After this the functional WSA-Dropdown-Box comes first after the WordPress-Quicktags.
All Buttons added by Quicktags are now shown behind and are functional on click; but they all looks like "WSA-Dropdown-Boxes" ?!
Duerrbi » No, I asked you to change just a number, so it would have been simply add_action('admin_footer', 'wp_ozh_wsa_addbutton',1);
Anyway, indeed if you have more than one context defined in WSA, it does not work.
Till I find the reason why it's conflicting, you better simply disable the button in WSA (in my_options.php uncomment the line with $wp_ozh_wsa['my_wsa-buttons'] = false;)
Hi Ozh,
this plugin is a must have :-)
2 Questions:
1) would it be possible to have an option for incoming RSS-traffic? Or would they just be regarded as returning visitors?
2) Is there any way to make your plugin work with (or include similar features) this AdSense Sharing plugin?
Paul » RSS traffic is something that requires some coding and a plugin, but it's really neat. I'm going to cover this by a lengthy tutorial some day.
As for using WSA and your Adsense plugin, well of course it's possible.
1) create a context named "myad" with the display rules you want, and instead of google javascript code, simply put, say, "1" in the Ad Code textarea.
2) use the following code:
Cool, thanx a lot, will give it a spin, see how it works out and give you a shout back.
Also my compliments to your 'welcome-mail' for first time commenters – going to include that in my big book of best practices :-)
Is that a plugin generated mail?
oh – seems I forgot to mention that the Plugin I pointed to works by putting in a piece of php in the Google javascript code in order to replace the adsense publisher id on the relevant pages. But as I understand it, I can't use php in the Ad Code Textarea?
Is there any way to make this great plugin work with 1Blogcacher? Ads aren´t appearing now when coming from Google and if I use mfunc I get blank pages. I dont want to use Wp-cache :(
Public Enemy » Unfortunately it doesn't work with 1Blogcacher or any other cache plugin (and I can swear I really looked into this issue:)
This is the best solution for me, because i don't need Ads directly in my posts; therefore the wsa-context-button within the quicktags isn't necessary for me.
Thanks for the trouble!
The adsense compliance where the ad units per page are displayed only 3 times. Is this by default, or do we have to create a condition to enabled this. Does the plugin automaically determine if the ad unit is a google ad unit?
Please guide.
Thanks
gmatprep » you don't have to do anything. The plugin detects automatically what kind of ad you're inserting, and checks how many times each kind of unit has been displayed. Note: ad type detection doesnt work with google's new ad management thing.
thanks much for the rerply. I am new to adsense world, so when u say google's new ad management thing, do you mean it doesnt work with google adsense?
gmatprep » Of course it works with Google Adsense… Google introduced a few months ago a new way of managing your various ad formats from their interface rather than from your own site.
In other words: try it.
Thanks :) …its a great plugin, I am still figuring out a few things here and there. I am a bit paranoid because I have heard google is very strict and I have never worked with them before … sorry about that :) ….
Thanks again for replying to my concerns …. Isnt there a board where I can nominate a plugin for plugin of the month or something?
Whats the license of this Plugin? GPL?
TIA
Teg
Teg » it's released under the "if this plugin makes you rich, be kind with my paypal donation button" license. Or GPL, as you wish :)
Hi,
Thanks for the great plugin, and responding to comments. I realize that must take up quite allot of time.
Anyway, their seems to be a problem with the way this plugin counts google ad units. According to the adsence TOS, at least from what I understand, you can have three link units, three context units, and a search box.
However, the plugin seems to group the text units and the context units together, preventing me from displaying the ads.
Is their a way to disable this feature? Or am I mistaken?
Jason » I haven't heard about such an issue yet (and there are quite a few users of this plugin now). Unless you're using the newish Adsense "simplified" ad management, where you can change your ads without changing the code: the plugin is not compatible with this feature. It works with the good old way of inserting ads.
I signed up with many site publisher network like google adsense , adbrite , bidvertiser , etc
I want to use all of them in a rotating manner.
Only 1 ad spot but it should every network ads in rotation system ( after a fixed time in seconds
Can u tell me the steps of how to do it. What to add what to edit.
Please help
John » Everything that's possible with the plugin is explained here and in the page with examples.
U should actually explained the rotating ads part more and more clearly
Hope u understand
Hi Ozh,
would it be possible to make a rule that a certain ad only appears in a certain category?
Let's say shows only if the post contains the "category 1".
Couldn't find anything on the help-page about it.
Thanks
Eddie