<?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: How to embed  javascript in form in Lead Capture Tools</title>
    <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330977#M3918</link>
    <description>So then how does original source data work? There must be a cookie that stores this data. I have ran my browser on incognito mode and used my HubSpot tracking url to land on my landing page. I then redirected to another page, but once I went to another form in our site, it extracted the correct original source.&lt;BR /&gt;&lt;BR /&gt;I bring this up because it’s storing this data in a cookie, but HubSpot documentation isn’t clear on this/ is not telling us what’s really going on. Unless I’m reading this wrong...&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://knowledge.hubspot.com/reports/what-do-the-properties-original-source-data-1-and-2-mean" target="_blank"&gt;https://knowledge.hubspot.com/reports/what-do-the-properties-original-source-data-1-and-2-mean&lt;/A&gt;</description>
    <pubDate>Sat, 11 Apr 2020 02:01:03 GMT</pubDate>
    <dc:creator>mmetros</dc:creator>
    <dc:date>2020-04-11T02:01:03Z</dc:date>
    <item>
      <title>How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330951#M3903</link>
      <description>&lt;P&gt;When a form is submitted I Want to retrieve certain values from cookies on their browser and store it in the hidden fields. How can we do this?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 23:05:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330951#M3903</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-10T23:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330957#M3904</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127085"&gt;@mmetros&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll want to use the form embed code instead of the form module and include in the embed an onFormSubmit fuction with the custom code you want to run.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_self"&gt;https://developers.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;hbspt.forms.create({
      portalId: '',
      formId: '',
      onFormSubmit: function($form) {
        // YOUR SCRIPT HERE
      } 
}); &lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Apr 2020 00:22:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330957#M3904</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T00:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330960#M3905</link>
      <description>&lt;P&gt;We are currently hosting the forms in WordPress's and using the HubSpot Form shortcode to embed the HubSpot Form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we extract the Cookies in this case?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 00:35:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330960#M3905</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T00:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330963#M3906</link>
      <description>&lt;P&gt;You can still use the embed code. Many themes use a page builder that includes a HTML / Script module you can use to place script into your post/page. If your theme doesn't you can use a &lt;A href="https://wordpress.org/plugins/simple-embed-code/" target="_self"&gt;code embed&lt;/A&gt; plugin to create short codes for the embeds.&lt;BR /&gt;&lt;BR /&gt;Or since you're just grabbing information that is already available before submit you could just add a script to act on the form once the page has finished loading :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;$(window).load(function(){
    $('input[value="checkbox_1"]').prop('checked', true).change();
    $('input[name="firstname"]').val('Brian').change();     
});&lt;/PRE&gt;
&lt;P&gt;FYI these advanced form options are only available for forms on a&amp;nbsp;&lt;SPAN&gt;paid Basic, Professional, or Enterprise marketing subscription.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 00:49:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330963#M3906</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T00:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330964#M3907</link>
      <description>So right now in the global footer we are storing UTMs into a cookie.&lt;BR /&gt;&lt;BR /&gt;If this is at the footer, then we need to run the cookie extraction code when the form submits, correct? Otherwise if it runs, then there won’t be anything for it extract in the cookie, because the cookie setting script has not fired yet.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Overall, I see what you’re saying. From what I understand, I have to:&lt;BR /&gt;&lt;BR /&gt;Somehow turn the embed script into an embed code, correct?&lt;BR /&gt;&lt;BR /&gt;Any chance you know why this works?</description>
      <pubDate>Sat, 11 Apr 2020 00:54:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330964#M3907</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T00:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330965#M3908</link>
      <description>&lt;P&gt;Unless your cookie setting script is also inside a $(window).load function then it should run before the cookie extraction script does. But if the setting script&amp;nbsp;&lt;EM&gt;is&amp;nbsp;&lt;/EM&gt;in a $(window).load function, then yes, you will definitely need to use the form embed with the onFormSubmit function which tells the form 'run this script when the form is submitted, but before sending the entry to Hubspot'.&lt;BR /&gt;&lt;BR /&gt;I'm not really sure what you mean by&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;turn the embed script into an embed code&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;as script&amp;nbsp;&lt;EM&gt;is&amp;nbsp;&lt;/EM&gt;code?&lt;BR /&gt;&lt;BR /&gt;Here's a Hubspot article showing you where to get your form's embed code:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://knowledge.hubspot.com/forms/how-can-i-share-a-hubspot-form-if-im-using-an-external-site" target="_blank"&gt;https://knowledge.hubspot.com/forms/how-can-i-share-a-hubspot-form-if-im-using-an-external-site&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And this documentation shows you how to customize that embed code (to use the onFormSubmit function):&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank"&gt;https://developers.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Then you just need to add it to your Wordpress page using either a plugin or a page builder module.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 01:09:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330965#M3908</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T01:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330967#M3909</link>
      <description>We are using Google tag manager.&lt;BR /&gt;&lt;BR /&gt;Do you think I could run the script there? We always have the same hidden form fields to catch the 5 main UTM parameters.</description>
      <pubDate>Sat, 11 Apr 2020 01:14:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330967#M3909</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T01:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330968#M3910</link>
      <description>&lt;P&gt;Certainly. Just make to sure to use the Window Loaded trigger.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 01:16:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330968#M3910</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T01:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330969#M3911</link>
      <description>Perfect and then should I fire the cookie setting script in the page view event?</description>
      <pubDate>Sat, 11 Apr 2020 01:18:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330969#M3911</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T01:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330970#M3912</link>
      <description>&lt;P&gt;Yes, Page View or DOM Ready should work for the setting script as they both fire before Window Load.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 01:23:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330970#M3912</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T01:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330971#M3913</link>
      <description>Okay, here is what I’m thinking:&lt;BR /&gt;&lt;BR /&gt;1. Cookie setting code to be run in DOM event through GTM.&lt;BR /&gt;2. Cookie retrieving code to be run in window.load event&lt;BR /&gt;3. Regular embed short code in WordPress&lt;BR /&gt;&lt;BR /&gt;Do you foresee any issues here?</description>
      <pubDate>Sat, 11 Apr 2020 01:30:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330971#M3913</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T01:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330972#M3914</link>
      <description>&lt;P&gt;Should work&amp;nbsp;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 01:31:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330972#M3914</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T01:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330973#M3915</link>
      <description>Okay, I’ll keep you posted!&lt;BR /&gt;&lt;BR /&gt;One other question - does HubSpot cookie utm Parameters? I am trying to track the efficacy of my google ads campaigns and I’m afraid it won’t capture all my campaigns.&lt;BR /&gt;&lt;BR /&gt;It seems like it only catches first conversion campaigns for prospects. That’s the only reason why I’m taking this approach of storing utms into cookies and inputting them directly on the prospect.</description>
      <pubDate>Sat, 11 Apr 2020 01:37:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330973#M3915</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T01:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330975#M3917</link>
      <description>&lt;P&gt;It doesn't look like they do.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://knowledge.hubspot.com/reports/what-cookies-does-hubspot-set-in-a-visitor-s-browser" target="_blank"&gt;https://knowledge.hubspot.com/reports/what-cookies-does-hubspot-set-in-a-visitor-s-browser&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You could always use Tracking Links in your campaigns to ensure Hubspot is gathering all the correct utm information.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://knowledge.hubspot.com/settings/how-do-i-create-a-tracking-url" target="_blank"&gt;https://knowledge.hubspot.com/settings/how-do-i-create-a-tracking-url&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://knowledge.hubspot.com/reports/analyze-your-site-traffic-with-the-traffic-analytics-tool#analyze-your-traffic-using-the-utm-parameters-tab" target="_blank"&gt;https://knowledge.hubspot.com/reports/analyze-your-site-traffic-with-the-traffic-analytics-tool#analyze-your-traffic-using-the-utm-parameters-tab&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2020 01:52:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330975#M3917</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-04-11T01:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed  javascript in form</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330977#M3918</link>
      <description>So then how does original source data work? There must be a cookie that stores this data. I have ran my browser on incognito mode and used my HubSpot tracking url to land on my landing page. I then redirected to another page, but once I went to another form in our site, it extracted the correct original source.&lt;BR /&gt;&lt;BR /&gt;I bring this up because it’s storing this data in a cookie, but HubSpot documentation isn’t clear on this/ is not telling us what’s really going on. Unless I’m reading this wrong...&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://knowledge.hubspot.com/reports/what-do-the-properties-original-source-data-1-and-2-mean" target="_blank"&gt;https://knowledge.hubspot.com/reports/what-do-the-properties-original-source-data-1-and-2-mean&lt;/A&gt;</description>
      <pubDate>Sat, 11 Apr 2020 02:01:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/How-to-embed-javascript-in-form/m-p/330977#M3918</guid>
      <dc:creator>mmetros</dc:creator>
      <dc:date>2020-04-11T02:01:03Z</dc:date>
    </item>
  </channel>
</rss>

