UTM Hidden fields on Hubspot Form not being populated
Hi,
We're using hubspot forms on our website (we use Webflow). The UTM customer properties have been added as hidden fields.
We tested the following use case: A user comes in through Google ads and on the landing page clicks on the CTA which redirects the user to another page with the contact form. Once a user submits the contact form, we see that these utm properties were not being populated with the parameters for new contacts (The original and latest traffic source fields are being populated with the UTMs). We also noticed that the UTMs are not being carried forward to the page with the contact form.
Through GTM, we've tried the following:
- Use the Persist Campaign Data template to store the UTM
parameters in a cookie. - Use a custom HTML tag that reads the UTM values from the cookie and sets them as values of the hidden fields before the form is submitted. This tag fires after the form loads on the contact page.
While the tags are firing, the utm fields are still not being populated which means that neither the utm custom properties on Hubspot aren't being populated.
The issue seems to be that since the form is located inside an iFrame, the GTM scripts won't be able to set or read values in the form fields inside the iFrame.
One suggestion has been to enable the Raw HTML form setting but this is something our website team wants to avoid because of styling issues.
Are there any potential workarounds for this case?
UTM Hidden fields on Hubspot Form not being populated
Not 100% sure I'm tracking, but the easiest thing for me to check would be for you to provide an example link. I see potential issues with trying to persist the UTM parameters through the button click, with the form being iframed, misconfigured hidden fields that should be capturing the UTM parameters, and with your cookie permissions, any one of which could make this not function correctly. Normally I don't like trying to persist parameters via UTM because they can create storage issues for all those reasons, and would recommend you fire those custom variables via javascript.
If you can't provide a link, can you confirm:
1) Are the correct UTM parameters you're looking for still firing on the page with the form submission, wherever that happens.
2) When you look at the submissions is anything coming through in the non-iframed form if you force through a utm parameter by manually adding it to the URL when you directly load the form?
3) When you go into dev mode and test the GTM scripts, are they correctly populating the values, whether or not they make it onto the form submission?
If my reply answered your question please mark it as a solution to make it easier for others to find.