Support » Plugin: Simple Ads Manager » [Plugin: Simple Ads Manager] Ads getting blocked as pop ups

  • The ads that are generated using the drawad() are getting blocked as pop ups on most browsers. Even though I have many links with target=”_blank” on my page these are the only ones that are getting blocked as pop ups. Could you please tell me what I can do to prevent this from happening?
    Here’s the generated code on the page :
    <div class="homepage_ad spot2"><a id="a29_2" class="sam_ad" href="http://www.gyaanexchange.com/catalogue/arts-in-motion/" target="_blank"><img src="http://www.gyaanexchange.com/wp-content/plugins/sam-images/artsinmotion.jpg" alt="Find classes on performing arts"></a></div>

    You can view the page here:

    Would really appreciate your help on this. Thanks a ton!

    http://wordpress.org/extend/plugins/simple-ads-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author minimus

    (@minimus)

    Set “Display Ad Source in” on Settings Page to “New Window”

    Thanks minimus, it was on New Window so I switched it to current tab and its working perfectly fine now! Thanks again!

    @minimus

    I use the plugin in a multisite. I have chosen “New Window”, at the begining it looked like it worded with “New Window” and then it kept working with pop-up again. Why is this happening?
    Also, I think that is better to have an option in every banner how we want to show it.

    Actually the issue is very easy to fix. It’s a small programming error related to the click tracking snippet.

    Modify sam-layout.js located in /js folder so it looks like this:

    (function($) {
      $(function() {
        $("body").on('click','.sam_ad', function() {
          	var $me = $(this),
          		adId = $me.attr('id');
    
          $.ajax({
            type: "POST",
            url: samAjax.ajaxurl,
            data: {
              action: "sam_click",
              sam_ad_id: adId,
              _ajax_nonce: samAjax._ajax_nonce
            },
            async: true
          });
        });
      });
    })(jQuery);

    The clicks get counted and the target behavior is the expected.

    Regards.
    S.

    But that isn’t update-safe 🙁

    Well, maybe the plugin developer will include the patch in his next release. Update safe patches should be considered with care as they can prevent the updated plugin to act on its own.

    Anyway, you could unbind the click event and then bind it to the .sam_ad class in an external js file, let’s say your custom scripts.

    The final code will look like this:

    ( function( $ ) {
      $( function() {
        $( 'body' ).off( 'click', '.sam_ad' ).on(' click', '.sam_ad', function() {
          	var $me = $( this ),
          		adId = $me.attr( 'id' );
          $.ajax({
            type: "POST",
            url: samAjax.ajaxurl,
            data: {
              action: "sam_click",
              sam_ad_id: adId,
              _ajax_nonce: samAjax._ajax_nonce
            },
            async: true
          });
        });
      });
    })( jQuery );

    What this will do is override the click event in the plugin with the custom function.

    Hope it helps 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Simple Ads Manager] Ads getting blocked as pop ups’ is closed to new replies.