Auto-Populate UTM Properties on Embedded Forms

Hi there,

Is there any way to auto-populate utm_* properties when using embedded forms, i.e. capture utm_* params from the parent page when a HubSpot form has been injected into a page via an iframe (using something similar to the code below)?

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script><script>hbspt.forms.create({region: "na1",portalId: "...",formId: "..."});</script>

Thanks!

Hi @rafaelmaza,

Thanks for reaching out!

You are referring to an embedded HubSpot form on an external site correct?

If so, you cannot capture UTM parameters into a HubSpot form embedded into an external web page. You will need to use JavaScript to get the UTM parameters and pass them to the form hidden fields. I found this external guide to get you started: Get URL + UTM Parameters with Javascript (Easy!)

I would also like to invite a few of our subject matter experts to this conversation to get their thoughts on your script.

Hi @Ben_M, @Anton, @Teun - Do you have any thoughts for @rafaelmaza?

Thank you!

Best,

Kristen