- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Google PageSpeed score is being negatively affected by HubSpot network requests
SOLVEMar 4, 2019 3:47 PM
Our Google PageSpeed score is being negatively affected by hubspot network requests.
Though these scripts are being loaded defered and async, they still are calculated into the overall page load times for Google's metric.
1.) Can anything be done to lighten these, or at least follow the guidelines Google is asking for for a better user experience?
2.) Can you put a cache policy onto the below static assets? Google suggests "Cache-Control: max-age=31536000". If you need to update these resources, why not use a url revision query?
3.) If your chatbot needs to download 6 fonts, at least use the font-display css value of "swap" so that it can use a system font until the fonts are fully loaded.
4.) It's time to get jQuery removed as a dependency. It's used for the chatbot, and the forms embed script callbacks as it relates to our site. It's added weight we don't need - modern websites and apps are not using it anymore in favor of what javascript can do natively now.
5.) Can you remove the default styling in the forms embed that is injected into the head of the document? If I am selecting "Unstyled Form", that's what I should actually get so I can style the forms in my own stylesheet. This small change would allow me not to have to go to the troulble of rebuilding all my forms using the Forms API.
6.) Because of the chatbot specifically, our site's Mobile pagespeed score is "Slow". There isn't a way to disable it for mobile, only a hack of using css to hide it which doesn't solve anything - still requests all the above offending resources.
Making these changes or suggesting solutions that work would be a step to helping out those of us concerned with site optimization as it pertains to SEO and overall performance for our users/customers.
Supporting backward compatibility for old browsers and/or hubspot users' legacy code is understandable but those of us utilizing current web standards shouldn't have to suffer. HubSpot is an expensive product to not be at the top of it's game when it comes to these concerns.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Feb 18, 2020 3:06 PM
You can put it anywhere. I would recommend putting HS lib scripts in the header.
Put it in the header-->
<!--[if lte IE 8]> <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js" async></script> <![endif]--> <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js" async></script>
Then you need to make sure the scroll function should always come after jQuery lib anywhere in your document.
jQuery(window).scroll(function() { if (!jQuery('.hbspt-form').length) { hbspt.forms.create({ portalId: "PORT_ID", formId: "YOUR_FORM_ID" }); } });
And you can easily make dynamic PORT_ID and FORM_ID. Shown below using PHP.
<script> jQuery(window).scroll(function() { if (!jQuery('.hbspt-form').length) { hbspt.forms.create({ portalId: "<?php echo $port_id; ?>", formId: "<?php echo $form_id; ?>" }); } }); </script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content