• Resolved marbs

    (@marbs)


    Ads Inserter uses various JavaScripts for its functionality. To exclude it in WP Rocket, which currently implements lazy loading, I need to identify the specific JavaScript files used by Ads Inserter and exclude them from the lazy loading optimization for Ads Inserter to perform optimally.

    Issue: I’ve been experiencing an issue with my website where AdSense ads are being displayed with a delay on mobile devices. Specifically, the ads only appear after a slight scroll on the mobile device.

    Thanks in advance.

    • This topic was modified 8 months ago by marbs. Reason: added issue
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Spacetime

    (@spacetime)

    If you set JavaScript code to Inline then the code is inserted inline. The code contains string ai_js_code.

    If File is used then it is /ad-inserter/js/ai-functions.js

    https://adinserter.pro/documentation/plugin-settings#javascript-code

    Thread Starter marbs

    (@marbs)

    Yes, I have set this already to inline and I have added /wp-content/plugins/ad-inserter/js/(.*).js in the exclusion.

    I am requesting a list of all the JavaScript files used by Ad Inserter

    Plugin Author Spacetime

    (@spacetime)

    That folder contains all the js files used on the frontend.

    Thread Starter marbs

    (@marbs)

    @spacetime I added all the javascripts in the exclusion list but no result. On mobile only the header ad keeps being delayed.

    This is what Wp Rocket told me to do: “Could you please try to add the exclusion listed below in the Excluded JavaScript files text area, under the Delay JavaScript execution option and the ads to be displayed without user interaction:

    And this is the screenshot they shared.

    Based on the screenshot they are referring to a file that looks similar to the ai_cookie_js case and I am not using the ad-block function from Ad Inserter.

    I installed your competitor’s plugin to see if I can rule out things but I was not able to recreate this issues.

    Awaiting your response,

    Kind regards!

    Plugin Author Spacetime

    (@spacetime)

    The code on the screenshot belogs to Ad Inserter but it is not as it was generated. There should be no attribute. Normally the code runs in the footer as soon as the page is loaded. Very likely this attribute delays running the code. Make sure the generated code is not modified in any way.

    Thread Starter marbs

    (@marbs)

    @spacetime when I enable “Disable caching” the ad is being displayed on mobile without delay. But does that mean that the cache for my entire post is disabled or only the ad-unit in question?

    Thanks.

    Plugin Author Spacetime

    (@spacetime)

    Disable caching disables caching of the page where this block is inserted:
    https://adinserter.pro/documentation/additional-block-settings#insertion

    It seems you have caching issues. Flush all the caches, especially in the browsers.

    Thread Starter marbs

    (@marbs)

    Hmm ok, I am letting WP Rocket look into this I gave them my login and I will give you a status update. To help you in case someone is using WP Rocket too @spacetime

    Thread Starter marbs

    (@marbs)

    @spacetime as promised for future inquiries related to caching and wp-rocket users I recommend to update your documentation on caching with the following info below:

    WP Rocket said: “Adding the b2a exclusion in the Excluded JavaScript files text area, under the Delay JavaScript execution option did the trick”

    See screenshot.

    Also add /wp-content/plugins/ad-inserter/js/(.*).js to the Excluded JavaScript Files in the minification field and delay field.

    For further Adsense related caching issues refer to WP-Rocket’s guide.

    Plugin Author Spacetime

    (@spacetime)

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Information req: JavaScripts Used by Ads Inserter’ is closed to new replies.