Understanding the different warning messages from PageSpeed Insights speed report

The first thing you need to know when running Google PageSpeed Insights (a.k.a. Google Lighthouse) is that it only provides general information. This report cannot identify if a certain code is really necessary or not, and this is especially important if you use third-party apps, as it might consider that the app code is not essential and claim that it could slow down your store.

Having this in mind, we will explain below why our app code may appear in some of the warning messages you can see in Google PageSpeed Insights:

Warning "Remove unused JavaScript"

The report detects our code as "unused code". We can definitely say this is a false positive. Bear in mind our app code must be present in order to be able to zoom your product images.

Just for you to know, we are using a Shopify programming feature called ScriptTag which allows our app to be injected dynamically by Shopify when a page loads, to prevent theme template modification. Apart from this, the code contained on the loaded script is reduced to the bare minimum in order to minimise the impact of our app loading.

Warning "Serve static assets with an efficient cache policy"

Our resources are cached for about 1 minute (app data and preferences) and 1 hour (app script).   
The former is necessary to ensure that the app widget shows the most recent data, and allow you perform changes in your app preferences and have all changes reflected quickly.   
The latter is convenient to always have the latest version of our app, ensuring compatibility with the changes in the Shopify platform.

Having a different cache policy would cause more harm than good; for instance, our app would not show the most recent changes in regards to the configuration options you have chosen in the app preferences page. For that reason, a shorter cache period guarantees that the app is working to its fullest potential.

Warning "Reduce JavaScript execution time"

In order to display our app on your store we need to insert the app JavaScript code. The report detects that our app code is loaded and may recommend to remove it because the report does not know what it does. However, our app code is essential to show the app.

Please note that our JavaScript files are compressed, minified, and served from a top world CDN to offer the best possible user experience to your customers.

Warning "Avoid long main-thread tasks"

In order for our app to be displayed and continue working while your customers are browsing your store, it needs to remain active, and this is what the report identifies as a "long task". However, most of the time our app is doing nothing and consuming no resources but it must remain loaded to interact with your customers' actions.

Warning "Avoid chaining critical requests"

The reports warns that it has detected several scripts running before all page resources have finished loading. The report does not know if some resources are more important than others, so it displays a generic warning.

If you don't want the warning to appear you can disable the ‘Fast Loading’ option in our app preferences page; this option allows the widget to load quickly in your store. If this option is disabled, the app will load after all other store content and will render much later in the pages. In that case, the score report will be higher but the content will be displayed later to your customers.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.