Adobe Target integration with AEM
We have few buttons on our webpage. When "documentContentLoaded" event is fired, we are assigning event listener to the buttons. We have added target script in the head section and our client library is near the closure of body tag. Sometimes, target script is loading before our client and vice versa. When our client library is loaded before target script, event listeners get assigned to the buttons. Then target script loads which replaces HTML body with a new body. This deletes old buttons and adds the same buttons again. Due to this, event listeners aren't working. This doesn't happen if target scripts loads before our client library. What is a possible solution to load target script before client library.