<?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: Passing UTM parameters to a visitor's cookie and writing them to hidden form fields in Lead Capture Tools</title>
    <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/507020#M6564</link>
    <description>&lt;P&gt;I would check out how to push the data after a form is submitted. HubSpot has documentation on how to go about this via their API. You will have more control if you embed the forms rather than use their form module but if you don't want to re-add all the forms you can use JS to detect the forms and submit the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Embedding forms -&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="noopener"&gt;https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;BR /&gt;Detecting hs forms and using global events -&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/global-form-events" target="_blank" rel="noopener"&gt;https://legacydocs.hubspot.com/global-form-events&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;Submitting via form - &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;https://legacydocs.hubspot.com/docs/methods/forms/submit_form&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hopefully this helps!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hubspot-community-signature.png" style="width: 928px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/49533iE7C552EF712EC0B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="hubspot-community-signature.png" alt="hubspot-community-signature.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;STRONG&gt;Joshua Todd |&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;CEO of Pixl Labs&lt;/EM&gt;&lt;BR /&gt;&lt;A href="https://pixllabs.io/" target="_blank" rel="noopener nofollow noreferrer"&gt;www.pixllabs.io&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2021 12:28:34 GMT</pubDate>
    <dc:creator>Pixl_Labs</dc:creator>
    <dc:date>2021-10-07T12:28:34Z</dc:date>
    <item>
      <title>Passing UTM parameters to a visitor's cookie and writing them to hidden form fields</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/502859#M6526</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to make our UTM values persist across multiple pages up until the point of conversion on a form, etc. As you know without persistent UTMs, we lose them if they don't convert on the first page they are directed to from tagged UTM URL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've come across some community articles, but find them a bit over my head. We use HubSpot CMS for our website and we don't use GTM. Maybe worth noting that we'd like to have tge UTM cookies valid for up to 90 days without overwriting the current UTM values stored in the UTM cookie.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any pointers to useful sources on the most efficient way to develop the JS and how to apply the JS to all website forms (120+ forms). It'd be cool if we could update all existing forms with hidden UTM fields to avoid throwing any errors when the code is deployed. Any idea on how to achieve that via Forms API or else?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone deployed this globally through their CMS and could share their knowledge? Is it as a simple as adding a JS file under the website's theme? any gotchas to watch out for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the help in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 17:01:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/502859#M6526</guid>
      <dc:creator>FadyAzmy</dc:creator>
      <dc:date>2021-09-29T17:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Passing UTM parameters to a visitor's cookie and writing them to hidden form fields</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/503723#M6538</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/243857"&gt;@FadyAzmy&lt;/a&gt;&amp;nbsp;I will add some top experts so they can share their thoughts,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/156228"&gt;@Pixl_Labs&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/76319"&gt;@DanielSanchez&lt;/a&gt;&amp;nbsp;any recommendations about&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/243857"&gt;@FadyAzmy&lt;/a&gt;&amp;nbsp;matter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you, Pam&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 22:33:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/503723#M6538</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2021-09-30T22:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Passing UTM parameters to a visitor's cookie and writing them to hidden form fields</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/503770#M6539</link>
      <description>&lt;P&gt;You could pass the query string from the URL into a local cookie on the users browser (assuming they have cookies enabled) then detect when the form is on the page and push the local cookie into the hidden form field. That way no matter how many pages they go to you can still attribute that query string to their contact record when they fill out the form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hubspot-community-signature.png" style="width: 928px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/49533iE7C552EF712EC0B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="hubspot-community-signature.png" alt="hubspot-community-signature.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;STRONG&gt;Joshua Todd |&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;CEO of Pixl Labs&lt;/EM&gt;&lt;BR /&gt;&lt;A href="https://pixllabs.io/" target="_blank" rel="noopener nofollow noreferrer"&gt;www.pixllabs.io&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 02:03:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/503770#M6539</guid>
      <dc:creator>Pixl_Labs</dc:creator>
      <dc:date>2021-10-01T02:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Passing UTM parameters to a visitor's cookie and writing them to hidden form fields</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/504929#M6544</link>
      <description>&lt;P&gt;Thanks so much Josh! do you have any helpful links that could tackle how to achieve this in HubSpot via Form APIs? Also, any idea how to push this on all existing forms rather than updating every single form manually with hidden fields? We're using HubSpot CMS for our website btw, could it be achieved by adding a JS file to the HubSpot theme in use for example? Any other gotchas to look for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 13:50:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/504929#M6544</guid>
      <dc:creator>FadyAzmy</dc:creator>
      <dc:date>2021-10-04T13:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Passing UTM parameters to a visitor's cookie and writing them to hidden form fields</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/507020#M6564</link>
      <description>&lt;P&gt;I would check out how to push the data after a form is submitted. HubSpot has documentation on how to go about this via their API. You will have more control if you embed the forms rather than use their form module but if you don't want to re-add all the forms you can use JS to detect the forms and submit the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Embedding forms -&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="noopener"&gt;https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;BR /&gt;Detecting hs forms and using global events -&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/global-form-events" target="_blank" rel="noopener"&gt;https://legacydocs.hubspot.com/global-form-events&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;Submitting via form - &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;https://legacydocs.hubspot.com/docs/methods/forms/submit_form&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hopefully this helps!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hubspot-community-signature.png" style="width: 928px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/49533iE7C552EF712EC0B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="hubspot-community-signature.png" alt="hubspot-community-signature.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;STRONG&gt;Joshua Todd |&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;CEO of Pixl Labs&lt;/EM&gt;&lt;BR /&gt;&lt;A href="https://pixllabs.io/" target="_blank" rel="noopener nofollow noreferrer"&gt;www.pixllabs.io&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 12:28:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/507020#M6564</guid>
      <dc:creator>Pixl_Labs</dc:creator>
      <dc:date>2021-10-07T12:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Passing UTM parameters to a visitor's cookie and writing them to hidden form fields</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/1252190#M13578</link>
      <description>&lt;P&gt;As you have alluded to, HubSpot does have some built-in UTM tracking capabilities, but they only capture UTMs if the user completes a form on the exact same page they initially land on. If they browse around your site (even just from homepage to contact page) before converting, the UTMs are lost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are your options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could certainly write custom JavaScript to capture the UTMs when visitors first arrive, store them in cookies with your 90-day expiration, and then populate hidden fields across all your forms. However, maintaining that script across 120+ forms and ensuring it works reliably as browsers update can be quite time-consuming. You'd also need to handle edge cases like cookie consent, different form types (Hubspot has New Forms and Legacy forms now), and making sure the script doesn't break existing functionality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your other option is to use tools like Attributer.io which can handle this automatically for you. It captures UTM parameters (plus other data like GCLID, FBCLID, and organic channel information) when visitors first land, stores them in the visitor browser, and writes them into hidden fields on your HubSpot forms at the moment of submission. It works with HubSpot CMS and doesn't require GTM. You can also set your desired cookie expiry time. The main advantage is that you can outsource all the development, testing, and ongoing maintenance rather than building and maintaining custom code across your entire site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Thu, 19 Feb 2026 00:43:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Passing-UTM-parameters-to-a-visitor-s-cookie-and-writing-them-to/m-p/1252190#M13578</guid>
      <dc:creator>azisbak</dc:creator>
      <dc:date>2026-02-19T00:43:52Z</dc:date>
    </item>
  </channel>
</rss>

