• Resolved PapGeo

    (@papgeo)


    Hi,

    I recently installed the plugin AdSense Invalid Click Protector but I can’t make it to work.

    The plugin’s author says we have to add code before the adsense’s code. How can I edit the code of Adsense within your plugin?

    Thanks in advance!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Thomas Maier

    (@webzunft)

    Hi PapGeo,

    thanks for reaching out.

    I saw your post on https://www.ads-software.com/support/topic/help-to-implement-codes/ already, but didn’t understand what type of code needs to be implemented before the ad.

    If this is only a class attribute of a container the ad is wrapped into then you can use the “class” attribute in the ad settings.

    Please let me know if there is more to it.

    Thomas

    Thread Starter PapGeo

    (@papgeo)

    Hi Thomas and thank you for replying.

    The plugin author says this:

    –>
    To use the AdSense Invalid Click Protector plugin with your ad code you basically have to do 2 simple things.

    Put a if( aicp_can_see_ads() ) { /* return your ad code here */ } block before returning your ad code to the front end
    Wrap your ad code within a simple div tag like this <div class=”aicp”>…your ad code goes here…</div>
    –>

    Maybe the “if” isn’t necessary. Where in Advanced Ads can I use the class “aicp”? I can’t find where is it in the settings.

    *Update: Do you mean within an ad where it says “Container Classes”?

    • This reply was modified 7 years, 5 months ago by PapGeo.
    • This reply was modified 7 years, 5 months ago by PapGeo.
    Plugin Author Thomas Maier

    (@webzunft)

    Hi PapGeo,

    thanks for your feedback.

    The “Class” option is on the ad edit page in the “Layout/Output” box.

    Thomas

    Thread Starter PapGeo

    (@papgeo)

    Ok, i’ve found it and placed it there and it works.

    Although, if i don’t want to display an ad after some clicks how can I use the other plugin’s code

    “if( aicp_can_see_ads() ) { /*adsense code*/ } else {}”

    in your plugin’s ads?

    Plugin Author Thomas Maier

    (@webzunft)

    Hm, I thought just using the class would do the trick, but of course I don’t know how the Click plugin works internally.

    Anyway, you can always use the plain text & code ad type and manipulate the content of your ad and even allow it to execute PHP in it. That should work with your sample code.

    Or you hard code your ads or placements into your theme, if that is an option.

    Thomas

    Thread Starter PapGeo

    (@papgeo)

    Thomas,

    Thank you for all your help.

    I checked Allow PHP and placed the following PHP code:

    <?php
    if ( aicp_can_see_ads() ) {
    $adCode = ‘<div class=”aicp”>
    <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– AdLargeSkyscraper1 –>
    <ins class=”adsbygoogle”
    style=”display:inline-block;width:300px;height:600px”
    data-ad-client=”ca-pub-6044170260692863″
    data-ad-slot=”3833990431″>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>’;
    return $adCode;
    } else {
    return ‘<div class=”error”>You have been blocked from seeing ads.</div>’;
    }
    ?>

    …and no ad is showing. I can’t see any error in the code.

    If I create a shortcode within functions.php, will work on your plugin (at the Plain Text & Code section)?

    Plugin Author Thomas Maier

    (@webzunft)

    Hi PapGeo,

    that code would not work, since you don’t echo anything. Please try to use echo instead of return in your code.

    Btw. I’ll assume that the wrong quotation marks are caused by the output here in the forum, but please check that you used the correct ones in your actual code.

    And shortcodes won’t work in the Plain Text & Code field, only in Rich Media, but there is no PHP possible.

    Thanks
    Thomas

    Thread Starter PapGeo

    (@papgeo)

    Hello Thomas,

    Again THANK YOU for your vast help. It worked with echo. What a shame of me, though i am a programmer, i’ve completely forgotten php ??

    Although, i have to test the ads properly.

    I would like to donate to you if it’s possible (in a couple of days).

    Plugin Author Thomas Maier

    (@webzunft)

    Hi PapGeo,

    no problem, this happens to the best of us.

    I would really appreciate a review here on www.ads-software.com and if you find them useful, you can support us with a purchase of an add-on.

    Thanks!
    Thomas

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Ads click protection’ is closed to new replies.