• Resolved jackievon51

    (@jackievon51)


    Hello,

    I am having an issue with LiteSpeed Cache rewriting a Google Merchant Center widget script, which causes the widget to stop working on my WordPress site.

    1. Original Code (before LiteSpeed optimization)
    <script id='merchantWidgetScript' src="https://www.gstatic.com/shopping/merchant/merchantwidget.js"defer></script>
    <script>
    merchantWidgetScript.addEventListener('load', function () {
    merchantwidget.start({
    position: 'LEFT_BOTTOM'
    });
    });
    </script>
    1. Code after LiteSpeed optimization (frontend source)
    <script id='merchantWidgetScript' src="https://www.gstatic.com/shopping/merchant/merchantwidget.js"defer></script> <script type="litespeed/javascript">merchantWidgetScript.addEventListener('load',function(){merchantwidget.start({position:'LEFT_BOTTOM'})})</script>

    Because the script becomes type=”litespeed/javascript” and data-src, the Google Merchant widget never initializes.

    1. What I have already tried
      I have already excluded the script in LiteSpeed settings:
      LiteSpeed Cache → Page Optimization → Tuning
      JS Excludes:
      https://www.gstatic.com/shopping/merchant/merchantwidget.js
      merchantwidget
      gstatic.com/shopping/merchant
      JS Delayed Excludes:
      https://www.gstatic.com/shopping/merchant/merchantwidget.js
      merchantwidget
      gstatic.com/shopping/merchant

    I also purged all caches:
    Purge All
    Purge All – LSCache
    Purge CSS/JS Cache
    Browser hard refresh

    1. Current Optimization Settings
      JS Minify: ON
      JS Combine: OFF
      Load JS Deferred: ON
      Delay JS: OFF

    Guest Mode: previously ON, now tested with OFF as well.

    1. Issue
      Even after excluding the script, LiteSpeed still rewrites the script to:
      type=”litespeed/javascript”
      data-src=
      which prevents the widget from loading.

    Any help would be greatly appreciated.
    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support litetim

    (@litetim)

    @jackievon51 please send a report to LiteSpeed from LSC plugin => Toolbox => Report => click on “send to LiteSpeed” and share the ID generated(just the id).
    Thank you 🙂

    Thread Starter jackievon51

    (@jackievon51)

    @litetim

    WQRNYQWR

    Plugin Support qtwrk

    (@qtwrk)

    the issue is you have CF cache on your page , some feature from our plugin is not compatible with other caching system

    you could try 1) disable the CF APO , or 2) if you only have problem with this particular javascript, then you can use JS exclude function to exclude it

    Plugin Support litetim

    (@litetim)

    double posting

    • This reply was modified 2 months, 2 weeks ago by litetim.
    Thread Starter jackievon51

    (@jackievon51)

    Thank you for your reply.

    I have followed your suggestions and disabled both Cloudflare APO and the Cloudflare module inside LiteSpeed Cache, but unfortunately the issue still persists.

    I have also already excluded the following script using the JS Excludes settings:

    https://www.gstatic.com/shopping/merchant/merchantwidget.js
    merchantwidget
    gstatic.com/shopping/merchant

    However, LiteSpeed still rewrites the script on the frontend to:

    type="litespeed/javascript"
    data-src="https://www.gstatic.com/shopping/merchant/merchantwidget.js"

    which prevents the Google Merchant Widget from loading.

    Could you please help check the latest LiteSpeed report?

    Report ID: ZOQWMPKT

    Thank you very much for your assistance.

    Plugin Support qtwrk

    (@qtwrk)

    CF page cache is still in use ,

    Plugin Support litetim

    (@litetim)

    @jackievon51 please fix what my colleague wrote. I tested your setup should ignore inline JS by keyword you set.

    Also type=”litespeed/javascript” will appear only if you have Load JS Deferred set to Delayed.
    Please purge All and try purging CSS/CSS too.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.