How do we know when the Adobe Target activity finished loading on to the DOM
I want to dispatch a custom event from Adobe Target, once the Adobe Target Activity has been fully loaded on the DOM. (For example an Experience Fragment from Adobe Target replacing an AEM XF, and dispatchEvent should be triggered only once this is completed)
From AEM end, then the code will listen to this custom event and start processing something.
I've already tried adding a script from Adobe Target like this, but it didn't work as I expected.
Appreciate any advice on this.
<script>
window.onload = function() {
const event = new Event("targetContentLoaded");
window.dispatchEvent(event);
}
</script>