We have implemented several optimizations to improve our page speed. However, we have encountered a significant issue with the "embed/v2.js" file associated with our forms. This script is being rendered multiple times—twice for a single form and increasingly more as additional forms are included on the page. This redundancy is severely impacting our Total Blocking Time (TBT) and overall page performance. We are seeking a solution to prevent the "embed/v2.js" file from being rendered multiple times, thereby reducing our TBT and enhancing the user experience.
Hey @vamshikonda yes, each form embed code includes v2.js so it will render this again. If you're extremeley concerned about page load I'd generally not recomend loading more than 1 form on your page anyway.
You'll definitely see v2.js load more than once if you're using HubSpot's form styling, as the form loads in an iframe and loads the v2.js script again. If you want to minimise external calls you should set your form as a raw html form. This should just make one call to v2.js to my knowledge (although this may have changed). However it will mean you will need to style the form yourself. You can also create your own form frontend and submit data via the forms api if you wish to use none of the HS scripts.
Tom Mahon Technical Consultant | Solutions Engineer | Community Champion Baskey Digitial
Thanks for the suggestion, @TomM2 . Converting the form into HTML format seems like an excellent idea; I’ve tried it and styled my form accordingly. Currently, I am using two forms on my page, so to overcome the impact of embed/v2.js, I have created a module that waits until the user scrolls the page, then dynamically loads and embeds a HubSpot form using the form's ID from the selected element. here we have added if condition to ensure that the HubSpot forms script is only loaded once and then used to embed a form.
so compared to earlier now after conveting the form into html format the rendering of v2.js has decreased multiple times but even now i am facing an issue where i am able to see 2 times this file getting loaded that to with a lot of render time.
Hey @vamshikonda looks like that second v2.js is being initiated by v2.js too, so you're not going to be able to stop that from loading without customising the v2.js code, which wouldn't be supported!
Tom Mahon Technical Consultant | Solutions Engineer | Community Champion Baskey Digitial
Hey @vamshikonda yes, each form embed code includes v2.js so it will render this again. If you're extremeley concerned about page load I'd generally not recomend loading more than 1 form on your page anyway.
You'll definitely see v2.js load more than once if you're using HubSpot's form styling, as the form loads in an iframe and loads the v2.js script again. If you want to minimise external calls you should set your form as a raw html form. This should just make one call to v2.js to my knowledge (although this may have changed). However it will mean you will need to style the form yourself. You can also create your own form frontend and submit data via the forms api if you wish to use none of the HS scripts.
Tom Mahon Technical Consultant | Solutions Engineer | Community Champion Baskey Digitial