CMS Development

AYadav
Member

Store utm_source in a variable

I want to store the utm_source in a variable which I am able to get in the hidden field in a form and append it to another links url

 

Form code
<script>
hbspt.forms.create({
region: "na1",
portalId: "id",
formId: "{{ module.hidden_form.form_id }}",
onFormReady: function($form, ctx){
var hv = $('.hs-utm_source input').attr("value");
console.log(hv);
}
});
</script>

 

It always gives me undefined

0 Upvotes
2 Replies 2
tjoyce
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Store utm_source in a variable

@AYadav - Can you link to the preview of the page?

dennisedson
HubSpot Product Team
HubSpot Product Team

Store utm_source in a variable

@tjoyce ,

I feel like you might be able to help here

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes