<?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: Defer Scripts from Hubspot in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680376#M55837</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/283576"&gt;@LBernardo86&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you please provide a preview link?&lt;/P&gt;
&lt;P&gt;How do you embed your scripts? in a "rich-text" or custom modules?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Defering the v2.js(form script) is - as far as I know - only possible with a custom solution and even then it is not guaranteed to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many ways how to create custom modules. Here are two&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. create a custom module with just form function - no real benefit in terms of performance&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anton_0-1660552248200.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/72855i8826A3513F73C5A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anton_0-1660552248200.png" alt="Anton_0-1660552248200.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. create a custom module and modify an embed code. It should look like this&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anton_1-1660552671617.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/72856iF0DA9D1D083AAAED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anton_1-1660552671617.png" alt="Anton_1-1660552671617.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% require_head, defer=True %} {# will put the script to head-tag. Must be loaded before the second script! #}
&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;
{% end_require_head %}

&amp;lt;script&amp;gt;
  hbspt.forms.create({
    region: "na1",
    portalId: "{{ hub_id }}", 
    formId: "{{ module.form_select.form_id }}"
  });
&amp;lt;/script&amp;gt;
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best part about this is - you can almost completly modify the embed code to your needs with &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="noopener"&gt;this documentation&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2022 09:02:25 GMT</pubDate>
    <dc:creator>Anton</dc:creator>
    <dc:date>2022-08-15T09:02:25Z</dc:date>
    <item>
      <title>Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/679661#M55791</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to defer these scripts from Hubspot? They seem to be slowing down the LCP by a lot. These scripts are from embedded youtube videos and the comment forms.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LBernardo86_0-1660298249737.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/72739iB494D25E11AA83B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LBernardo86_0-1660298249737.png" alt="LBernardo86_0-1660298249737.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 09:57:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/679661#M55791</guid>
      <dc:creator>LBernardo86</dc:creator>
      <dc:date>2022-08-12T09:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680013#M55821</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/283576"&gt;@LBernardo86&lt;/a&gt;&amp;nbsp;thanks for reaching out. I want to make sure you saw this &lt;A href="https://community.hubspot.com/t5/CMS-Development/Google-PageSpeed-Insights-LCP-optimization-for-mobile/m-p/399740#M20534" target="_blank" rel="noopener"&gt;post&lt;/A&gt; and this resource —&lt;A href="https://developers.hubspot.com/docs/cms/guides/speed" target="_blank" rel="noopener nofollow noreferrer"&gt;optimizing your site for performance&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/78983"&gt;@Indra&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt;&amp;nbsp;do you have any thought on how&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/283576"&gt;@LBernardo86&lt;/a&gt;&amp;nbsp;can approach this challenge?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you! — Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 20:53:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680013#M55821</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2022-08-12T20:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680304#M55828</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;, haven't had the chance to look at the links yet. Will check them out and see if they work.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 02:02:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680304#M55828</guid>
      <dc:creator>LBernardo86</dc:creator>
      <dc:date>2022-08-15T02:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680376#M55837</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/283576"&gt;@LBernardo86&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you please provide a preview link?&lt;/P&gt;
&lt;P&gt;How do you embed your scripts? in a "rich-text" or custom modules?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Defering the v2.js(form script) is - as far as I know - only possible with a custom solution and even then it is not guaranteed to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many ways how to create custom modules. Here are two&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. create a custom module with just form function - no real benefit in terms of performance&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anton_0-1660552248200.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/72855i8826A3513F73C5A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anton_0-1660552248200.png" alt="Anton_0-1660552248200.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. create a custom module and modify an embed code. It should look like this&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anton_1-1660552671617.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/72856iF0DA9D1D083AAAED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anton_1-1660552671617.png" alt="Anton_1-1660552671617.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% require_head, defer=True %} {# will put the script to head-tag. Must be loaded before the second script! #}
&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;
{% end_require_head %}

&amp;lt;script&amp;gt;
  hbspt.forms.create({
    region: "na1",
    portalId: "{{ hub_id }}", 
    formId: "{{ module.form_select.form_id }}"
  });
&amp;lt;/script&amp;gt;
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best part about this is - you can almost completly modify the embed code to your needs with &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="noopener"&gt;this documentation&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 09:02:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/680376#M55837</guid>
      <dc:creator>Anton</dc:creator>
      <dc:date>2022-08-15T09:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/681907#M55976</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt;&amp;nbsp;I am using the drag and drop modules from hubspot. I did find a way to manually call the comment section. The only thing I am missing is the reply to comment functionality. I cannot find any posts here regarding that. could you point me to where I can find it?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 06:10:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/681907#M55976</guid>
      <dc:creator>LBernardo86</dc:creator>
      <dc:date>2022-08-18T06:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/681910#M55977</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/283576"&gt;@LBernardo86&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;great!&lt;/P&gt;
&lt;P&gt;Do I get it right that you'd like to have the comment function outside on a LCP/outside the blog?&lt;/P&gt;
&lt;P&gt;If so you'll need to build/integrate something by yourself since HubSpot doesn't support comments outside of the blog by default.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few easier 3rd party tools for this approach would be&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;nbsp;&lt;A href="https://viafoura.com/audience-engagement/#engage" target="_blank" rel="noopener"&gt;Viafoura&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://disqus.com" target="_blank" rel="noopener"&gt;Disqus&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Haven't really worked with them but it should be as easy as "copy/paste" some lines of code somewhere in HubSpot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're talking about a blog - comments working only in post templates. This is the only (default) module you need&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% module "blog_comments" path="@hubspot/blog_comments" %}&lt;/LI-CODE&gt;
&lt;P&gt;everything else (comment form ...) should be loaded automatically.&lt;/P&gt;
&lt;P&gt;Here's a screen of comment settings from a brand new blog and only changed the depth to 3&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anton_0-1660804753315.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/73070i3C8F6A0721C59ED8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anton_0-1660804753315.png" alt="Anton_0-1660804753315.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hope this helps,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 06:40:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/681910#M55977</guid>
      <dc:creator>Anton</dc:creator>
      <dc:date>2022-08-18T06:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Defer Scripts from Hubspot</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/683303#M56114</link>
      <description>&lt;P&gt;Hi all, I was able to find a workaround regarding the forms in HubSpot. The next thing I wanted to see was where these facebook scripts are coming from? I couldn't find them anywhere where I put my scripts so I was wondering maybe they are injected from somewhere else?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LBernardo86_0-1661158589526.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/73305i4AE2B094BD2BD89C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LBernardo86_0-1661158589526.png" alt="LBernardo86_0-1661158589526.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 08:56:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Defer-Scripts-from-Hubspot/m-p/683303#M56114</guid>
      <dc:creator>LBernardo86</dc:creator>
      <dc:date>2022-08-22T08:56:40Z</dc:date>
    </item>
  </channel>
</rss>

