# Custom Module on Landing Page

**URL:** <https://community.hubspot.com/t/custom-module-on-landing-page/81358>\
**Category:** CMS Development\
**Tags:** forms, landing-pages\
**Created:** [May 17, 2023, 5:33am UTC](https://community.hubspot.com/t/custom-module-on-landing-page/81358 "2023-05-17T05:33:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JTramp4](https://avatars.discourse-cdn.com/v4/letter/j/bbce88/32.png) [@JTramp4](https://community.hubspot.com/u/JTramp4)\
**Post date:** [May 17, 2023, 5:33am UTC](https://community.hubspot.com/t/custom-module-on-landing-page/81358/1 "2023-05-17T05:33:51Z")

</div>

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:

```lia-code-sample
<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>

```

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [May 17, 2023, 8:29am UTC](https://community.hubspot.com/t/custom-module-on-landing-page/81358/2 "2023-05-17T08:29:13Z")

</div>

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](https://js.hsforms.net/forms/embed/v2.js)”\>\</script\>). And Modify the Custom Module.

```lia-code-sample
<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.

---

<div class="post-metadata">

**Author:** ![JTramp4](https://avatars.discourse-cdn.com/v4/letter/j/bbce88/32.png) [@JTramp4](https://community.hubspot.com/u/JTramp4)\
**Post date:** [May 18, 2023, 4:11am UTC](https://community.hubspot.com/t/custom-module-on-landing-page/81358/3 "2023-05-18T04:11:26Z")

</div>

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?
