Hey Ivan,
You’re right about bubble not cooperating with JavaScript sometimes. Are you using an HTML element with a tag or are creating a plugin and using the plugin environment? Regardless, if performance is the most important factor here, it’s probably best to host your script on netlify or AWS and iframe it in. Although I recommend trying it with a plugin first. If you need help, I’m glad to to over the options and discuss the details. I specialize in expanding bubbles functionality and I also offer counselling services, the first 30 minutes being free.
Check out my profile you can see my public plugins if you’re curious. Send me a DM or an email at jonah@visioncode.io
All the best,