<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Understanding Extra Scripts Loaded by HubSpot and Their Impact on Page Speed in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1082250#M41553</link>
    <description>&lt;P&gt;Thanks for sharing this resource,&amp;nbsp;@Anonymous&lt;/a&gt;! Could you please provide additional, specific context as to how this integration would help with&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/784007"&gt;@AKumar2718&lt;/a&gt;'s questions above?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-family: 'Lexend Deca', system-ui, Helvetica, Arial, sans-serif; font-style: normal; font-weight: 300; color: #3e3e3e; margin: 0px !important; padding: 0px !important;"&gt;&lt;EM&gt;Best,&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Lexend Deca', system-ui, Helvetica, Arial, sans-serif; font-style: normal; font-weight: 300; color: #3e3e3e; margin: 0px !important; padding: 0px !important;"&gt;Kennedy&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2024 17:45:11 GMT</pubDate>
    <dc:creator>kennedyp</dc:creator>
    <dc:date>2024-12-11T17:45:11Z</dc:date>
    <item>
      <title>Understanding Extra Scripts Loaded by HubSpot and Their Impact on Page Speed</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1073326#M41370</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I’ve been analyzing the performance of my website&amp;nbsp;hosted on HubSpot CMS, and I noticed a significant number of extra scripts being loaded on my pages by HubSpot. These scripts are impacting the &lt;STRONG&gt;page speed&lt;/STRONG&gt;, especially on mobile devices, as flagged by tools like Google PageSpeed Insights.&lt;/P&gt;&lt;P&gt;Upon inspecting the network requests, I found the following scripts being loaded (screenshot attached for reference):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;[&amp;nbsp;&lt;A class="" href="https://static.hsappstatic.net/hubspot-dlb/static-1.1019/bundle.production.js" target="_blank" rel="noopener"&gt;bundle.production.js&lt;/A&gt;, &lt;A class="" href="https://static.hsappstatic.net/conversations-visitor-ui/static-1.21290/bundles/visitor.js" target="_blank" rel="noopener"&gt;bundles/project.js, bundles/visitor.js,&amp;nbsp;bundles/app.js&amp;nbsp;&lt;/A&gt;]&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;While I understand that some of these scripts might be essential for HubSpot functionalities, I’m unsure about the purpose of each one. Specifically:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;What are these scripts used for?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Are all of them necessary for every page, or can some be conditionally loaded or removed entirely?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;How can I control which scripts are included in the page?&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I’m particularly concerned because these scripts:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add extra network requests, increasing load time.&lt;/LI&gt;&lt;LI&gt;Sometimes block the main thread, affecting Core Web Vitals metrics like &lt;STRONG&gt;Largest Contentful Paint (LCP)&lt;/STRONG&gt; and &lt;STRONG&gt;Time to Interactive (TTI)&lt;/STRONG&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;&lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;Is there a way to identify which scripts are critical and which are not?&lt;/LI&gt;&lt;LI&gt;Can unnecessary scripts be disabled for specific pages or site-wide?&lt;/LI&gt;&lt;LI&gt;What best practices should I follow to optimize my site performance while keeping essential HubSpot functionalities intact?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any guidance on managing these extra scripts or optimizing my page speed in HubSpot would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Attachments:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AKumar2718_0-1732217568363.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/132206i8398E9688F7CFFEC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AKumar2718_0-1732217568363.png" alt="AKumar2718_0-1732217568363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Abhishek Kumar&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 19:39:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1073326#M41370</guid>
      <dc:creator>AKumar2718</dc:creator>
      <dc:date>2024-11-21T19:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Extra Scripts Loaded by HubSpot and Their Impact on Page Speed</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1073660#M41374</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/784007"&gt;@AKumar2718&lt;/a&gt;&lt;/SPAN&gt; and welcome, we are delighted to have you here!&lt;BR /&gt;&lt;BR /&gt;Thanks for asking the Community!&lt;BR /&gt;&lt;BR /&gt;For information, here are some resources that might be of interest to you:&lt;BR /&gt;&lt;BR /&gt;- &lt;A href="https://knowledge.hubspot.com/account/how-does-hubspot-track-visitors" target="_blank"&gt;Track visitors in HubSpot&lt;/A&gt;&lt;BR /&gt;- &lt;A href="https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code" target="_blank"&gt;Install the HubSpot tracking code&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I'd like to share the solution from &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/104061"&gt;@sandeep4467&lt;/a&gt;&lt;/SPAN&gt; on this post "&lt;A href="https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Google-PageSpeed-score-is-being-negatively-affected-by-HubSpot/m-p/256954" target="_blank"&gt;Google PageSpeed score is being negatively affected by HubSpot network requests&lt;/A&gt;" that might help you!&lt;BR /&gt;&lt;BR /&gt;Also, I'd love to put you in touch with some of our Top Experts: Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811"&gt;@zach_threadint&lt;/a&gt;&lt;/SPAN&gt; and &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt; do you have other suggestions to help &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/784007"&gt;@AKumar2718&lt;/a&gt;&lt;/SPAN&gt;, please?&lt;BR /&gt;&lt;BR /&gt;Thanks so much and have a lovely day!&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Bérangère&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 10:58:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1073660#M41374</guid>
      <dc:creator>BérangèreL</dc:creator>
      <dc:date>2024-11-22T10:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Extra Scripts Loaded by HubSpot and Their Impact on Page Speed</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1074507#M41389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/784007"&gt;@AKumar2718&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The four scripts listed (bundle.production.js, bundles/project.js, bundles/visitor.js, bundles/app.js) are HubSpot's default scripts, which are automatically added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I know, they're loaded asynchronously, which doesn't affect the page speed. Would you mind sharing your pagespeed results URL here?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 08:22:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1074507#M41389</guid>
      <dc:creator>GiantFocal</dc:creator>
      <dc:date>2024-11-25T08:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Extra Scripts Loaded by HubSpot and Their Impact on Page Speed</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1082250#M41553</link>
      <description>&lt;P&gt;Thanks for sharing this resource,&amp;nbsp;@Anonymous&lt;/a&gt;! Could you please provide additional, specific context as to how this integration would help with&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/784007"&gt;@AKumar2718&lt;/a&gt;'s questions above?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-family: 'Lexend Deca', system-ui, Helvetica, Arial, sans-serif; font-style: normal; font-weight: 300; color: #3e3e3e; margin: 0px !important; padding: 0px !important;"&gt;&lt;EM&gt;Best,&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Lexend Deca', system-ui, Helvetica, Arial, sans-serif; font-style: normal; font-weight: 300; color: #3e3e3e; margin: 0px !important; padding: 0px !important;"&gt;Kennedy&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 17:45:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1082250#M41553</guid>
      <dc:creator>kennedyp</dc:creator>
      <dc:date>2024-12-11T17:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Extra Scripts Loaded by HubSpot and Their Impact on Page Speed</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1082255#M41554</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hey Everyone,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I wanted to share the best solution I’ve found for resolving this issue. The root cause is the &lt;STRONG&gt;HubSpot main portal script&lt;/STRONG&gt;, which loads multiple scripts initially, causing performance concerns. My approach involves &lt;STRONG&gt;removing the portal script from the initial load&lt;/STRONG&gt; and instead deferring its loading. Here’s the code I’ve used—it might help you if you’re facing a similar problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Updated base.html&lt;/STRONG&gt;:&lt;/H3&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&amp;nbsp; {% set custom_footer_includes = standard_footer_includes|split('\n') %}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; {% for line in custom_footer_includes %}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {% unless line is string_containing '{portal-id}.js' %}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {{line}}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {% endunless %}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; {% endfor %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;JavaScript Code to Load the Portal Script Later&lt;/STRONG&gt;:&lt;/H3&gt;&lt;P&gt;document.addEventListener("DOMContentLoaded", function () {&lt;BR /&gt;let e = document.querySelector('script[src="/_hcms/forms/v2.js"]');&lt;BR /&gt;if (e) {&lt;BR /&gt;e.setAttribute("defer", "defer");&lt;BR /&gt;} else {&lt;BR /&gt;console.error("Script not found.");&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;window.addEventListener("load", () =&amp;gt; {&lt;BR /&gt;setTimeout(() =&amp;gt; {&lt;BR /&gt;let e = document.createElement("script");&lt;BR /&gt;e.src="/hs/scriptloader/{portal-id}.js";&lt;BR /&gt;e.async = true;&lt;BR /&gt;document.body.appendChild(e);&lt;BR /&gt;}, 11000); // Load after 11 seconds&lt;BR /&gt;});&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Request to HubSpot Team&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;If anyone from HubSpot is reading this, could you please confirm whether deferring the portal script loading as described above will impact &lt;STRONG&gt;HubSpot tracking or analytics functionality&lt;/STRONG&gt;? Your input would be incredibly helpful to ensure this solution does not cause unintended consequences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this solution helps others facing similar issues. Looking forward to your feedback!&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Abhishek kumar&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 17:59:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Understanding-Extra-Scripts-Loaded-by-HubSpot-and-Their-Impact/m-p/1082255#M41554</guid>
      <dc:creator>AKumar2718</dc:creator>
      <dc:date>2024-12-11T17:59:41Z</dc:date>
    </item>
  </channel>
</rss>

