Lead Capture Tools

zangerine1
Member | Platinum Partner
Member | Platinum Partner

How to pass utm parameters from a cookie into hidden fields?

Hi,

 

I have been trying to find the best solution for passing data stored in a cookie into hidden form fields via GTM.

 

Here's an example of how I want it to work:

  • A user clicks on a paid advertisement and visits my site. The user has a utm_source value of facebook.
  • The utm_source value is stored in a cookie. 
  • The user navigates around my website and submits a form.
  • On my form, there is a hidden field named "utm_source".
  • When the user submits a form, I want the pass the value from the cookie into the hidden form field.

I was able to do this for a while by setting the field attribute "value", but recently HubSpot has not been recognizing my GTM script. 

 

Anyone know how to pass the utm data from a cookie into a hidden field? Would love some help on this!

0 Upvotes
2 Replies 2
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

How to pass utm parameters from a cookie into hidden fields?

Hi @zangerine1,

 

Does this help?

[How-To] Pass Values into Hidden Fields from Google Tag Manager

 

Best regards!

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

Chris_Matt
Member

How to pass utm parameters from a cookie into hidden fields?

Thanks for the guide. Unfortunately, this solution didn't work for me. They form listener never recognizes that the HubSpot form has loaded. 

0 Upvotes