Supported way to run application-level JavaScript in a Constellation portal

the requirement that you are listing are similar to the approach I documented here Unlocking User Insights: How to configure Analytics in your Constellation Application - pyPortalIcon is a fragment that is loaded in the portal head - same approach is available in Traditional UI - DX Component should really be used when rendering UI on the screen - if this is about sending events to an external system, the pyPortalIcon is preferred (lightweight - no React deps)