Here’s the problem I’m trying to solve:
In my DEV environment, I have disabled a specific DOM Header Insertion because it should only be loaded when in PROD. Then after deploying DEV to PROD, I have to edit the DOM Header Insertion to enable the loading of an external resource.
I’m thinking I should be able to solve this by loading this external resource (hotjar) via onAppLoad global named action… but would a function action have access to the stage this site is running in? Is there a better way to do this?
I overlooked that hotjar is already dynamically loaded meaning you can just as easily paste their installation code into a function action as a DOM Header Insertion; which means it’s really easy to load via an action.
I did get this to work for now, but I think there’s a feature request here which I can better expand on in a new post, so I’ll close this one.
One follow up note,
Depending on how 3rd party libraries are initialized, you can often download and initianize them in the onFormLoad actions.
An example of this is a payment gateway that looks for a DOM element and injects its self into it.
This would mean that you could not init it from any page, and only setup in the page that already has the element.