Google PageSpeed score is being negatively affected by HubSpot network requests

Do you add this part to the head or body? And obviously, I am guessing you replace the portalId and formId with the forms that I have on my website. Thanks!

jQuery(window).scroll(function() {
 if (!jQuery('.hbspt-form').length) {
 hbspt.forms.create({
 portalId: "PORT_ID",
 formId: "YOUR_FORM_ID"
 });
 }
});