AppMeasurement loading race conditions
I'm running into an issue where some of my code in a third party script is running before the AppMeasurement library is loaded. I'm trying to figure out what the best solution to solve this issue. Here is the setup:
- Adobe Analytics tool configured to load at page bottom
- Global rule that is set to load on DOM ready. This rule has a non-sequential third party script that watches for custom JS events and fires custom link tracking
- A page rule that loads on DOM ready that tracks the normal page load events
The problem I'm having is that the global rule seems to be firing the custom event before AppMeasurement has been loaded which causes a JS error to happen. The JS error then interferes with other JS thats running. I need the Adobe Analytics tracking to fire at the bottom of the page because we set some global JS data as the page loads. I've tried switching to a sequential third-part script but then we run into a situation where the custom event watcher isn't set when it's being triggered.
I think the best case scenario would be to be able to load the AppMeasrurement library at the top of the page while keeping the Adobe Analytics page load event triggering at the bottom of the page. Is that something that is possible?