Custom Events Not Tracking Consistently


The challenge I'm having is that when I use multiple instances of a unique ID on the same page (for example, id="ask_button"), the LAST instance isn't tracked as an event completion. Very strange, right?

I've run a series of tests and initially believed that only the first instance fired, but after testing a page that had the same button in 3 places (with the same unique ID), it became clear that only the final instance of the event doesn't trigger.

The following pages all have the same issue: (there are two "ask" buttons, the second doesn't fire)
/outcomes (there are two "RUO" buttons ["explore" and "learn more"], the second doesn't fire)
/assays (there are two "ask" buttons, the second doesn't fire)
/dx/testing-methods (there are three "ask" buttons, the last one doesn't fire)

Super strange issue. I haven't seen any documentation as to why this would be happening or how to avoid it, and the HubSpot support team has been both slow and entirely unhelpful on this issue.

They suggested I put my issue here in the Developer's forum, claiming that there must be something wrong with our button setup. However, I don't think we're doing anything fancy with the buttons (see example below):

Learn more

Any suggestions?

Appreciate it much! :slight_smile:



Hi @Marcus_Krieg, taking a look at several of your pages, I'm seeing you've set the same id for two separate elements. Having more than one element with the same ID is invalid in HTML and will not work with our events API. You should instead use a class if you're looking to track all clicks to your buttons with a specific class. If you're looking to track each button as a separate event entirely and not lump together events with a class, you'll need to give each button a separate ID, or you'll need the Jquery selector. Let me know if there's anything I can clarify


Hi @Marcus_Krieg, one other question/ ask of you. Can you please reply with the ticket number of the support case you were working on? I'd like to close the loop and follow up with that Support Rep. Thank you!


Thanks Connor! I've scheduled a call with my developers to see how we can use classes or Jquery to achieve the same thing. Really appreciate the clarification.

Ticket number: #2091734

P.S. Perhaps that limitation should be in the custom event setup documentation?


Hi @Marcus_Krieg, sounds good! We'll put that into consideration, but since it's a fundamental principal of HTML, we left that out.

Thank also for the ticket number! I've spoken with Julia and closed the loop with her. Much appreciated, and if you have questions about Events, feel free to respond to this thread or create a new one!


Not everyone who uses HubSpot is a coder and can write HTML. Some of us only have the documentation to go off. Very typical developer response, however. ("You should just know code, then it would be easy")



Hi @Marcus_Krieg, didn't mean it in any condescending way, rather more as a statement of why we made the docs as such but can definitely see how it came off that way! I'm not a developer myself, but happen to know about the APIs and know a bit about coding. I started off at 0 only a few years ago, so it was shortsighted of me to assume the technical level of a poster here in the forums! My apologies. In my response, I was thinking of the Developer Documentation here for whatever reason, but when you're talking about the documentation, you more likely meant you were looking at the docs here, correct? I can submit feedback to the knowledge team to see if we can revise this sentence to be more explicit:

Right-click anywhere on your page and select View page source or Inspect to determine the element's unique ID.

Something like, Note: HTML elements cannot share ID's but can share classes might help clear some things up.