Understanding the different warning messages from GTmetrix speed report

The first thing you need to know when running GTmetrix 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 when using 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 GTmetrix:

Warnings "Leverage browser caching" and "Specify a cache validator"

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 currency exchange rates. For that reason, a shorter cache period guarantees that the correct product prices are displayed at all times using the right conversion.

Warning "Defer parsing of JavaScript"

The report recommends to load all JavaScript content as late as possible. This advice is totally generic and it may or may not be convenient for your store.

Please note that all our scripts are added using the defer HTML attribute, so this warning should not apply.

Just for you to know, we are using a Shopify feature called App Embed Block system, where the scripts loading management in the store is done by Shopify.

Warning "Serve resources from a consistent URL: the following resources have identical content"

The report warns about some content that is identical. This would be useful advice, for example, if the same product image has to be downloaded twice to be displayed twice. However, it also shows false positives when two different actions respond something like 'OK' when their URL is called. In our app code, when the stats are populated, our server responds 'OK' but it is not the same 'OK' message that other tools or apps reply.

Warning "Reduce DNS lookups"

In the early years of the Internet, websites were quite simple and were always served from a single server. However, most modern websites are composed by content coming from different sources. For example, you can have videos that come from YouTube or some analytics code coming from Facebook. This is normal and it is how the Internet works.

The warning is saying that it would be more efficient if all content comes from the same place but even the simplest Shopify store has content coming from different sources because Shopify indeed uses multiple locations to store their different content (HTML, CSS, images, etc.).

Warning "Minify JavaScript"

Our JavaScript files are already minified, compressed, and served from a top world CDN to offer the best possible user experience to our customers. Please read carefully the warning because sometimes it says that the file could be only a few bytes smaller when store sizes are usually millions of bytes. For example, at the time of writing, the Debut theme demo store size was 5,410,652 bytes. Making it 10 bytes smaller won't make a difference.

In order to have more information about our app script you can have a look at the following article: Is the app script file optimised?

Warning "Add Expires headers"

GTmetrix considers that our script or data is not being cached for enough time and for that reason prompts an error. Usually, it recommends to keep files in the cache for 1 week after the initial load, but this would mean that our app would not show fresh content, including your latest product prices changes and the updated currency exchange rates. You don't want this data to be refreshed just once a week.

Warning "Use cookie-free domains"

The report recommends to avoid cookies because, even when they are tiny pieces of information, their size is non-zero. We do not use cookies at all but our static contact is served from a top world CDN for maximum efficiency. The CDN uses a harmless cookie to optimize the content that is served to you (see https://support.cloudflare.com/hc/en-us/articles/200170156-Understanding-the-Cloudflare-Cookies for details). In this case, following the report advice would make your page load slower instead of faster.