How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
I agree: I can address image optimization. I can move Google Fonts onto our own server. I can even make selective pages static to deliver content faster than possible from a CMS. The biggest issue is the bad expiries on the Hubspot scripts.
Ways Hubspot could address this:
Put far future expiries on some of all of the assets they include
Push out these files via CDNs
Combine JS files (HS is sending out 5 files that could be 3 or even two files)
Interoperate with their clients: give them something like a plugin that outputs the HS files from the client server reducing DNS lookups and allows clients to self-manage their own expiry.
Allow the HS script to not carry out render blocking and encourage developers to put HS relevant code into the footer of the pages.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
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.
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.
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 https://designers.hubspot.com/blog/site-speed-and-performance-what-we-do-and-what-you-can-do) 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.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
@jennysowyrda great points on the analytics scripts department, I think it's fair to say that if we compare analytics script caching policies across tools like Facebook, Google, Vimeo and Hubspot we will see similar tactics, so it's difficult to say that Hubspot is not doing its utmost in this department.
In the majority of cases, I educate clients that 3rd party scripts are beyond our reach when it comes to caching policies and to expect these to appear as breaking the "efficient cache policy rules" according to speed test. These scripts are loaded via 3rd party servers and it's up to them to determine how they would like the browser to cache the scripts. Hubspot should fall into this category.
Often it is the case that clients can become **bleep**-bent on page speed scores improvements from tools like Lighthouse and GT Metrix. This is not always wrong, but also not always the best investment of time.
But, and there's always a but, there exists little reason for Hubspot to not expose browser cache configuration to clients. Hubspot offloads to Cloudflare for a majority of CDN requirements, and rightfully so, Cloudflare is incredible! Cloudflare also offers direct clients to adjust browser cache policies and purge cache via APIs or the admin panel (ref: screenshot). And all of this goes without the mention of file revisioning tactics that can allow you to set a high browser cache and flush through updating file names thus naturally flushing browser cache.
So what are some solutions that can help ease everyone's pain :
Allow Hubspot users to set their own browser cache policies for static assets delivered via the Hubspot CDN / Cloudflare similar to how Cloudflare allows this in their own portal
Enforce the most performant or recommended cache policies for static assets while implementing static asset revisioning policies when files hosted on Hubspot are updated
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
Hi there, this is the biggest thing holding me back, I'd like to stay updated. HubSpot Support responded to my optimization efforts saying they already provide AMP for mobile, http/2 and page caching. But every time I test landing pages they come up uncached and it's killing the speed. So It seems the BLOG pages are optimized, but the LANDING PAGES are not. Unfortunately, we have no need for a blog, but urgently need OPTIMIZED LANDING PAGES.
I'm looking into manually coding each asset to lazy load to offset the issue, and even that is cumbersome, I can't believe I'm not given a choice to have lazy loading with the cache issues I'm running into.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
I'm challenged with the same issues. GTMetrix gives top grades down the line but fails for "Leverage Browser Caching".
I'm not a developer, but focused on site rankings, running audits via semrush, etc. The page load and speed affects other objectives downstream. If anyone notices an opportunity for me to improve this on my own, please lmk.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
So, would everyone, I'd assume. But, considering that this has been posted for a year and not a single comment from the HS Gods, I'd say that its not much of a priority.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
Hi all,
HubSpot automatically sets a cache time on served assets; removing the need to manually set cache times.
While most assets, such as images from the file manager, are served with a longer cache time (such as 14 days) other assets are purposefully set to have shorter cache times. This includes assets such as the tracking code, for which having a short cache time is important and would be detrimental to increase.
There are some good takeaways to gather from bots and grading tools in general; however, HubSpot focuses more on things which enable the best possible experience for visitors, as opposed to the various optimizations grading tools provide.
If page speed is actually negatively affecting a visitors journey/experience (as opposed to being flagged via a page speed test, though a page loads at a fine speed) there are almost assuredly other aspects which are affecting the page more than setting a longer cache time on served assets.
There is a knowledge base article on a few common optimization tips here as well as a blog post here, which talks about the ways HubSpot does optimize for speed as well as other optimization tips.
But a question. Does Hubspot have a relationship with Google and its bots, that when Google grades Hubspot sites, it says " oh this is a Hubspot site, I'll take their word for it that the site is optimized " If not, then when Google grades a site and sees deficiencies, it will still penanlize (to whatever extent Google decides) that site.
My reasoning is that while Hubspot may do a good job of optimizing, "Google" is still the final word..??
You do raise a good point in that even if HubSpot is doing great at optimizing for page speed, for certain factors if it’s not perfectly to Google’s standards they will still penalize the site in their search results. In some cases this would be unavoidable if we want to provide the type of visitor experience that HubSpot strives to provide.
As mentioned there are certain HubSpot assets that need to have short cache times in order to properly execute their functions, so enabling a cache time of upwards of a year as Google suggests would be far more detrimental to the overall site experience compared to the benefits of the few points of page speed gained from heeding the suggestion.
Even with assets which can and are cached for longer, such as file manager images, we want to consider the counter point in which sometimes you don’t want things cached for too long, such when you replace a file manager image; if you set a cache time of a year, none of your customers would see the new file for that period of time.
Overall, in terms of caching (as well as other factors) HubSpot works to optimize for page speed to aid in SEO but will always weigh the overall visitor experience more heavily.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
"still penalize the site in their search results"
With all due respect, this is the only thing you said which matters.
I cannot implement Googles suggestions to improve my site speed and thus search performance, as a direct consequence of me not being able to access that functionality in Hubspot.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
the bigger issue with COS is with javascript taking time to load and not being cached than images or other page optimization aspect. It compalins for JS where not sure if there is any alternate way to deal with it.
How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess
@tinypulse Unfortunately not. I have been told that Hubspot does provide some form of caching but it is not enough to make google page speed test happy, and there really isn't a way to make this happen.
All you can really do is make sure that all of your files are making use of Hubspots built in CDN, All of you images are first cropped and size to fit their use space, then optimized for size (http://compressor.io), and understand that 1. google can't even pass it's own page speed test, and 2. SEO is important but Hubspot is about content marketing not search engine placement so punch out some useful content and don't sweat this to much.
If people can't access your website due to optimization problems then you have bigger problems than caching. Share one of your pages with me and I bet I can find several things other than caching that you could fix.