# Button ID

**URL:** <https://community.hubspot.com/t/button-id/90073>\
**Category:** Blog, Website & Page Publishing\
**Tags:** starter\
**Created:** [September 20, 2023, 2:39pm UTC](https://community.hubspot.com/t/button-id/90073 "2023-09-20T14:39:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASarvis](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@ASarvis](https://community.hubspot.com/u/ASarvis)\
**Post date:** [September 20, 2023, 2:39pm UTC](https://community.hubspot.com/t/button-id/90073/1 "2023-09-20T14:39:19Z")

</div>

I’m trying to find the button ID and the abilty to add a button ID to a button that is on a landing page.

I am connecting facebook ads with the custom event of submitting form for my campaign and it is triggered by custom script that is looking for the button ID

i just don’t know where to find or edit the button ID that is both on the form and on the landing page of my site.

---

<div class="post-metadata">

**Author:** ![DianaGomez](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dianagomez/32/48035_2.png) [@DianaGomez](https://community.hubspot.com/u/DianaGomez)\
**Post date:** [September 20, 2023, 7:54pm UTC](https://community.hubspot.com/t/button-id/90073/2 "2023-09-20T19:54:16Z")

</div>

Hello @ASarvis,

Thank you for your inquiry.

Could you please share more context and screenshots of the button you mentioned?

The more details you provide us, the more options we will have to find a solution. Please share as much information as possible so that we can better understand the issue and assist you effectively.

Thank you for your cooperation.

Diana

---

<div class="post-metadata">

**Author:** ![ASarvis](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@ASarvis](https://community.hubspot.com/u/ASarvis)\
**Post date:** [September 20, 2023, 8:13pm UTC](https://community.hubspot.com/t/button-id/90073/3 "2023-09-20T20:13:47Z")

</div>

@DianaGomez Yes,

Here is the button in the webpage with the options: I didn’t build the page - and i don’t really know how the landing page editor works.

 ![screenshot 1.1.JPG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/2/8246a6914c3ba6066c39d8caddb11498358a250b.jpeg)

when I try to edit the button in the forms section this is the only option i get:

 ![screenshot 1.2.JPG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/0/d0d582c398bb3733732aded9e42dce4edd942fb8.jpeg)

The reason i need to add the button ID to this is so that I can get the code in the backend to listen for the submission of this button to then trigger the submit event in facebook ads.  
This is the code I would be adding to the landing page:

```lia-code-sample
<script type="text/javascript">
document.getElementById('submitButton').addEventListener('click', function() {
 fbq('track', 'CompleteRegistration');
}, false);
</script>

```

---

<div class="post-metadata">

**Author:** ![DianaGomez](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dianagomez/32/48035_2.png) [@DianaGomez](https://community.hubspot.com/u/DianaGomez)\
**Post date:** [September 20, 2023, 9:15pm UTC](https://community.hubspot.com/t/button-id/90073/4 "2023-09-20T21:15:38Z")

</div>

Hi @ASarvis,

Thank you for the details and screenshots.

I’d like to involve some of our experts in the conversation to review whether they have any suggestions for you or if they have encountered a similar case in their experience and how they resolved it.

Hi [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259), @HubDoPete, @DanielJeal, [@Ben\_M](https://community.hubspot.com/t5/user/viewprofilepage/user-id/87451). Do any of you happen to have any suggestions for @ASarvis ?

Thank you all for your contributions.

Best regards,

Diana

---

<div class="post-metadata">

**Author:** ![Ben\_M](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ben_m/32/2679_2.png) [@Ben\_M](https://community.hubspot.com/u/Ben_M)\
**Post date:** [September 20, 2023, 10:49pm UTC](https://community.hubspot.com/t/button-id/90073/5 "2023-09-20T22:49:12Z")

</div>

Do you have a link to the page in question even if it is in testing? Often the ID may be set and you might not have the ability to edit it. If you inspect the code, you can see if an ID is being set or if there is a unique id/name already applied. Even if you can’t use the ID so long as you have unique way to identify the element (ie: name for instance) you might be able to make an edit to your JS to make this work.

---

<div class="post-metadata">

**Author:** ![ASarvis](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@ASarvis](https://community.hubspot.com/u/ASarvis)\
**Post date:** [September 21, 2023, 12:33pm UTC](https://community.hubspot.com/t/button-id/90073/6 "2023-09-21T12:33:42Z")

</div>

[@Ben\_M](https://community.hubspot.com/t5/user/viewprofilepage/user-id/87451) yes when i inspect it this is the code block. There is no ID

`<input type="submit" class="hs-button primary large" value="Yes! I Want A Beautiful Lawn ➤">`

Here is the link to the page: [#1 Charlotte Aeration & Seeding | Satisfaction guaranteed!](https://www.topturf.net/charlotte-aeration-seeding)

---

<div class="post-metadata">

**Author:** ![Ben\_M](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ben_m/32/2679_2.png) [@Ben\_M](https://community.hubspot.com/u/Ben_M)\
**Post date:** [September 21, 2023, 2:54pm UTC](https://community.hubspot.com/t/button-id/90073/7 "2023-09-21T14:54:48Z")

</div>

A couple of ideas for you. First is if you want the ID, you might have to go into the design manager and update the module to allow for the ID to be editable. Another option, would be to not use the getElementById, but look to the querySelectorAll to find the button with the classes “hs-button primary large” that are on the button today.

Or the other option coming to mind, personally speaking I have implemented tracking in the past mostly with a tag manager like GTM, but you could setup an event listener to then push your facebook event when a successful submission occurs. At present, your facebook tracking would fire even if the form submission fails because it is looking for click as opposed to a successful submission. It would be something like this: [https://medium.com/@dillonjones/the-easiest-way-to-setup-hubspot-form-tracking-in-google-analytics-a8ad9ab1fc4d](https://medium.com/@dillonjones/the-easiest-way-to-setup-hubspot-form-tracking-in-google-analytics-a8ad9ab1fc4d) .
