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 widget would not show the most recent changes in regards to the configuration options you have chosen in the app preferences page or a new video that it has just been configured. For that reason, a shorter cache period guarantees that the app is working to its fullest potential.
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.).
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 the most recent changes you configured in the app preferences page or the new video you have configured. You don't want your product data to be refreshed just once a week.
Warning "Use cookie-free domains"