Challenges Embedding an Interactive Morse Code Translator Tool on a HubSpot CMS Page

I run a Morse Code focused website that includes an interactive translator where users can convert text to Morse code and decode Morse back into plain text. The tool is built using JavaScript and includes real-time translation, audio playback for dots and dashes, and simple copy/share functionality. Recently, I’ve been exploring the possibility of embedding this translator into a HubSpot CMS page as part of an educational resource or interactive content experience. However, I’ve encountered several technical challenges related to scripts, page performance, and CMS restrictions.

One of the main issues is related to how HubSpot handles custom JavaScript within CMS pages or modules. My Morse Code translator relies on continuous input detection and DOM updates to provide instant conversion results. When I place the script inside a HubSpot custom module or page template, some of the functions don’t initialize correctly, particularly when the page loads asynchronously or when other HubSpot scripts are running. I’m unsure whether this is due to script loading order, HubSpot’s asset pipeline, or conflicts with existing CMS scripts.

Another challenge is maintaining performance and responsiveness. The translator processes input in real time and can generate Morse audio signals using browser audio APIs. On some HubSpot pages that already contain forms, analytics scripts, and tracking tools, the page becomes noticeably heavier and the translator input sometimes lags slightly. I’m interested in learning whether there are best practices for hosting interactive tools within HubSpot while keeping the page lightweight and responsive.

I’m also considering how best to structure the feature from a content management perspective. Ideally, I’d like marketers or content editors using HubSpot to be able to easily add the Morse Code translator to landing pages without needing to manually modify code every time. I’m not sure whether the best approach is creating a reusable custom module, embedding the tool through an iframe, or hosting the translator externally and linking to it from HubSpot pages.

Another area where I’m looking for guidance is analytics and user interaction tracking. HubSpot’s analytics tools are powerful, and I’d like to track how users interact with the Morse Code translator—such as how often they convert text, how long they stay on the tool, or which features they use. However, I’m unsure how to connect these interactions to HubSpot’s event tracking or CRM data without adding too much complexity to the implementation.

I’d really appreciate feedback from others in the HubSpot community who have embedded interactive tools or custom JavaScript applications into HubSpot CMS pages. Are there recommended architectural patterns for integrating tools like translators, calculators, or generators into HubSpot? I want to make sure the Morse Code feature works smoothly within the CMS while staying maintainable, performant, and easy for non-developers on the team to manage.

Hey @BStokes2 :waving_hand: I hope that you are well!
Thanks for reaching out to the HubSpot Community!
To start with, I’d recommend checking these resources as they might help:
- Coding Custom Modules
- Optimizing your HubSpot CMS site for speed
- How to use JavaScript frameworks on HubSpot
Now, let’s consult our Top Experts: Hi @SteveHTM, @Christensen and @evaldas do you have recommendations to help @BStokes2, please?
Thanks so much and have a wonderful weekend!
Bérangère

Hey @BStokes2,

funny coincidence - after watching the first livestream of Jon McLarens “Let’s Build a Website” series on YouTube, I’ve built a morse code module which translates text inputs into some graphic elements and gave it the Hubspot DevRel to maybe use it on the previous developer.hubspot.com website.

You can watch the live demo (second video of the series) on YouTube.

Here’s the GitHub repo.

Feel free to modify it to your needs.

Note:
As it was intended to be a Hero Module, the JS is not build for multi instances of the module.

---

As for embedding interactive tools/JS, I’d say put the whole JS of a module either into a dedicated JS file (if you’re putting it into the module.js area/file) and use {% require_js %} or {% require_head %} blocks in the module.html (similar to how I’ve done it in my module)

Hope this helps somehow

best,

Anton


@BStokes2 wrote:

I run a Morse Code focused website that includes an interactive translator where users can convert text to Morse code and decode Morse back into plain text. The tool is built using JavaScript and includes real-time translation, audio playback for dots and dashes, and simple copy/share functionality. Recently, I’ve been exploring the possibility of embedding this translator into a HubSpot CMS page as part of an educational resource or interactive content experience. However, I’ve encountered several technical challenges related to scripts, page performance, and CMS restrictions.

One of the main issues is related to how HubSpot handles custom JavaScript within CMS pages or modules. My morse code audio decoder translator relies on continuous input detection and DOM updates to provide instant conversion results. When I place the script inside a HubSpot custom module or page template, some of the functions don’t initialize correctly, particularly when the page loads asynchronously or when other HubSpot scripts are running. I’m unsure whether this is due to script loading order, HubSpot’s asset pipeline, or conflicts with existing CMS scripts.

Another challenge is maintaining performance and responsiveness. The translator processes input in real time and can generate Morse audio signals using browser audio APIs. On some HubSpot pages that already contain forms, analytics scripts, and tracking tools, the page becomes noticeably heavier and the translator input sometimes lags slightly. I’m interested in learning whether there are best practices for hosting interactive tools within HubSpot while keeping the page lightweight and responsive.

I’m also considering how best to structure the feature from a content management perspective. Ideally, I’d like marketers or content editors using HubSpot to be able to easily add the morse code audio decoder translator to landing pages without needing to manually modify code every time. I’m not sure whether the best approach is creating a reusable custom module, embedding the tool through an iframe, or hosting the translator externally and linking to it from HubSpot pages.

Another area where I’m looking for guidance is analytics and user interaction tracking. HubSpot’s analytics tools are powerful, and I’d like to track how users interact with the Morse Code translator—such as how often they convert text, how long they stay on the tool, or which features they use. However, I’m unsure how to connect these interactions to HubSpot’s event tracking or CRM data without adding too much complexity to the implementation.

I’d really appreciate feedback from others in the HubSpot community who have embedded interactive tools or custom JavaScript applications into HubSpot CMS pages. Are there recommended architectural patterns for integrating tools like translators, calculators, or generators into HubSpot? I want to make sure the Morse Code feature works smoothly within the CMS while staying maintainable, performant, and easy for non-developers on the team to manage.


Thanks for sharing that what a coincidence that you built a Morse-related module as well! I’ll definitely check out the GitHub repo and the livestream demo. Seeing how you structured the module and handled the JS integration inside HubSpot CMS will be really useful, especially since I’m trying to make the translator easy for marketers to drop into pages without touching code.

The note about the module being designed for a single instance is also helpful to know ahead of time. My translator currently supports multiple input/output areas on a page, so I’ll take a look at how your implementation scopes the JS and see what adjustments might be needed to support multiple modules without conflicts.

Also, thanks for mentioning the {% require_js %} and {% require_head %} approach. That might solve some of the initialization issues I’ve been seeing when scripts load alongside HubSpot’s other assets. I’ll experiment with moving my translator logic into a dedicated JS file and loading it that way. Out of curiosity, when you tested your module, did you run into any performance or event-handling quirks when the page also had forms, analytics scripts, or other HubSpot modules running?

Hey @BStokes2,

you’re welcome.

As it was only one instance of the module on a single page, there were no performance issues. Especially as it’s a very static JS used as some sort of background pattern generation.

Maybe I’ll look at it and rewrite it to pure HubL at some point so it will be a fully static solution without any potential performance issues (other than using it for huge paragraphs)

best,

Anton

Interactive Morse code tools are a good example of how web development and communication technology can work together. Translators that convert dots and dashes into readable text also help demonstrate real-time signal processing and user interaction.