• Resolved adrianpereiro

    (@adrianpereiro)


    Hi! Since I’m seeing adsense is making a good pasive income, I would really like to secure my account to the fullest.
    This plugin is really useful and I’m willing to use it in all my websites, but I can’t lose the extra speed cache plugins as autoptimize. Since I know some programming, would be possible to check if the user is banned before displaying stored cache?

    Do you know any optimization alternative that works well with this plugin?

    Forgive me if I’m asking for something too crazy ??
    Have a great day <3

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

    (@isaumya)

    Trust me I completely get what you are saying but in order for this plugin to work each request of the page when AICP is being used must be parsed through PHP and not cache so that PHP can run the code and do all the checks needed.

    Thread Starter adrianpereiro

    (@adrianpereiro)

    I see, thanks for the reply
    Btw, how does this plugin detects when someone clicks on ads? It’s safe? ??

    Plugin Author iSaumya

    (@isaumya)

    @adrianpereiro Check the code of the plugin, it uses a jquery iframetracker to detect click inside iframe.

    @isaumya thanks for your work. I really like your idea. However, I think there is a limitation. Big sites with a lot of traffic need to use a cache system. In this scenario, as you said, the plugin starts to be unuseful because of its architecture.

    Actually, your idea is to use the backend to render the entire page, ads code included. What about using an ajax call (per each request) to a specific backend endpoint, check is the user can display the ads and then push the ads code inside the DOM in a dynamic way? This approach would solve the problem and it would make the plugin much more useful. (Maybe you can consider to make it a premium functionality).

    Let me know what do you think about it.

    Plugin Author iSaumya

    (@isaumya)

    Well, one of the major problems of creating a plugin is to ensure it works on every system. And to create a generic backend that will work everywhere is simply quite complicated and especially for a free plugin.

    Also not sure if so many Ajax requests can be handled by the user server or not.

    @isaumya after checking the code of the plugin I think that part of the logic can remain the same. You only need to expose the endpoint to check the request via Ajax and inject the ads into the page (probably using a shortcode or something similar). The performance should remain the same because instead of checking the request during the page generation you can do it via Ajax during/after DOM rendering.

    Actually you are doing something like this:

    Request -> [country_block_check/visitor_ip_check] -> Backend Page Generation -> Rendering -> [ads count check via cookie]

    What I suggest is to change the approach doing something like this:

    Request -> Backend Page Generation -> Rendering -> [country_block_check/visitor_ip_check via Ajax] + [ads count check via cookie] -> Ads injection

    You know, it is up to you. It just a suggestion to make the plugin more useful ??

    • This reply was modified 5 years, 2 months ago by Kamil Molendys. Reason: typo
    Plugin Author iSaumya

    (@isaumya)

    Hi,
    If you would like to contribute to the code, please feel free. ?? Cause despite the idea being sound, it will not work due to the fact how Google Adsense works. If you add Google AdSense ads on the fly it won’t show the ads. The ad code needs to be there from the first moment. Else Google will simply ignore it. Try running a small test with setTimeout() or ajax dummy where you will insert the Adsense code after say 3 sec or something.

    I am also brainstorming to improve a few things of the plugin if I do get some free time.

    • This reply was modified 5 years, 2 months ago by iSaumya.
    • This reply was modified 5 years, 2 months ago by iSaumya.

    @isaumya I have spent some time trying different approaches. According to the Adsense documentation it is possible to load ads in asynchronous way.

    Let’s assume that the script

    <script async src="https://pagead2.googlesyndication.com/
    pagead/js/adsbygoogle.js"></script>

    is included in the page. You can add dynamically the snippet code for the ads simply appending it to the DOM

    <ins class="adsbygoogle"
        style="display:inline-block;width:728px;height:90px"
        data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
        data-ad-slot="1234567890"></ins>

    After that, you need to call

    (adsbygoogle = window.adsbygoogle || []).push({});.

    It seems to work. Feel free to contact me so we can think and discuss future implementation.

    Plugin Author iSaumya

    (@isaumya)

    @kamy22 This is a developer way. No normal Adsense users are going to use this approach. They will simply copy-paste code. So, explaining them about how to copy-paste the ad code will become even more complicated.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Is there any way to using this plugin with cache?’ is closed to new replies.