Support » Plugin: AdSense Invalid Click Protector (AICP) » Plugin showing error and slowing the site.

  • Hi Sir,

    I have tried to use this plugin but unfortunately it is showing some errors at my site. I used following code (replace with my adsense code) through PHP code in Ad Inserter plugin:
    <?php
    if( aicp_can_see_ads() ) {
    $adCode = ‘<div class=”aicp”>
    <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– AdSense Responsive Ad Code –>
    <ins class=”adsbygoogle”
    style=”display:block”
    data-ad-client=”ca-pub-1234567890″
    data-ad-slot=”0987654321″
    data-ad-format=”auto”>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>’;
    echo $adCode;
    } else {
    echo ‘<div class=”error”>You have been blocked from seeing ads.</div>’;
    }
    ?>

    But here it is showing following error:

    PHP error in Ad Inserter code block – 11 – …..
    Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting, “,” or “;”

    When I changed:
    echo ‘<div class=”error”>You have been blocked from seeing ads.</div>’;
    with:
    echo “Sorry! you are blocked from seeing the ads.”;

    It is not working and takes about 1-2 mints to load the page but still showing ad.

    Kindly guide me where I am doing wrong.

    Regards,

    Chetan

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Saumya Majumder

    (@isaumya)

    I’m sure that you are making some syntax error in your code. Can you share a screenshot of the ad insert block?

    Thanks for quick Reply,

    here is the link of screenshot:
    https://ibb.co/kh08bL

    Regards.

    Plugin Author Saumya Majumder

    (@isaumya)

    Taking a quick glance at your code I don’t see any issue with your ad code. In the error does it gives any line number? There is some mistake going on but which is really hard to say where you messed up without actually looking into your implementation. Just to be sure AICP plugin is enabled in your site correct and then you are doing this.

    Another thing you can try is deleting the single and double quote from your code and type the respective quote from your keyboard. Sometimes copying codes has issues with quotation mark.

    Let me know if this works.

    The error is not showing any line number, I have used AICP code in header widget through Ad Inserter plugin, the error message as described above appears in header widget on front page.
    I am feeling that some plugins which I am using may be uncompatible with AICP are slowing my site. One more thing that I have not used any AICP code in my theme’s function.php file, I have only used the code in Ad Iserter plugin.

    Moreover I have deleted all quotes and manually typed the code but it is not working.

    I will be happy if you can suggest some more solution.

    Regards,

    updating — After manually typing the quote now it is not showing the error but not hiding the ad and takes about 1-2 minutes to load the page.

    Plugin Author Saumya Majumder

    (@isaumya)

    If you are using any caching plugin, please disable that. AICP doesn’t work with any caching plugin.

    No I am not using any cache plugin right now, already deactivated w3 total cache plugin.

    Plugin Author Saumya Majumder

    (@isaumya)

    can you share your website URL where I can see AICP in action?

    Sure, you can check here the links ad on header widget on upper right side of the page, the AICP code with adsense code added in Ad Inserter PHP block:
    https://www.impexbook.com/

    Now the site loading very slowly but if I remove the code in this block the site loads fast.

    Plugin Author Saumya Majumder

    (@isaumya)

    One last question can you check that if the country wise ad blocking is enabled in the AICP settings of your site or not?

    Yes it is enabled and two letters code of my country according Alpha-2 list is added for test purpose.

    Plugin Author Saumya Majumder

    (@isaumya)

    Can you try disabling that feature on your site host to see if it fixes the issue?

    I am sorry, I am not getting well what you are saying about, I mean I should click on No option to block a country in general sstting of AICP plugin.

    When I pressed No option site loads nicely without hiding ad.

    Plugin Author Saumya Majumder

    (@isaumya)

    In the AICP settings, there is an option saying Do you want to block showing ads for some specific countries? Set it to No and let me know if the issue persists.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Plugin showing error and slowing the site.’ is closed to new replies.