Does this work with Ad Inserter Plugin?
-
This plugin looks beautiful and has probably saved many Adsense accounts from being banned, thank you for making it! I was told about it and would like to use it as well. I do not know much about coding so I use the Ad Inserter Plugin to place ads throughout my site. When I install and activate this plugin do I need to do anything to my Adsense ad code that I have placed in Ad Inserter in order for your plugin to work for me? Or do I simply activate it and it will work?
The page I need help with: [log in to see the link]
-
Hi,
this plugin works perfectly with [Ad Inserter](https://ww.wp.xz.cn/plugins/ad-inserter/) plugin. As Ad Interter plugin allow users to directly put PHP codes inside the ad blocks, you can simply enable thephptoggel inside your ad inserter adblock and then instead of creating a shortcode and calling the shortcode, you can directly put the following example PHP code to show your ads:<?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 -->'; return $adCode; } else { // Anything within this part will be shown to your banned visitors or to the blocked country visitors return '<div class="error">You have been blocked from seeing ads.</div>'; } ?>Hope this helps.
Thank you so much for your quick reply! So Would this be accurate ad code implementation into the ad Inserter Plugin?
https://www.dropbox.com/s/xnfgt10jbrxrgyu/Photo%20Jan%2002%2C%2010%2004%2028%20AM.jpg?dl=0
I don’t want it to say anything to the banned users, just a blank spot is fine. I have changed my publisher ID and such, but please let me know what to fix before I submit. I erased the text you put as a guide, but otherwise did not change anything else. I don’t know much about coding which is why I’m very glad you’re able to help me use your creation thank you very much!!
You need to enable PHP processing (top right PHP button) and you probably don’t need PHP function call.
@trae10 Hi,
first, you enable PHP processing by clicking on the top right php icon. Screenshot: https://i.imgur.com/tz8Xria.jpgThen if you do not want to show anything to the blocked users, you just simply don’t use the
else{}block and only use theif{}block like the following:<?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 -->'; return $adCode; } ?>Hope this helps.
Thank you very much for replying! I tried the code you sent and added my code etc, but my ads do not appear at all on my site is the my code wrong? (I’ve changed publisher ID and such)
https://www.dropbox.com/s/3og66qhmyjjalvz/Photo%20Jan%2002%2C%205%2008%2026%20PM.jpg?dl=0
Not sure why it’s not showing my ads.
Don’t just change the ids, try replacing the Adsense ad code with the code you are seeing in your admin console.
I’m sorry, which part of the code are you referring to ? Can you elaborate please? I’m really new to this. Where do I find the code in my admin console ? And which parts of the code you provided above do I have to properly replace in order for my ads to show? Thank you again for all of your help!
Hi, the above code example I’ve given, in that example the following part is the adsence code
<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>which you will find inside your adsense account. Just replace that with the code showing inside your adsense account.
Yes that’s what I did in the screenshot above
https://www.dropbox.com/s/3og66qhmyjjalvz/Photo%20Jan%2002%2C%205%2008%2026%20PM.jpg?dl=0
And it did not work? My ads did not show up. (I’ve changed the publisher Id and ad # in my code for this screenshot) but I didn’t correctly insert my own Adsense code and it is not showing ads on my site ? Does it have to be a Responsive ad ? Is that why?
“but I didn’t correctly insert my own Adsense code and it is not showing ads on my site ?” – Yes, you just changed the ID, not copied your entire ad code. Copy paste your entire ad code. No, it does not need to be a responsive ad. It can be a responsive ad or normal ad.
If you have cache enabled, try disabling that.
I meant that I did correctly insert my Adsense code, I simply changed the ID for the screenshot purposes. But it’s still not working… maybe it doesn’t work with ad Inserter not sure. I really wish I could have used it, it would make me feel safer, but thank you anyways for all of your help!
Yes is there another way we can speak please? As I do not want to post personal information here if that’s okay?
I’m really sorry in my above code I did a mistake, at the last part it won’t be
returnit will beecho. Fixed example code below:<?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; } ?>Sorry!
Thank you SOOOOO much! Thank you! It works PERFECTLY.
-
This reply was modified 8 years, 5 months ago by
trae10.
No problem. 🙂 Enjoy 🙂
-
This reply was modified 8 years, 5 months ago by
The topic ‘Does this work with Ad Inserter Plugin?’ is closed to new replies.