# Trigger javascript function from CTA click?

**URL:** <https://community.hubspot.com/t/trigger-javascript-function-from-cta-click/143209>\
**Category:** CMS Development\
**Tags:** ctas, marketing, analytics-tools\
**Created:** [November 22, 2025, 9:52pm UTC](https://community.hubspot.com/t/trigger-javascript-function-from-cta-click/143209 "2025-11-22T21:52:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OJ\_ONT](https://avatars.discourse-cdn.com/v4/letter/o/a587f6/32.png) [@OJ\_ONT](https://community.hubspot.com/u/OJ_ONT)\
**Post date:** [November 22, 2025, 9:52pm UTC](https://community.hubspot.com/t/trigger-javascript-function-from-cta-click/143209/1 "2025-11-22T21:52:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Brenner](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/brenner/32/13741_2.png) [@Brenner](https://community.hubspot.com/u/Brenner)\
**Post date:** [December 8, 2025, 11:47am UTC](https://community.hubspot.com/t/trigger-javascript-function-from-cta-click/143209/2 "2025-12-08T11:47:15Z")

</div>

Hey [@OJ\_ONT](https://community.hubspot.com/t5/user/viewprofilepage/user-id/824832) ,

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?

---

<div class="post-metadata">

**Author:** ![OJ\_ONT](https://avatars.discourse-cdn.com/v4/letter/o/a587f6/32.png) [@OJ\_ONT](https://community.hubspot.com/u/OJ_ONT)\
**Post date:** [December 22, 2025, 5:03pm UTC](https://community.hubspot.com/t/trigger-javascript-function-from-cta-click/143209/3 "2025-12-22T17:03:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JOB3](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/job3/32/16381_2.png) [@JOB3](https://community.hubspot.com/u/JOB3)\
**Post date:** [December 22, 2025, 11:46pm UTC](https://community.hubspot.com/t/trigger-javascript-function-from-cta-click/143209/4 "2025-12-22T23:46:11Z")

</div>

Hi [@OJ\_ONT](https://community.hubspot.com/t5/user/viewprofilepage/user-id/824832) 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 I[deas Forum](https://community.hubspot.com/t5/HubSpot-Ideas/idb-p/HubSpot_Ideas) 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​🚀 - Josefina, Community Moderator
