Home | Best | WordPress plugin Simple Ads Manager

WordPress plugin Simple Ads Manager

Until recently I used the plugin “Advertising Manager”. However, I am not quite satisfied the set of its capabilities. For example, the inability to display scheduled advertisements, or the inability to display ads in the posts only certain categories. Etc.

That’s why I wrote my own plugin to control the advertising on the blog – Simple Ads Manager. I tried to create a plugin that will satisfy most requests of any blogger to manage advertising on the blog. And I think I managed it.

Simple Ads Manager is easy to use plugin providing a flexible logic of displaying advertisements.

Note: Now this plugin is partially deprecated. If your site works under PHP 5.3 or later version (include PHP 7.0) it is better to use SAM Pro (Free Edition).

More info you can find in this article

Support Forum


  • Flexible logic of advertisements rotation based on defined weight of each advertisement in group (Ads Place)
  • Custom default ad for each Ads Place Allowed types of ad’s codes are HTML, javascript, PHP
  • Codes of Google DoubleClick for Publishers (DFP) supports
  • More flexibility of displaying ads by using Ads Zone selector
  • Outputting ads as widget
  • Outputting ads as shortcodes in any place of single post/page content
  • Outputting ads in any place of theme template using output functions
  • Customizable outputting ads as block of ads
  • Automatic outputting ads in single post/page if allowed
  • Customizable limitation of displaying advertisements by types of page
  • Customizable limitation of displaying advertisements on single post page by post ID (IDs)
  • Customizable limitation of displaying advertisements on single post page or category archive page by category (categories)
  • Customizable limitation of displaying advertisements on single post page or author archive page by author (authors)
  • Customizable limitation of displaying advertisements on single post page or tag archive page by tag (tags)
  • Customizable limitation of displaying advertisements on custom type single post page or custom type archive page by Custom Type (Types)
  • Customizable blocking of displaying advertisements on single post/page by post/page ID (IDs)
  • Customizable blocking of displaying advertisements on single post page or category archive page by category (categories)
  • Customizable blocking of displaying advertisements on single post page or author archive page by author (authors)
  • Customizable blocking of displaying advertisements on single post page or tag archive page by tag (tags)
  • Customizable blocking of displaying advertisements on custom type single post page or custom type archive page by Custom Type (Types)
  • Schedule of displaying each advertisement if allowed
  • Customizable limitation of displaying advertisements by hits
  • Customizable limitation of displaying advertisements by clicks
  • Statistics of hits
  • Statistics of clicks (your own advertisement image mode)
  • Customizable accuracy of bots and crawlers detection
  • Counting revenue from ads placement, display ads and clicks on advertisements

Available languages

The Concept

The main object of the plugin is “Ads Place“. Each Ads Place is a container for the advertisements and provides the logic of the show and rotation. In addition, one of the parameters of advertising space is “patch ad code”, ie ad to be shown if and only if the logic of ads this Ads Place does not permit to show none of the advertisements contained in this Ads Place. One Ads Place can contain any number of objects “advertisement”.

Object “advertisement” rigidly attached to his container “Ads Place”. Its parameters determine frequency (weight) of displaying and limiting displaying from “show all pages” to “show the articles with ID … ” and show from date to date (the schedule).

Additional object “Ads Zone” is selector developed for increasing the flexibility of displaying ads. This optional object can be useful for conducting advertising campaigns using a large number of promotional materials.

The additional object “Ads Block” allows to display the block of advertisements.


  1. Upload the plugin folder to the folder /wp-content/plugins/
  2. Activate the plugin on the Plugins page
  3. Configure your plugin to meet your needs
  4. Create an Ads Spaces in the right quantity and fill them with advertisements


Go to the page Ads->Settings

Views per Cycle – the number of impressions an ad for one cycle of rotation, provided that this ad has maximum weight (the activity). In other words, if the number of hits in the series is 1000, an ad with a weight of 10 will be shown in 1000, and the ad with a weight of 3 will be shown 300 times.

Do not set this parameter to a value less than the maximum number of visitors which may simultaneously be on your site – it may violate the logic of rotation.

Not worth it, though it has no special meaning, set this parameter to a value greater than the number of hits your web pages during a month. Optimal, perhaps, is the value to the daily shows website pages.

Display Ad Source in – you can display advertisement target in new or current window (tab). Select target window (tab).

Auto Inserting Settings – here you can select the Ads Places and allow the display of their ads before and after the  content of single post.

Google DFP Settings – if you want to use codes of Google DFP rotator, you must allow it’s using and define your pub-code.

Statistics Settings

Bots and Crawlers detection

For obtaining of more exact indexes of statistics and incomes it is preferable to exclude data about visits of bots and crawlers from the data about all visits of your blog. If enabled and bot or crawler is detected, hits of ads won’t be counted. Select accuracy of detection but use with caution – more exact detection requires more server resources.

Allow Bots and Crawlers detection – If allowed, hits of detected bot won’t be counted.

Accuracy of Bots and Crawlers Detection:

  • Inexact detection – This method is based on an analysis of the request header. Inaccurate method.
  • Exact detection – This method uses the Browser library by Chris Schuld for detection of bots. Recommended.
  • More exact detection – This method uses “browscap” data for bots detection. Very exact and very slow method. If browscap not defined in your php.ini, this method is unavailable.

Display of Currency:

  • Auto – auto detection of currency from blog settings.
  • USD – Forcing the display of currency to U.S. dollars.
  • EUR – Forcing the display of currency to Euro.

Ads Place creation and configuration

Go to your list of Ads Places (Ads -> Ads Places) and click the “Add New Place”.  In the opened editor window configure current Ad Place.

Enter a name and a description of the Ads Place. In principle, it is not mandatory parameters, because these parameters don’t influence anything, but experience suggests that after a while all IDs usually will be forgotten  and such information may be useful.

Ads Place Size – in this version is only for informational purposes only, but in future I plan to use this option. It is desirable to expose the real size.

Ads Place Patch – it’s an ad that will appear in the event that the logic of basic ads outputing of this Ads Place on the current page will not be able to choose a single basic ad for displaying. For example, if all basic announcements are set to displaying only on archives pages or single pages, in this case the patch ad of Ads Place will be shown on the Home page. Conveniently to use the patch ad of Ads Place where you sell the advertising place for a limited time – after the time expiration of ordered ad will appear patch ad. It may be a banner leading to your page of advertisement publication costs or a banner from AdSense.

Patch can be defined:

  • as combination of the image URL and target page URL
  • as HTML code or javascript code
  • as name of Google DoubleClick for Publishers (DFP) block

If you select the first option (image mode), tools to download/choosing of downloaded image banner become available for you.

Codes – as Ads Place can be inserted into the page code not only as widget, but as a short code or by using function, you can use code “before” and “after” for centering or alignment of Ads Place on the place of inserting or for something else you need. Use HTML tags.

Advertisement creation and configuration

Go to the list of Ads Places (Ads -> Ads Places), move the mouse to the desired Ads Place, select in the row menu that appears “View Ads” for the transition to the advertisements list of this Ads Place or “Add Ad” for the transition to the editor of a new ad. If you went to the list of ads, click on “Add New Ad”.

Enter a name and a description of the advertisement. These parameters are optional, because don’t influence anything, but help in the visual identification of the ad (do not forget which is which).

Ad Code – code can be defined as a combination of the image URL and target page URL, or as HTML code, javascript code, or PHP code (for PHP-code don’t forget to set the checkbox labeled “This code of ad contains PHP script). If you select the first option (image mode) you can keep statistics of clicks and also tools for uploading/selecting the downloaded image banner becomes available to you.

Restrictions of Advertisement Showing

Ad Weight – coefficient of frequency of show of the advertisement for one cycle of advertisements rotation.
0 – ad is inactive, 1 – minimal activity of this advertisement, 10 – maximal activity of this ad.

Restrictions by the type of pages – select restrictions:

  1. Show ad on all pages of blog
  2. Show ad only on pages of this type – ad will appear only on the pages of selected types
  3. Show ad only in certain posts – ad will be shown only on single posts pages with the given IDs (ID items separated by commas, no spaces)

Additional restrictions

  1. Show ad only in single posts or categories archives of certain categories – ad will be shown only on single posts pages or category archive pages of the specified categories
  2. Show ad only in single posts or authors archives of certain authors – ad will be shown only on single posts pages or author archive pages of the specified authors

Use the schedule for this ad – if necessary, select checkbox labeled “Use the schedule for this ad” and set start and finish dates of ad campaign.

Use limitation by hits – Use this parameter for limiting displaying of ad by hits.

Use limitation by clicks – Use this parameter for limiting displaying of ad by clicks.

Prices – your prices for that ad.

  • Ad placement per month – used only for scheduled ads.
  • Per Thousand Hits – Not only humans visit your blog, bots and crawlers too. In order not to deceive an advertiser, you must enable the detection of bots and crawlers.
  • Per Click – To calculate the earnings on clicks, you must enable counting of clicks for that ad.

Ads Zone creation and configuration

Ads Zone is selector that used to select the appropriate Ads Place for each type of displayed page.

Go to your list of Ads Zones (Ads -> Ads Zones) and click the “Add New Zone”.  In the opened editor window configure current Ads Zone.

Enter a name and a description of the Ads Zone.

Select default Ads Place.

Select the appropriate Ads Places for each type of page, category or author or leave “Default” value. You can block displaying Ads Place on needed type of page selecting “None” value.

Ads Block creation and configuration

Ads Block used for outputting block of ads.

Go to your list of Ads Blocks (Ads -> Ads Blocks) and click the “Add New Block”.  In the opened editor window configure current Ads Block.

Enter a name and a description of the Ads Block.

Enter number of lines and columns of Ads Block. After changing these properties you must save Ads Block settings before using Ads Block Editor.

Configure styles for Ads Block and Block’s items. Use Stylesheet rules for defining these properties. For example: url(sheep.png) center bottom no-repeat for background property or 5px solid red for border property.

Important Note: As the Ads Block is the regular structure, predefined styles of individual items for drawing Ads Block’s elements aren’t used. Define styles for Ads Block Items on Ads Block Editor page!

Customize Ads Block structure (select Ads Place or Ads Zone or Single Ad for each item of block).


There are three variants for output: widgets, short codes, the function… and auto inserting…


Go to the widgets page (Appearance->Widgets). In the area of available widgets locate widget “Ads Place” and drag it to the necessary sidebar. You can also use widgets “Ads Zone” and “Single Ad”.

Configure your widget:

  • Title – title of widget. If not needed, leave empty.
  • Ads Place – select Ads Place from a list of all Ads Places.
  • Hide widget style – in some theme templates it is necessary for the sidebar in the blog header.
  • Allow using previously defined “before” and “after” codes of Ads Place – these are the codes that are defined for each Ads Place as “code before” and “code after”.

Widgets “Ads Zone” and “Single Ad” can be configured in the same way.


Shortcode “sam” enables you to insert Ads Place anywhere in the post’s content.

[sam id=1 codes='false']
  • id – ID of Ads Place
  • codes – allow or not allow to use Ads Place codes “before” and “after”. Default “false”

Shortcode “sam_zone” enables you to insert Ads Zone anywhere in the post’s content.

[sam_zone id=1 codes='false']
  • id – ID of Ads Zone
  • codes – allow or not allow to use Ads Place codes “before” and “after”. Default “false”

Shortcode “sam_ad” enables you to insert Single Ad anywhere in the post’s content.

[sam_ad id=1 codes='false']
  • id – ID of Ad
  • codes – allow or not allow to use Ads Place codes “before” and “after”. Default “false”

Shortcode “sam_block” enables you to insert Ads Block anywhere in the post’s content.

[sam_block id=1]
  • id – ID of Ads Zone

Output functions

In order that would insert Ads in any place of theme template, use the drawAdsPlace, drawAdsZone or drawAd functions.

Output functions are defined as follows:

  • args – array, which may include id (ID of Ads Place) or/and name (the name of Ads Place, not recommended)
  • codes – bool|array, allow or not allow to use Ads Place codes “before” and “after”. Default “false”. If bool value, codes ‘before’ and ‘after’ will be received from Ads Place record. If array value, codes ‘before’ and ‘after’ will be received from array.

Auto Inserting

Designed for automatic insertion of ad codes before and after the content of single post. Configuring is on plugin settings page.


At first glance, it might seem that the plugin is too heavy – as did 500 kb codes. But do not be terrified ahead of time, the plugin is using the technology of saving resources. In other words, in the Face Side is loading only 23 kb of codes, of which 21 kb PHP-code and 2 kb javascript code. Everything else are extentions for the admin mode, and even then, not all are loading en masse, but only if necessary.

Video Lessons:


Donations List

Many thanks to everyone who supports the development of this plugin:

Michael Kiepert, Andrea Vacondio


© 2011 – 2018, minimus. All rights reserved.

About minimus

Senior Full Stack Web-developer (React, Node.js). Also: Development using Object Pascal, C#, SQL, PHP, Javascript.

Check Also

XAds for SAM Pro

This addon provides extended visualization of ads served by SAM Pro (Lite and Free edition). …


  1. Is the scheduling option gone?  I can’t seem to find it.
    Total Comment by Occasio Gee: 1

  2. Hello, this plugin is great!!!

    I would like to ask, I don´t know if it is possible. In the administration part, where the places are listed, Could I put a finder by Place?
    Total Comment by luis: 1

  3. Can you pls have a look into this:

    Total Comments by owcv: 5

  4. Hi,

    it seems the disappearing ads are a genereall problem and not just on one website with DB errors.

    Nevertheless I tried to install “MyWebSQL plugin “, but it is not detected als wordpress plugin if unzipp and upload it or try to install it with the zip-file.


    Is there a way to fix the plugin so not everybody needs to install a fix-db-plugin?

    Otherwise – can you name an alternative to the plugin that actually works? Preferrable one that is also listed in the wordpress.org plugins directory.


    Thanks a lot!


    Total Comment by Simon: 1

  5. A couple of things…

    Thanks for the ad manager first of all. Very nice!

    I tried to seek out help in the forum but get a internal server error. Anyway, a handy option for images with links would be enable rel=’nofollow’ as a checkbox option maybe? I added rel=’nofollow’ to all of the a href’s in ad.class.php so by default it has it but would be nice to have in the admin as a feature.


    Thanks again!
    Total Comment by Brian T: 1

  6. Hi there,

    love the plug in ! (much like everyone else here…)

    quick question: I see there is a shortcut way to add ads into a post. Is there a way to add the ads into my php page ?

    ie. if I want to call ad ID=3 into my index.php is there a code or is there a html/ php code line I can add ?


    Total Comment by Liron: 1

    • or

  7. Is it possible to limit the countries that an advertisement is shown in? For example I only want people from U.S.A. and Canada to see an advertisement.

    Is this possible?
    Total Comment by Eric: 1

  8. Great Plugin,

    Can you add banner rotation functionality, i mean banners change after few seconds.
    Total Comment by Modasser Abbas: 1

    • This would be a good addition – rotating the ads after a certain amount of seconds would be great!
      Total Comment by Oliver: 1

  9. WordPress Version: 4.1SAM Version: 2.5.94SAM DB Version: 2.8PHP Version: 5.4.19MySQL Version: 5.0.96-logMemory Limit: 256M

    After the latest update the auto insert bottom ads won’t show. I have tried creating, recreating, saving resaving, changing settings, and removing ads; nothing works. None of the bottom auto inserted ads are working. I see other people in your forum has reported this issue; are you aware of this and are you in the process of fixing it?

    Thanks in advance…
    Total Comment by Larry: 1

  10. Please contact us for vulnerability information detail in your plugin.
    Total Comment by ITAS Team: 1

    • See details on GitHub (file sam-ajax-admin.php)

      • Hello,

        We were using your plugin (version 2.5.94) and appearently the/a vulnerability got used (3.4.2015).

        By now I cannot find a recent version of the plugin downloadable directly, only via github.

        Is there a safe updated version or is the issue so crucial that you removed the plugin completely? If so, a more visible information for users would be great 🙂


        Best regards,

        Total Comment by Oli: 1

  11. I’m using the plugin without any problems and then some of the ads disappeared. When I investigated I found that the missing ads had been hit more times than the ‘views per cycle’ value. I increased this and the ads reappeared. Great! But eventually it’s gonna happen again – how do I stop this from happening?  I’m not sure what the term ‘cycle’ is supposed to represent or where it is set.
    Total Comment by Stevieg: 1

    • Yes, of course! Until ‘cycle hits’ of each ad in the set (Ads Place) not exceed the value of cycle (in view of weight) ‘display cycle’ is not finished and all ads with exceeded ‘cycle hits’ are not displayed.
      When you save data of any ad in the set, ‘cycle hits’ of each ad in this set reset immediately.

  12. About adding codes to Templates : – I want a banner ad in my header.



    <?php if(function_exists(‘drawAdsPlace’)) drawAdsPlace(array(‘id’ => 1), true); ?> in header.

    Do I need to add below functions anywhere? If yes, then where, how and what format?




    function drawAdsPlace($args = null, $codes = false)
    function drawAdsZone($args = null, $codes = false)
    function drawAd($args = null, $codes = false)
    function drawAdsBlock($args = null)

    Total Comment by Maitreya Dwaipayan: 1

  13. I appreciate all the work and thought that went into this. It seems very complicated and has a high learning curve to just manage a few static ads, however. There are so many steps to just create one ad that it seems tedious to me; containers within containers within containers. Maybe I’m missing some simple way to use it. Perhaps a tutorial/walkthrough might help?
    Total Comment by Dave m: 1

  14. Hi,

    i need your help to do that:

    1) I have 2 banner, the first i need to show always and the second i need to show every 100 impression of the first, you can help me to setting that?!

    Thanks a lot.

    Total Comment by Yuri: 1

    • You can set value of weight of the first ad to the 10 and for the second ad to the 1. But it means that for each 10 (not 100) impressions of first ad will be 1 impression of second ad. As alternative you can use SAM Pro Lite plugin and set daily limitations of impressions for the second ad…

  15. Hi, i really like this plugin, but for this days i´m having troubles, in admin don’t load all the information. I just update the pluggin but it didn’t work.  Could you help me please with this?

    Total Comment by Catalina: 1

  16. your support forum sucks… registery doesnt work, contact us doesnt work!

    well, prices options in earnings settings doesnt work. decimal remain at 0 (ie 1.56€ get 1.00€).

    did i miss something?
    Total Comment by Wardan: 1

  17. Привет, отличный плагин!

    Есть вопрос – вставляю  if(function_exists(drawAdsPlace)) drawAdsPlace(array(id => 8), true);

    в таком виде в function.php что бы выводилось под всеми h2

    но не работает(( Можете помочь?
    Total Comments by Nikolas Voland: 2

    • drawAdsPlace – это процедура а не функция, она ничего не возвращает (выдача данных с помощью echo). Лучше так:

  18. Спасибо большое за Вашу оперативность, однако вставка кода
    function ads_h2($content) {
      if(is_object($samObject)) $content=preg_replace(‘#<h2(.*?)</h2>#’,‘<h2\1</h2><p style=”text-align: right;”>’.$samObject->buildAd(array(‘id’ => 8), true).‘</p>’,$content,3);
      return $content;

    add_filter(‘the_content’, ‘ads_h2’);

    в файл funtions.php не помогла(( Ничего не выводится.
    Total Comments by Nikolas Voland: 2

    • Извиняюсь, совсем забыл про маленький нюанс:

  19. I keep receiving an email from you about an Ad Campaign Report.  It’s coming every 3-6 minutes.  I’m ad 300+ emails.  I’ve removed the ad, turned off the email, and deactivated the plugin.  I’m still getting these emails!
    Total Comment by Brian: 1

  20. With and Height cant change. any one can help me
    Total Comment by Kapila: 1

  21. Hi! I just got Simple ads and it’s running perfectly! But I need to explain to an advertiser what’s the difference between hits and clicks. How can I do that? Hits are so much more than clicks.

    Total Comment by Maria Fernanda: 1

  22. using the Simple Ads Managment

    the reports i’m sending to advertisers are empty.

    why is that and how to fix it?
    Total Comment by kraki: 1

  23. I am wanting to add a banner ads place to the top of my website. I have tried everything and can’t seem to get the code right.


    I have tried:

    What am I doing wrong?? I am in the header.php of my theme, under <head>. I want the ads place id=8 at the very top of my site.
    Total Comments by Dani: 3



    this plugin translated to persian by out team

    get persian language at: http://cdn.mihanwp.com/2016/06/simple-ads-manager-fa.zip

    Total Comment by Reza HosseiniRad: 1

  25. Hello, I’ve been using your plugin for quite a while, and I’d like to ask:

    When I create an ad with an animated GIF, the animated image plays normally on computers, but doesn’t playback at all on phones. Any idea for what might be causing this?
    Total Comment by Sotiris: 1

  26. how can i download the plugin?
    Total Comment by Elvis Ekoigiawe: 1

  27. Hey minimus,

    Just wanted to give you a heads up about a crazy conflict I ran into.

    I’m using SAM to display my post calls to action. One of them is a modal created with ConvertPlug.

    The problem is that I wasn’t able to save any changes to the ad. The modal included an email field and the data validation script prevented me from saving the ad. All I had to do was add an email address and it worked fine.

    It might be handy to be able to turn off the previews.

    Have a great day. I love the plugin.
    Total Comment by Josh: 1

  28. Hello,

    I’m not able to get into my Ads Manager anymore.

    Please advise.
    Total Comment by Eddie Pitts: 1

    • Hi! I’m terribly sorry, but Simple Ads Manager plugin is not supported now. You can use it on your own risk or migrate to the SAM Pro (any edition) plugin.
      About your problem: just remove statistical data from DB table (wp_sam_stats) using any available tools.

Leave a Reply to minimus Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.