hsform embed js loading twice?

I’m working on improving my lighthouse score and noticed that lighthouse is reporting the embed script loading twice on my page, even though in the code, it is there only once. Is there another script that is loading it, or is it showing twice for some other reason?

Hello @dmcknight how are you? Thank you for sharing this screenshot.

Currently looks like this is working as designed because the second script injection is actually inside an iframe. When embedding a HubSpot form externally as framed, the {{v2.js }}script is injected into the iframe because there is no communication between the iframe and the parent page. The iframe has its own window, and so it must have its own instance of the script available there to enable the form to behave as expected.

I hope this information helps.

Pam

Tjanks Pam. Is there a more optimal way to embed this form, as the lighthouse report is showing it as the single largest factor affecting the page score. For example, would it be better to use the iframe code instead of the js injection?

I’m finding exactly the same issue, so much code is not needed and then we get two h2 form javascripts loaded with all the additional js. The V2 JS is the main issue slowing down the website which isn’t great at all for page loading and Google lighthouse.