How can I use this plugin with Advanced Ads Plugin
-
Ads are automatically inserted in posts by the plugin.
How can I use AICP with them.
Please guide me.The page I need help with: [log in to see the link]
-
Hi, I am sorry I don’t know whether or not it will work with advance ads plugin. But I’ve personally tested it with Ad Inserter plugin which does the same thing in a much better way with a lot of customization. If you wanna know how to use it with Ad inserter plugin, check this thread as I’ve already explained it there: https://www.ads-software.com/support/topic/does-this-work-with-ad-inserter-plugin/
It also works with Advanced Ads. Following Saumya’s advice, just use the Plain Text ad type, switch on PHP and use the following code if you do not want to show anything to the blocked users.
<?php if( aicp_can_see_ads() ) { // This part will show ads to your non-banned visitors $adCode = '<div class="aicp"><!-- Don\'t forget to add this div with aicp class --> <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"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div><!-- end of the aicp div -->'; echo $adCode; } ?>
@isaumya is there a class one can use to mark those ads?
Thomas, author of Advanced Ads
@webzunft Thanks for the help man. Just one thing, when you copied my code, you also copied the error I made in that snippet, that is why I’ve posted the updated version of that snippet at the end of that Ad Interseter plugin help thread. Actually, the issue is that at the end it would be
echo
and notreturn
, if you justreturn
nothing will show up at the front end. You get the idea right? Reposting the above snippet in a fixed way:<?php if( aicp_can_see_ads() ) { // This part will show ads to your non-banned visitors $adCode = '<div class="aicp"><!-- Don\'t forget to add this div with aicp class --> <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"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div><!-- end of the aicp div -->'; echo $adCode; } ?>
is there a class one can use to mark those ads?
– Sorry, I didn’t get your question clearly. Can you explain a bit more?
@matoridea Your problem solved. ?? Now you can use AICP with Advanced Ads Plugin. ??
@isaumya, thanks, updated my reply as well.
Some solutions that have a similar purpose to your plugin also support a wrapper with a specific class around the ad for click validation.
Advanced Ads has an option in the ad settings that allows adding a specific class to a container around the ad. Just wanted to mention that.Thanks again for your help.
@matoridea I hope you did find the answer you were looking for.
Thomas
@webzunft Yes, if you look closely at the AICP ad code or in the description of the plugin, you will see the ads needs to be wrapped inside
<div class="aicp">...</div>
within the php clause. But just adding the div is not gonna work, you also need to put the php if statement to work. It is a conjunction of both the php if statement and that<div class="aicp">...</div>
. As this plugin not only just protect adsense ad blocks from invalid clicks but also you can stop showing ads for some countries if you like. So, you need bot the div.aicp wrapper and the php if clause.Interesting. How does the PHP check work? Does it use a cookie?
@webzunft No. The cookie is being needed by JS so PHP is not needed for that. The reason PHP check is needed needs a bit explanation, which is hard to do over text, but I will try my best.
1. When someone gets blocked, their IP gets flagged on the DB. So, next time when the user tried to view the site the server will check if the user’s ip is flagged or not. If it is flagged ad in theelse
block of the code you have added some nice donation message or say some affiliate ad banners, that will show up instead of adsense ads. Moreover, when a user gets banned, he gets banned over 2 layers. Layer 1 PHP and Layer 2 cookie. So, if I delete the ip from flag list before the auto-deletion time is given, the user will still not see the ads as he is still flagged at the cookie level and JS won’t allow you to show the ads. Watch the video explanation at the plugin description page, you will understand it better.2. As I said earlier if you want you can ban some countries from seeing the ads. At this time when a user views the site, PHP gets your IP, pass it though API to get your country details to check whether or not you should see the actual ads. Now if you are visiting from a banned country and there is an
else
block in yourif
block, then that message or affiliate ad banner will be shown. If there is noelse
part, then the banned user will see nothing.3. Also in the WP Admin dashboard, there is a widget showing you some analytics about how many users have been banned in total, in 6 months, in 24 hours etc.
This is just a gist of the story. Hope you find it interesting. ??
@matoridea Thanks a lot for your comment. If possible, please preview a review in the review section of the plugin and if you can, consider donating some amount.
@isaumya
Hi I just tested the plugin by setting the ad click limit to 1 but the ads didn’t hide. Can you please help and check it ?If you are using ay sorts of caching plugin then please disable that and then retry.
Also please note, when you have set the click limit to 1, the user will be allowed to click 1 time, when he clicks the second time, then he will get banned.Fixed. thanks
If caching is an issue then we have a cache-busting feature in Advanced Ads Pro.
@isaumya thanks for the details about how it works!
Thomas
@webzunft Thanks for your help. ??
- The topic ‘How can I use this plugin with Advanced Ads Plugin’ is closed to new replies.