<?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: Setting field ID in hidden field for GCLID in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576289#M27386</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330756"&gt;@elektramurphy&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your explanation. Please try the following code this will update the hidden value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$(document).ready(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;setTimeout(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Update the value */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;updatedvalue = "elektramurphy";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$('input[type=hidden]').val(&lt;/SPAN&gt;&lt;STRONG&gt;updatedvalue&lt;/STRONG&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Check that value is updated by printing this on console */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value = $('input[type=hidden]').val();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(value);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;},1000);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&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="webdew_0-1644920435430.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/59551i24DE569F8B8EE6B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="webdew_0-1644920435430.png" alt="webdew_0-1644920435430.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;&lt;SPAN&gt;I am setting up the value on page load you can also set the value on any event trigger.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;*Note that&lt;/STRONG&gt;&lt;SPAN&gt; I am assuming that there is only one hidden field in the form. If there are multiple then please let me know we will give you the code for that as well.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If we were able to answer your query, kindly help the community by marking it as a solution.&lt;BR /&gt;Thanks and Regards.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2022 10:21:08 GMT</pubDate>
    <dc:creator>webdew</dc:creator>
    <dc:date>2022-02-15T10:21:08Z</dc:date>
    <item>
      <title>Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/575538#M27371</link>
      <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've setup a field with the name 'gclid_field' as part of the setup for Google's offline conversion import (&lt;A href="https://support.google.com/google-ads/answer/7012522?hl=en" target="_blank" rel="noopener"&gt;setup doc here&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first step says:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You will need to modify each form submission page to add a hidden form field for the GCLID. This is how the GCLID will be passed to your backend system.&lt;BR /&gt;Here's an example form with a hidden field for the GCLID. If you are able to modify your form code directly, you will simply insert the highlighted&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;input&amp;gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tag in between your&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;form&amp;gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tags. In some cases, your lead management systems administrator may need to generate this form code for you.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;   &amp;lt;form action="" name="myForm"&amp;gt;
         Name: &amp;lt;input type="text" name="name"&amp;gt;
         &amp;lt;input type="hidden" id="gclid_field" name="gclid_field" value=""&amp;gt;
         &amp;lt;input type="submit" value="Submit Form" name="btnSubmit"&amp;gt;
   &amp;lt;/form&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that Hubspot does not seem to allow me to modify the field ID. Also, on inspect because the field is hidden I can't seem to find what ID Hubspot is automatically assinging it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've read through a lot of community posts and talked to support but cannot find a solution. Has anyone come across the best way to modify a field ID or know how to find the individual field ID?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 09:46:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/575538#M27371</guid>
      <dc:creator>elektramurphy</dc:creator>
      <dc:date>2022-02-14T09:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576241#M27384</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330756"&gt;@elektramurphy&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to get the exact value set in hidden input fields then you have to use jquery code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;here is my example I have one hidden field named "Company " with the default value "webdew".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;My Demo form&lt;/STRONG&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="webdew_0-1644913801073.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/59546iE8DD62A9EB9852D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="webdew_0-1644913801073.png" alt="webdew_0-1644913801073.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And I have get and print this value in console using following code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;script&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$(document).ready(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;SPAN&gt;setTimeout(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;SPAN&gt;value = $('input[type=hidden]').val();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;SPAN&gt;console.log(value);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;SPAN&gt;},1000);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Output:&lt;/SPAN&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="webdew_1-1644913826025.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/59547iE2BD3E230EEBD2C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="webdew_1-1644913826025.png" alt="webdew_1-1644913826025.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If we were able to answer your query, kindly help the community by marking it as a solution.&lt;BR /&gt;Thanks and Regards.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 08:31:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576241#M27384</guid>
      <dc:creator>webdew</dc:creator>
      <dc:date>2022-02-15T08:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576279#M27385</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/131510"&gt;@webdew&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for taking the time to look at my issue. This returns the value, however what i'm looking for is to actually update the field ID. It's currently returning the id 'google_ads_hidden-lable' but I am unsure of whether this is unique or this ID is being applied to several other fields so I am trying to update it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully my further explanation helps. If you have any ideas please send them my way, if not thank you for the help!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 10:01:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576279#M27385</guid>
      <dc:creator>elektramurphy</dc:creator>
      <dc:date>2022-02-15T10:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576289#M27386</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330756"&gt;@elektramurphy&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your explanation. Please try the following code this will update the hidden value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$(document).ready(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;setTimeout(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Update the value */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;updatedvalue = "elektramurphy";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$('input[type=hidden]').val(&lt;/SPAN&gt;&lt;STRONG&gt;updatedvalue&lt;/STRONG&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Check that value is updated by printing this on console */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value = $('input[type=hidden]').val();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(value);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;},1000);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&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="webdew_0-1644920435430.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/59551i24DE569F8B8EE6B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="webdew_0-1644920435430.png" alt="webdew_0-1644920435430.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;&lt;SPAN&gt;I am setting up the value on page load you can also set the value on any event trigger.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;*Note that&lt;/STRONG&gt;&lt;SPAN&gt; I am assuming that there is only one hidden field in the form. If there are multiple then please let me know we will give you the code for that as well.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If we were able to answer your query, kindly help the community by marking it as a solution.&lt;BR /&gt;Thanks and Regards.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 10:21:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576289#M27386</guid>
      <dc:creator>webdew</dc:creator>
      <dc:date>2022-02-15T10:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576318#M27387</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/131510"&gt;@webdew&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, this is for multiple forms not just one! Sorry, such a pain coming back to you with different issues. Does the code above also reflect an update in the ID?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate you taking the time to help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 10:49:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576318#M27387</guid>
      <dc:creator>elektramurphy</dc:creator>
      <dc:date>2022-02-15T10:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576467#M27388</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330756"&gt;@elektramurphy&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Yes the above code update the id as well but as you mention that you have &lt;/STRONG&gt;&lt;STRONG&gt;name="gclid_field" &lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;in the form field So you can use the following code and this will 100% update your id either you have multiple hidden fields or a single one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;script&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$(document).ready(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;setTimeout(function(){&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;updatedvalue = "&lt;/SPAN&gt;&lt;STRONG&gt;your_unique_id&lt;/STRONG&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$("input[&lt;/SPAN&gt;&lt;STRONG&gt;name=gclid_field&lt;/STRONG&gt;&lt;SPAN&gt;]").val();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value = $('input[&lt;/SPAN&gt;&lt;STRONG&gt;name=gclid_field&lt;/STRONG&gt;&lt;SPAN&gt;]').val();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(value);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;},1000);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;/script&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If we were able to answer your query, kindly help the community by marking it as a solution.&lt;BR /&gt;Thanks and Regards.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 14:12:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/576467#M27388</guid>
      <dc:creator>webdew</dc:creator>
      <dc:date>2022-02-15T14:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field ID in hidden field for GCLID</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/764131#M33128</link>
      <description>&lt;P&gt;I figured out how to store and capture the GCLID using the code below in Tagmanager for contacts in Hubspot. However, I still need code to do the same thing for the MSCLKID (Microsoft Click ID for Microsoft Ads). If you know how to fix this problem, please paste the code for tagmanager in the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need help with store the GCLID, paste the code below into tagmanager using all pages as the trigger.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;function getParam(p) {&lt;BR /&gt;var match = RegExp('[?&amp;amp;]' + p + '=([^&amp;amp;]*)').exec(window.location.search);&lt;BR /&gt;return match &amp;amp;&amp;amp; decodeURIComponent(match[1].replace(/\+/g, ' '));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function getExpiryRecord(value) {&lt;BR /&gt;var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90 day expiry in milliseconds&lt;/P&gt;&lt;P&gt;var expiryDate = new Date().getTime() + expiryPeriod;&lt;BR /&gt;return {&lt;BR /&gt;value: value,&lt;BR /&gt;expiryDate: expiryDate&lt;BR /&gt;};&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function addGclid() {&lt;BR /&gt;var gclidParam = getParam('gclid');&lt;BR /&gt;var gclidFormFields = ['gclid_field', 'foobar']; // all possible gclid form field ids here&lt;BR /&gt;var gclidRecord = null;&lt;BR /&gt;var currGclidFormField;&lt;/P&gt;&lt;P&gt;var gclsrcParam = getParam('gclsrc');&lt;BR /&gt;var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf('aw') !== -1;&lt;/P&gt;&lt;P&gt;gclidFormFields.forEach(function (field) {&lt;BR /&gt;if (document.getElementById(field)) {&lt;BR /&gt;currGclidFormField = document.getElementById(field);&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;if (gclidParam &amp;amp;&amp;amp; isGclsrcValid) {&lt;BR /&gt;gclidRecord = getExpiryRecord(gclidParam);&lt;BR /&gt;localStorage.setItem('gclid', JSON.stringify(gclidRecord));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var gclid = gclidRecord || JSON.parse(localStorage.getItem('gclid'));&lt;BR /&gt;var isGclidValid = gclid &amp;amp;&amp;amp; new Date().getTime() &amp;lt; gclid.expiryDate;&lt;/P&gt;&lt;P&gt;if (currGclidFormField &amp;amp;&amp;amp; isGclidValid) {&lt;BR /&gt;currGclidFormField.value = gclid.value;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;window.addEventListener('load', addGclid);&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will also have to create a property in Hubspot called gclid and change it to hidden on your forms.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2023 05:37:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Setting-field-ID-in-hidden-field-for-GCLID/m-p/764131#M33128</guid>
      <dc:creator>Danielle1</dc:creator>
      <dc:date>2023-03-04T05:37:54Z</dc:date>
    </item>
  </channel>
</rss>

