I’m trying to figure out the right way to embed a custom module in to a landing page template. We facilitate/host events for businessess and we use Landing Pages to allow employees to register for said events. We’re automating some of analytics by using Zapier to collect ALL registrants in a consolidated gsheet template. This works great. However, what I need to happen is for this custom module to get the URL the form was submitted on. I believe I’ve found what I need for that but now I can’t figure out how to include this custom module on my landing page/form to populate a hidden field on my form when it loads prior to submission. By doing this, I can collect that information to sort through the registrants in our master list.
Here’s the custom js I’m using:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "8138345",
formId: "cf018c72-5032-4882-813d-e51ebafeec06"
onFormReady: function($form) {
var v = window.location.href;
$form.find('input[name="event_attending"]').val(v).change();
}
});
</script>
Hello @JTramp4
You have to Locate the Landing Page Template, Insert the Custom Module Code, avaScript code you provided inside a <script> tag. Ensure that you place it within the landing page template’s HTML structure. Make sure to include the necessary script tag for the HubSpot form embed (<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/embed/v2.js”></script>). And Modify the Custom Module.
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "8138345",
formId: "cf018c72-5032-4882-813d-e51ebafeec06",
onFormReady: function($form) {
var v = window.location.href;
$form.find('input[name="event_attending"]').val(v).change();
}
});
</script>
The custom module code will now be included in the landing page, and the hidden field on the form will be populated with the URL when the form loads.
Himanshu,
Thank you for your prompt reply. Maybe this is our subscription or my permissions (I have sys admin within our envirnment) but when I search for the landing page, I have to use the search bar function and I can find it. If I try to browse to the same path, it’s not visible. Is that a permissions issue?
When I do find it, there’s a banner that says I can’t edit and can only customize a cloned version. However, I have no option to clone the landing pages.
Thoughts?