HS Cookies banner reduce website performance

Hello everyone,

I encountered the issue that the cookies banner is reducing website performance greatly. It holds the initial render for 10s on mobile. I don’t know what I can do about it. This is the lighthouse report. of live website, I’m currently working on.

Another thing I’m struggling with is the “No CSRF Cookie found.” console error on every single HubSpot Video module usage. Am I missing some settings I don’t know about? I even made sure that videos and images were hosted on the same domain as the main website.

I’ve also noticed that most of the issues with the performance come from 3rd party hsappstatic bundles etc. Is there anything I could do about it?

Hi @dcr while the cookie banner has an impact, there is very little you can do to resolve it (other than finding a third-party solution with lesser impact). There is however a lot of other opportunities to improve your code where you could focus your efforts.

When it comes to performance, there is always a balance between optimizing content for user experience and optimizing performance. Any website page with that many videos will be slow to load.

If you can move some of the videos to other pages to reduce the content on the home page that could be a better balance of the two.

No CSRF Cookie found is related to user login - and looking at the console errors this looks to have something to do with having the videos in an iframe rather than directly in your modules.

Hope this helps get you headed in the right direction!

Hey, thanks for the reply.
When it comes to the videos, I cannot move them to the other pages because that’s the client’s request. To improve performance those videos are lazy load.

Regarding No CSRF Cookie, I found I’m using a built-in video module offered by HubSpot CMS (under the @hubspot folder). The thing is this video module is an iframe out of the box.

you’re welcome @dcr!

Completely understand not being able to move the videos to another page, sometimes content is the most important aspect for the page.

I would recommend building a custom video module that doesn’t rely on iframe, this would give you more control and help you to further improve performance.

I know it’s been a few months, but you can look into other cookie banner solutions that work just as good with Hubspot, and are meant to be lightweight as to not impact web performance. Looked into solutions called consent management platforms (CMPs). You can start with free CMP solutions first too. Hope this helps!