@cathalhopper Thanks for your thorough answer here. I am also running into issues when I try to set this up.
I am using Google Tag Manager to run this script:
document.querySelector('input[name=gclid]').value = "Hello, different input";
But it doesn’t pass the value “Hello, different input” into my hidden gclid field.
However, when I ran the same function in the console, it did pass the data into the hidden form field.
My question is, how do I get this to work?
My biggest assumption is that since I am using Google Tag Manager, the data is not passing to the hidden field because the parent window and the iframe are different websites. The parent page is my website, while the form embed is a HubSpot iframe. This would probably make the data impossible to pass over unless I can embed Google Tag Manager on the HubSpot iframe.
Do you know if it is possible to add the Google Tag Manager code to a specific form?
If not, what is the best way for me to go about getting the cookie to data into my hidden field?
edit: typo