How to leverage browser caching for page speed? Hubspot won't allow modification of .htaccess

Occasional Contributor

Hubspot has posted that it does not support "server-side languages/modifications such as an htaccess file." Post found here: https://knowledge.hubspot.com/articles/kcs_article/cos-general/does-hubspot-support-dynamic-content-...

 

Can anyone offer support on how to address the common site speed issue of "leverage browser-caching?"

21 Replies 21
Esteemed Advisor

@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.

- Jonathan Sumner
Advisor

Content creation if great, but if your customers never see it because your page isn't optimized, the best content will be a waste if it's never seen.

Esteemed Advisor

@KeyWestScott,

 

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.

- Jonathan Sumner
Reply
0 Upvotes
Advisor

I'm sure you could.  And I, like many other people work hard to make sure that EVERY aspect works as fluidly and efficiently as possible.  But, as has been widely documented, in this " I want it NOW " society, a lag of even 1 second can have drop off rates exceeding 7%.  I for one, don't use AMP pages, since our site and destination is very visual, graphics are a very large part of our experience.  So, just looking to tweek out every ounce of speed I can.

Highlighted
New Contributor

Please check below url to make page performance better

https://global.transfast.com/uae

Reply
0 Upvotes
Occasional Contributor

Is accessing .htaaccess still an issue for browser caching with hubspot cos?  If so what are the alternates offered?

Reply
0 Upvotes
Occasional Contributor

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.

Occasional Contributor

I'd also be interested in a solution for this.

Reply
0 Upvotes
Advisor

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.

 

Scott

Community Manager

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.

 

Thank you,
Jenny


Did my post help answer your query? Help the Community by marking it as a solution
Advisor

@jennysowyrda Appreciate the update. 

 

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..??

 

Or am I completely off?

 

Thank  you.

 

Scott

Reply
0 Upvotes
Community Manager

Hi @KeyWestScott,

 

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.

 

Thanks,
Jenny


Did my post help answer your query? Help the Community by marking it as a solution
Occasional Contributor

"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.

 

It's not just caching, its GZIP Compression too

Occasional Contributor

My main issue is the performance hit of using Hubsoit. (see attached image).

Can Hubspot do anything to improve the expiry time on assets? hubspot.fw.png

Occasional Contributor

yes, 100% is the issue because other image/page optimization we can manage.

Occasional Contributor

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:

  1. Put far future expiries on some of all of the assets they include
  2. Push out these files via CDNs
  3. Combine JS files (HS is sending out 5 files that could be 3 or even two files)
  4. 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.
  5. Allow the HS script to not carry out render blocking and encourage developers to put HS relevant code into the footer of the pages.
  6. Remove the following redirect chains
Advisor

@jennysowyrda , can you address some of the issues that @dewolfe001 have mentioned above?

 

Thank you.

 

Scott

Reply
0 Upvotes
Community Manager

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-a...).

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 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.


Did my post help answer your query? Help the Community by marking it as a solution
New Contributor

@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 Smiley Very Happy:

 

  1. 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
  2. Enforce the most performant or recommended cache policies for static assets while implementing static asset revisioning policies when files hosted on Hubspot are updated

 

Screen Shot 2019-06-15 at 4.50.11 pm.pngExample of browser cache settings in Cloudflare

Community Superstar

Great suggestions, as long as the added HubSpot functionality comes with the clearest of warnings -- e.g.,


"Modifying these settings can break HubSpot functionality!" Smiley Happy

Hope that helps.

 

Best,
Frank

 

MFrankJohnson-dot-com-HubSpot-Community-banner-gif-v20190817

Reply
0 Upvotes
New Contributor

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.

Reply
0 Upvotes