Trigger javascript function from CTA click?

Our website uses Mavenoid as a chat/forms pop-up tool*.
To trigger the opening of Mavenoid I need to call:

mavenoid.push({ event: 'assistant-open' })

So far I haven’t been able to find a way to use CTAs to open Mavenoid reliably.
I thought I might be able to hijack the click on a text/button CTA embed to open mavenoid.
I tried a few different CTA types and using the CTA JS API to listen to the click and then cancel the CTA action. I managed to use the click event, on url CTA buttons, but couldn’t stop the page reloading or changing (even if I configure the CTA URL the same as the page the CTA is on).

Has anyone managed to achieve this?

*We do this because we need to pull in sales team scheduling data from our corporate address book. HubSpot meting links won’t work for us at our scale.

Hey @OJ_ONT ,

HubSpot’s CTAs don’t work in this case because they run inside an iframe — even when using the CTA JS API.

In this situation, I think you can create a custom CTA (built with HTML instead of the HubSpot CTA tool) and use custom events to track it.

This CTA can be built using CMS Hub, making it 100% functional.

Does this help?

Yes, that makes sense to use custom events. It’s a shame that we would be abandoning CTAs to acheive this, as it means we will have data spread across multiple data models / reports.

Hi @OJ_ONT thanks so much for confirming the solution @Brenner suggested is helpful for this scenario. This will help future members coming with the same goal ! If you would like to see this feature live within the default HubSpot CTAs tool, I highly recommend to request this feature in our Ideas Forum by submitting or voting a similar idea. The Product teams are constantly monitoring this forum to prioritize features that will enhance the platform so I highly encourage your contributions​:rocket: - Josefina, Community Moderator