Hi everyone,
It seems that we are talking about the short cache times of HubSpot scripts, specifically ones like
js.hs-scripts.com
hs.hs-analytics.com
and others. Google recommends that sites set cache times of over 1 year on served assets, however as mentioned above there are certain HubSpot assets that need to have short cache times in order to properly execute their functions.
Take for instance the analytics script: the ‘hs-analytics’ script is updated based on any changes made to your tracking settings such as those outlined in this doc https://knowledge.hubspot.com/articles/kcs_article/reports/set-up-your-site-domains as well as changes to your cookie policy settings (https://knowledge.hubspot.com/articles/kcs_article/reports/customize-your-cookie-tracking-settings-and-privacy-policy-alert).
This script needs to be current to ensure that it loads with current info to reflect any settings you’ve changed in-app. If this script was to be cached for over a year, as Google’s recommendation states it should be, this would mean that changes to your tracking or cookie policy settings would not be seen by your current visitors for over a year.
Changes to a privacy policy for compliance reasons, are especially critical to be shown in a timely manner and the prospect of these not being seen for a year by a large section of your customer base would be unacceptable, especially for the payoff of a few points on a page speed recommendation tool.
@dewolfe001 to address your points:
1.) As mentioned above, this would cause more harm than good.
2.) The problem google has with these assets is the setting of a short cache time, where the files are pulled from would not affect this Google recommendation.
3.) Each file is fundamental to HubSpot functionality, and managed separately for various reasons. Combining these files could lead to serious issues, and again wouldn’t resolve Google’s qualm with these files not having a longer cache time.
4.) When hosting on HubSpot, users use HubSpot’s servers, not normally using their own servers in any context. Additionally, as mentioned above, setting a long cache time on the assets would be detrimental.
5.) Most HS scripts are not flagged by Google as render blocking, since they are not rendered in the head HTML and load asynchronously. (you can choose to load Jquery in the footer, via your settings as outlined in Site Speed and Performance: What you can do, and How HubSpot Helps) Additionally, this does not affect the flagging of caching, which is what is discussed in this thread.
While recommendations from page speeds are definitely valuable, they aren’t always appropriate to implement and in the case of caching of these scripts, would not be a beneficial action.