Support » Plugin: Autoptimize » Page not fully working with AO

  • Resolved willjames

    (@willjames)


    Here is the example page but it is on all of the pages of this type.

    There is a js click event that reveals the telephone number of the advertiser. This is also linked to a Google Tag Manager event for analytics.

    I have AO, ccss and rapidload with WP Supercache set up.

    The JS file that seems to be called from the click is app-ajax.js I have tied to exclude this from AO but it doesn’t work.

    When I delete the page cache for WP Super cache the js on the page usually works again.
    The problem is I need every page cached and there are thousands of pages and it takes half a day to cache the pages and slows the site massively.

    How can I get the cached pages to always work without having to refresh the whole time?
    Thanks in advance

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    motors/assets/js/app.js indeed has the logic to show the phone number and for that purpose launches a request like this one (changed some numbers in there);

    
    https://www.truckpages.co.uk/wp-admin/admin-ajax.php?phone_owner_id=163&action=stm_ajax_get_seller_phone&security=ff09647abf

    The problem stems for that last parameter, security, which is based on the sellerPhone variable which is set in the HTML in inline JS (untouched by Autoptimize). Based on your description this security token acts like a nonce and expires after some time, resulting in the cached HTML having an expired token, making the request fail.

    The solution: ask the theme developer what the validity of that security token is and adapt WP Super Cache’s page cache time accordingly.

    hope this helps,
    frank

    Thread Starter willjames

    (@willjames)

    Thanks for coming back to me – the theme developers are as much use as a chocolate teapot. Is there any way I can dig into the code to find this token out/remove the need for the token?, (its security is not that important)?

    Thanks

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    that will require a lot of digging in both the JS & PHP code willjames, I would not recommend that unless you (a) know very well what you are doing, (b) test thoroughly and (c) at all times keep a backup of the files you’re changing …

    Thread Starter willjames

    (@willjames)

    I think I will re-write with no js (<details> Summary>) perhaps would work just using html.
    Thanks for your help here

    Thread Starter willjames

    (@willjames)

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Page not fully working with AO’ is closed to new replies.